private List <Symbol> LoadFutureChain(Symbol baseFuture, DateTime date, TickType tickType, Resolution res) { var filePath = LeanData.GenerateZipFilePath(_dataDirectory, baseFuture, date, res, tickType); //load future chain first var config = new SubscriptionDataConfig(typeof(ZipEntryName), baseFuture, res, TimeZones.NewYork, TimeZones.NewYork, false, false, false, false, tickType); var factory = new ZipEntryNameSubscriptionDataSourceReader(config, date, false); return(factory.Read(new SubscriptionDataSource(filePath, SubscriptionTransportMedium.LocalFile, FileFormat.ZipEntryName)) .Select(s => s.Symbol).ToList()); }
public void ReadsZipEntryNames() { var time = new DateTime(2016, 03, 03, 12, 48, 15); var source = Path.Combine("TestData", "20151224_quote_american.zip"); var config = new SubscriptionDataConfig(typeof(ZipEntryName), Symbol.Create("XLRE", SecurityType.Option, Market.USA), Resolution.Tick, TimeZones.NewYork, TimeZones.NewYork, false, false, false); var factory = new ZipEntryNameSubscriptionDataSourceReader(config, time, false); var expected = new[] { Symbol.CreateOption("XLRE", Market.USA, OptionStyle.American, OptionRight.Call, 21m, new DateTime(2016, 08, 19)), Symbol.CreateOption("XLRE", Market.USA, OptionStyle.American, OptionRight.Call, 22m, new DateTime(2016, 08, 19)), Symbol.CreateOption("XLRE", Market.USA, OptionStyle.American, OptionRight.Put, 37m, new DateTime(2016, 08, 19)), }; var actual = factory.Read(new SubscriptionDataSource(source, SubscriptionTransportMedium.LocalFile, FileFormat.ZipEntryName)).ToList(); // we only really care about the symbols CollectionAssert.AreEqual(expected, actual.Select(x => x.Symbol)); Assert.IsTrue(actual.All(x => x is ZipEntryName)); }