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);
        }
        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;
                    }
                }
            }
        }