Example #1
0
 public void InitPortfolio(IPortfolio portfolio)
 {
     TargetPortfolio = portfolio;
     //TargetList.Clear();
     if (portfolio != null)
     {
         portfolio.PositionList.ForEach(v =>
         {
             var pos = TargetList.FirstOrDefault(x => x.TargetTicker == v.Name);
             if (pos == null)
             {
                 PosWeightTarget posweight     = new PosWeightTarget();
                 posweight.TargetTicker        = v.Name;
                 posweight.Shares              = v.Shares;
                 posweight.CurrentPrice        = v.CurrentPrice;
                 posweight.CurrentWeight       = v.CurrentValue / portfolio.CurrentValue;
                 posweight.DataTime            = v.DataTime;
                 posweight.CurrentCurrency     = v.CurrentCurrency;
                 posweight.TargetPortfolioName = portfolio.Name;
                 TargetList.Add(posweight);
             }
         });
     }
 }