示例#1
0
 public static Parameter TransParameter(PosWeightTarget value)
 {
     return(new Parameter()
     {
         Name = value.TargetTicker,
         Value = CommonLib.CommonProc.ConvertObjectToString(value)
     });
 }
        void SaveValue(PosWeightTarget target)
        {
            //if (list == null||TargetPortfolio==null) return;
            //TargetList.Clear();
            //list.ForEach(v =>
            //{
            //    TargetList.Add(v);

            //});
            Target = target;
            //SaveInfoToParameterList();
        }
示例#3
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);
             }
         });
     }
 }