private void Start(StrategyContainer strategy, DateTime?startDate, DateTime?stopDate, TimeSpan?candlesTimeFrame, bool onlyInitialize) { if (Connector == null) { throw new InvalidOperationException("Connector=null"); } strategy.CheckCanStart(); var from = startDate ?? DateTime.Today.AddDays(-strategy.HistoryDaysCount); var to = stopDate ?? DateTime.Now; var strategyConnector = new StrategyConnector(strategy, from, to, candlesTimeFrame ?? TimeSpan.FromMinutes(5), onlyInitialize); ConfigManager.GetService <LogManager>().Sources.Add(strategyConnector); strategy.Connector = strategyConnector; strategy.SetCandleManager(CreateCandleManager(strategyConnector, TimeSpan.FromDays((strategy.HistoryDaysCount + 1) * 2))); strategy.SetIsEmulation(false); strategyConnector.Connected += strategyConnector.StartExport; strategy.Start(); strategyConnector.Connect(); }
private void Start(StrategyContainer strategy, DateTime? startDate, DateTime? stopDate, TimeSpan? candlesTimeFrame, bool onlyInitialize) { if (Connector == null) throw new InvalidOperationException("Connector=null"); strategy.CheckCanStart(); var from = startDate ?? DateTime.Today.AddDays(-strategy.HistoryDaysCount); var to = stopDate ?? DateTime.Now; var strategyConnector = new StrategyConnector(strategy, from, to, candlesTimeFrame ?? TimeSpan.FromMinutes(5), onlyInitialize); ConfigManager.GetService<LogManager>().Sources.Add(strategyConnector); strategy.Connector = strategyConnector; strategy.SetCandleManager(CreateCandleManager(strategyConnector, TimeSpan.FromDays((strategy.HistoryDaysCount + 1) * 2))); strategy.SetIsEmulation(false); strategy.Start(); strategyConnector.Connect(); }