Beispiel #1
0
            private void ProcessTime(DateTimeOffset time, string boardCode)
            {
                if (boardCode.IsEmpty())
                {
                    return;
                }

                var exchangeBoard = ExchangeBoard.GetBoard(boardCode);

                if (exchangeBoard == null)
                {
                    return;
                }

                if (time <= exchangeBoard.Exchange.ToExchangeTime(_connectTime))
                {
                    return;
                }

                _isInitialization = false;
                _strategy.SetIsInitialization(false);
            }
Beispiel #2
0
        private IEnumerable <Strategy> GetStrategies()
        {
            EmulationConnector.AddInfoLog(LocalizedStrings.Str3592);

            var enumerator = Strategies.GetEnumerator();

            while (enumerator.MoveNext())
            {
                var strategy = (StrategyContainer)enumerator.Current;

                strategy.CheckCanStart();

                var container = new StrategyContainer
                {
                    Id                 = strategy.Id,
                    StrategyInfo       = _infoClone,
                    MarketDataSettings = strategy.MarketDataSettings,
                    Connector          = EmulationConnector,
                    //SessionType = SessionType.Optimization,
                };

                container.Environment.AddRange(strategy.Environment);

                container.SetCandleManager(CreateCandleManager());
                container.SetIsEmulation(true);
                container.SetIsInitialization(false);

                container.NameGenerator.Pattern = strategy.NameGenerator.Pattern;
                container.Portfolio             = strategy.Portfolio;
                container.Security = strategy.Security;
                container.Strategy = strategy;

                container.UnrealizedPnLInterval = EmulationSettings.UnrealizedPnLInterval ?? ((EmulationSettings.StopTime - EmulationSettings.StartTime).Ticks / 1000).To <TimeSpan>();

                _infoClone.Strategies.Add(container);

                yield return(container);
            }

            EmulationConnector.AddInfoLog(LocalizedStrings.Str3593);
        }