示例#1
0
        public void ApplyStrategySettings()
        {
            _accountVm.Host.PortfApplyStrategySettings(this.Id,
                                                       StrategySetting.Name, StrategySetting.Serialize());

            _accountVm.PublishChanged();
        }
示例#2
0
        public entity.PortfolioItem GetEntity()
        {
            entity.PortfolioItem portfolioItem = new entity.PortfolioItem();
            portfolioItem.ID              = Id;
            portfolioItem.AutoOpen        = AutoOpen;
            portfolioItem.AutoStopGain    = AutoStopGain;
            portfolioItem.AutoStopLoss    = AutoStopLoss;
            portfolioItem.AutoTrack       = AutoTracking;
            portfolioItem.EnablePrefer    = EnablePrefer;
            portfolioItem.Quantity        = Quantity;
            portfolioItem.MaxPosition     = MaxPosition;
            portfolioItem.OpenTimes       = OpenTimes;
            portfolioItem.CloseTimes      = 0;
            portfolioItem.CurrentPosition = Position;
            portfolioItem.AvgCost         = AvgCost;

            foreach (var legVm in _legs)
            {
                entity.LegItem leg = new entity.LegItem();
                leg.Symbol      = legVm.Symbol;
                leg.Side        = legVm.Side;
                leg.Ratio       = legVm.Ratio;
                leg.IsPreferred = legVm.IsPreferred;
                portfolioItem.Legs.Add(leg);
            }

            portfolioItem.StrategyName = StrategySetting.Name;
            portfolioItem.StrategyData = StrategySetting.Serialize();

            return(portfolioItem);
        }