public void Setup() { var sunday = new LocalMarketHours(DayOfWeek.Sunday, new TimeSpan(17, 0, 0), TimeSpan.FromTicks(Time.OneDay.Ticks - 1)); var monday = LocalMarketHours.OpenAllDay(DayOfWeek.Monday); var tuesday = LocalMarketHours.OpenAllDay(DayOfWeek.Tuesday); var wednesday = LocalMarketHours.OpenAllDay(DayOfWeek.Wednesday); var thursday = LocalMarketHours.OpenAllDay(DayOfWeek.Thursday); var friday = new LocalMarketHours(DayOfWeek.Friday, TimeSpan.Zero, new TimeSpan(17, 0, 0)); var earlyCloses = new Dictionary <DateTime, TimeSpan>(); _exchangeHours = new SecurityExchangeHours(TimeZones.NewYork, USHoliday.Dates.Select(x => x.Date), new[] { sunday, monday, tuesday, wednesday, thursday, friday }.ToDictionary(x => x.DayOfWeek), earlyCloses); _liveTradingDataFeed = new TestableLiveTradingDataFeed(); var jobPacket = new LiveNodePacket() { DeployId = "", Brokerage = BrokerageName.OandaBrokerage.ToString(), DataQueueHandler = "LiveDataQueue" }; var algo = new TestAlgorithm(); var dataManager = new DataManager(_liveTradingDataFeed, new UniverseSelection(_liveTradingDataFeed, algo), algo.Settings, algo.TimeKeeper); algo.SubscriptionManager.SetDataManager(dataManager); _liveTradingDataFeed.Initialize(algo, jobPacket, new LiveTradingResultHandler(), new LocalDiskMapFileProvider(), null, new DefaultDataProvider(), dataManager); algo.Initialize(); }
public void Setup() { var sunday = new LocalMarketHours(DayOfWeek.Sunday, new TimeSpan(17, 0, 0), TimeSpan.FromTicks(Time.OneDay.Ticks - 1)); var monday = LocalMarketHours.OpenAllDay(DayOfWeek.Monday); var tuesday = LocalMarketHours.OpenAllDay(DayOfWeek.Tuesday); var wednesday = LocalMarketHours.OpenAllDay(DayOfWeek.Wednesday); var thursday = LocalMarketHours.OpenAllDay(DayOfWeek.Thursday); var friday = new LocalMarketHours(DayOfWeek.Friday, TimeSpan.Zero, new TimeSpan(17, 0, 0)); var earlyCloses = new Dictionary <DateTime, TimeSpan>(); var lateOpens = new Dictionary <DateTime, TimeSpan>(); _exchangeHours = new SecurityExchangeHours(TimeZones.NewYork, USHoliday.Dates.Select(x => x.Date), new[] { sunday, monday, tuesday, wednesday, thursday, friday }.ToDictionary(x => x.DayOfWeek), earlyCloses, lateOpens); _liveTradingDataFeed = new TestableLiveTradingDataFeed(); var jobPacket = new LiveNodePacket() { DeployId = "", Brokerage = BrokerageName.OandaBrokerage.ToString(), DataQueueHandler = "LiveDataQueue" }; var algo = new TestAlgorithm(); var marketHoursDatabase = MarketHoursDatabase.FromDataFolder(); var symbolPropertiesDataBase = SymbolPropertiesDatabase.FromDataFolder(); var dataPermissionManager = new DataPermissionManager(); var dataProvider = new DefaultDataProvider(); var dataManager = new DataManager(_liveTradingDataFeed, new UniverseSelection( algo, new SecurityService(algo.Portfolio.CashBook, marketHoursDatabase, symbolPropertiesDataBase, algo, RegisteredSecurityDataTypesProvider.Null, new SecurityCacheProvider(algo.Portfolio)), dataPermissionManager, dataProvider), algo, algo.TimeKeeper, marketHoursDatabase, true, RegisteredSecurityDataTypesProvider.Null, dataPermissionManager); algo.SubscriptionManager.SetDataManager(dataManager); _liveSynchronizer = new LiveSynchronizer(); _liveSynchronizer.Initialize(algo, dataManager); _liveTradingDataFeed.Initialize(algo, jobPacket, new LiveTradingResultHandler(), new LocalDiskMapFileProvider(), null, dataProvider, dataManager, _liveSynchronizer, new DataChannelProvider()); algo.Initialize(); _config = SecurityTests.CreateTradeBarConfig(); }