Ejemplo n.º 1
0
        public void UpdatePortfolio(PortfolioVM pVM)
        {
            var portfolio = new PBPortfolio();

            portfolio.Name        = pVM.Name;
            portfolio.HedgeDelay  = pVM.Delay;
            portfolio.Threshold   = pVM.Threshold;
            portfolio.Hedging     = pVM.Hedging;
            portfolio.HedgeVolume = pVM.HedgeVolume;

            MessageWrapper.SendMessage((uint)BusinessMessageID.MSG_ID_MODIFY_PORTFOLIO, portfolio);
        }
Ejemplo n.º 2
0
        public void UpdateHedgeContracts(HedgeVM hVM, string PortfolioName)
        {
            var hedge = new PBHedgeContract();

            hedge.Exchange   = hVM.Exchange;
            hedge.Contract   = hVM.Contract;
            hedge.Underlying = hVM.Underlying;

            var portfolio = new PBPortfolio();

            portfolio.Name = PortfolioName;
            portfolio.HedgeContracts.Add(hedge);


            MessageWrapper.SendMessage((uint)BusinessMessageID.MSG_ID_HEDGE_CONTRACT_UPDATE, portfolio);
        }
Ejemplo n.º 3
0
        private void OnPortfolioUpdated(PBPortfolio portfolio)
        {
            var port = PortfolioVMCollection.FirstOrDefault(p => p.Name == portfolio.Name);

            if (port == null)
            {
                PortfolioVMCollection.Add(new PortfolioVM(this)
                {
                    Name = portfolio.Name, Delay = portfolio.HedgeDelay, Threshold = portfolio.Threshold, Hedging = portfolio.Hedging, HedgeVolume = portfolio.HedgeVolume
                });
            }
            else
            {
                port.Delay       = portfolio.HedgeDelay;
                port.Threshold   = portfolio.Threshold;
                port.Hedging     = portfolio.Hedging;
                port.HedgeVolume = portfolio.HedgeVolume;
            }
        }
Ejemplo n.º 4
0
        private void OnPortfolioHedgeContracts(PBPortfolio portfolio)
        {
            var port = PortfolioVMCollection.FirstOrDefault(p => p.Name == portfolio.Name);

            if (port != null)
            {
                foreach (var hc in portfolio.HedgeContracts)
                {
                    var hc_current = port.HedgeContractParams.FirstOrDefault(h => hc.Exchange == hc.Exchange && h.Underlying == hc.Underlying);
                    if (hc_current == null)
                    {
                        hc_current = new HedgeVM {
                            Exchange = hc.Exchange, Underlying = hc.Underlying, Contract = hc.Contract
                        };
                        port.HedgeContractParams.Add(hc_current);
                    }
                    else
                    {
                        hc_current.Contract = hc.Contract;
                    }
                }
            }
        }