diff --git a/Algorithm.CSharp/AddFutureContractWithContinuousRegressionAlgorithm.cs b/Algorithm.CSharp/AddFutureContractWithContinuousRegressionAlgorithm.cs index 7d0296464e23..1f5328a7a998 100644 --- a/Algorithm.CSharp/AddFutureContractWithContinuousRegressionAlgorithm.cs +++ b/Algorithm.CSharp/AddFutureContractWithContinuousRegressionAlgorithm.cs @@ -49,7 +49,7 @@ public override void Initialize() contractDepthOffset: 0 ); - _futureContract = AddFutureContract(FutureChainProvider.GetFutureContractList(_continuousContract.Symbol, Time).First()); + _futureContract = AddFutureContract(FuturesChain(_continuousContract.Symbol).First()); } /// @@ -115,12 +115,12 @@ public override void OnSecuritiesChanged(SecurityChanges changes) /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 76; + public long DataPoints => 61; /// /// Data Points count of the algorithm history /// - public int AlgorithmHistoryDataPoints => 0; + public int AlgorithmHistoryDataPoints => 1; /// /// Final status of the algorithm diff --git a/Algorithm.CSharp/AddFutureOptionContractDataStreamingRegressionAlgorithm.cs b/Algorithm.CSharp/AddFutureOptionContractDataStreamingRegressionAlgorithm.cs index f2f506569166..e24121a0ff7a 100644 --- a/Algorithm.CSharp/AddFutureOptionContractDataStreamingRegressionAlgorithm.cs +++ b/Algorithm.CSharp/AddFutureOptionContractDataStreamingRegressionAlgorithm.cs @@ -169,7 +169,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of the algorithm history /// - public int AlgorithmHistoryDataPoints => 0; + public int AlgorithmHistoryDataPoints => 2; /// /// Final status of the algorithm diff --git a/Algorithm.CSharp/AddFutureOptionContractFromFutureChainRegressionAlgorithm.cs b/Algorithm.CSharp/AddFutureOptionContractFromFutureChainRegressionAlgorithm.cs index fa91f4b20606..dc256d84fdba 100644 --- a/Algorithm.CSharp/AddFutureOptionContractFromFutureChainRegressionAlgorithm.cs +++ b/Algorithm.CSharp/AddFutureOptionContractFromFutureChainRegressionAlgorithm.cs @@ -93,12 +93,12 @@ public override void OnData(Slice slice) /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 12172; + public long DataPoints => 9922; /// /// Data Points count of the algorithm history /// - public int AlgorithmHistoryDataPoints => 0; + public int AlgorithmHistoryDataPoints => 2; /// /// Final status of the algorithm @@ -113,7 +113,7 @@ public override void OnData(Slice slice) {"Total Orders", "20"}, {"Average Win", "0%"}, {"Average Loss", "0%"}, - {"Compounding Annual Return", "386219349.202%"}, + {"Compounding Annual Return", "88398927.578%"}, {"Drawdown", "5.200%"}, {"Expectancy", "0"}, {"Start Equity", "100000"}, diff --git a/Algorithm.CSharp/AddFutureOptionSingleOptionChainSelectedInUniverseFilterRegressionAlgorithm.cs b/Algorithm.CSharp/AddFutureOptionSingleOptionChainSelectedInUniverseFilterRegressionAlgorithm.cs index 481956791110..5ce03e433496 100644 --- a/Algorithm.CSharp/AddFutureOptionSingleOptionChainSelectedInUniverseFilterRegressionAlgorithm.cs +++ b/Algorithm.CSharp/AddFutureOptionSingleOptionChainSelectedInUniverseFilterRegressionAlgorithm.cs @@ -108,7 +108,7 @@ public override void OnData(Slice slice) return; } - foreach (var chain in slice.OptionChains.Values) + foreach (var chain in slice.OptionChains.Values.OrderBy(x => x.Symbol.Underlying.ID.Date)) { var futureInvested = false; var optionInvested = false; @@ -220,7 +220,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 608380; + public long DataPoints => 319494; /// /// Data Points count of the algorithm history @@ -240,7 +240,7 @@ public override void OnEndOfAlgorithm() {"Total Orders", "2"}, {"Average Win", "0%"}, {"Average Loss", "0%"}, - {"Compounding Annual Return", "347.065%"}, + {"Compounding Annual Return", "309.669%"}, {"Drawdown", "0.900%"}, {"Expectancy", "0"}, {"Start Equity", "100000"}, diff --git a/Algorithm.CSharp/AutomaticIndicatorWarmupDataTypeRegressionAlgorithm.cs b/Algorithm.CSharp/AutomaticIndicatorWarmupDataTypeRegressionAlgorithm.cs index 1c2f44914df0..affb1ab04716 100644 --- a/Algorithm.CSharp/AutomaticIndicatorWarmupDataTypeRegressionAlgorithm.cs +++ b/Algorithm.CSharp/AutomaticIndicatorWarmupDataTypeRegressionAlgorithm.cs @@ -38,7 +38,7 @@ public override void Initialize() SetEndDate(2013, 10, 10); var SP500 = QuantConnect.Symbol.Create(Futures.Indices.SP500EMini, SecurityType.Future, Market.CME); - _symbol = FutureChainProvider.GetFutureContractList(SP500, StartDate).First(); + _symbol = FuturesChain(SP500).First(); // Test case: custom IndicatorBase indicator using Future unsubscribed symbol var indicator1 = new CustomIndicator(); @@ -151,7 +151,7 @@ protected override decimal ComputeNextValue(QuoteBar input) /// /// Data Points count of the algorithm history /// - public int AlgorithmHistoryDataPoints => 84; + public int AlgorithmHistoryDataPoints => 85; /// /// Final status of the algorithm diff --git a/Algorithm.CSharp/BasicTemplateContinuousFutureAlgorithm.cs b/Algorithm.CSharp/BasicTemplateContinuousFutureAlgorithm.cs index 9fb3841c76d8..764035c87aee 100644 --- a/Algorithm.CSharp/BasicTemplateContinuousFutureAlgorithm.cs +++ b/Algorithm.CSharp/BasicTemplateContinuousFutureAlgorithm.cs @@ -18,7 +18,6 @@ using QuantConnect.Orders; using QuantConnect.Interfaces; using System.Collections.Generic; -using System.Linq; using QuantConnect.Data.UniverseSelection; using QuantConnect.Indicators; using QuantConnect.Securities; @@ -118,7 +117,7 @@ public override void OnSecuritiesChanged(SecurityChanges changes) /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 713375; + public long DataPoints => 162575; /// /// Data Points count of the algorithm history @@ -161,7 +160,7 @@ public override void OnSecuritiesChanged(SecurityChanges changes) {"Estimated Strategy Capacity", "$7100000.00"}, {"Lowest Capacity Asset", "ES VMKLFZIH2MTD"}, {"Portfolio Turnover", "2.33%"}, - {"OrderListHash", "9c524830ffc7354327638142ae62acd2"} + {"OrderListHash", "04670183a0a4c9160167415aa5102499"} }; } } diff --git a/Algorithm.CSharp/BasicTemplateContinuousFutureWithExtendedMarketAlgorithm.cs b/Algorithm.CSharp/BasicTemplateContinuousFutureWithExtendedMarketAlgorithm.cs index 19cf8cf73da5..9639094e32d0 100644 --- a/Algorithm.CSharp/BasicTemplateContinuousFutureWithExtendedMarketAlgorithm.cs +++ b/Algorithm.CSharp/BasicTemplateContinuousFutureWithExtendedMarketAlgorithm.cs @@ -123,7 +123,7 @@ public override void OnSecuritiesChanged(SecurityChanges changes) /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 2217330; + public long DataPoints => 504530; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/BasicTemplateEurexFuturesAlgorithm.cs b/Algorithm.CSharp/BasicTemplateEurexFuturesAlgorithm.cs index d37eaf564587..2825339e3580 100644 --- a/Algorithm.CSharp/BasicTemplateEurexFuturesAlgorithm.cs +++ b/Algorithm.CSharp/BasicTemplateEurexFuturesAlgorithm.cs @@ -190,12 +190,12 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 133947; + public long DataPoints => 94326; /// /// Data Points count of the algorithm history /// - public int AlgorithmHistoryDataPoints => 26; + public int AlgorithmHistoryDataPoints => 0; /// /// Final status of the algorithm @@ -233,7 +233,7 @@ public override void OnEndOfAlgorithm() {"Estimated Strategy Capacity", "€2300000000.00"}, {"Lowest Capacity Asset", "FESX YJHOAMPYKRS5"}, {"Portfolio Turnover", "0.40%"}, - {"OrderListHash", "54040d29a467becaedcf59d79323321b"} + {"OrderListHash", "ac9acc478ba1afe53993cdbb92f8ec6e"} }; } } diff --git a/Algorithm.CSharp/BasicTemplateFutureRolloverAlgorithm.cs b/Algorithm.CSharp/BasicTemplateFutureRolloverAlgorithm.cs index 91ab6d4c6a30..423af8932f3f 100644 --- a/Algorithm.CSharp/BasicTemplateFutureRolloverAlgorithm.cs +++ b/Algorithm.CSharp/BasicTemplateFutureRolloverAlgorithm.cs @@ -176,7 +176,7 @@ public void Dispose() /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 1185; + public long DataPoints => 727; /// /// Data Points count of the algorithm history @@ -221,5 +221,5 @@ public void Dispose() {"Portfolio Turnover", "0.13%"}, {"OrderListHash", "7c8700a9baa24f6f76d866e7d88cc19c"} }; - } + } } diff --git a/Algorithm.CSharp/BasicTemplateFuturesAlgorithm.cs b/Algorithm.CSharp/BasicTemplateFuturesAlgorithm.cs index b70377bcbcb3..aa1bbf9293ab 100644 --- a/Algorithm.CSharp/BasicTemplateFuturesAlgorithm.cs +++ b/Algorithm.CSharp/BasicTemplateFuturesAlgorithm.cs @@ -149,7 +149,7 @@ public override void OnSecuritiesChanged(SecurityChanges changes) /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 75403; + public long DataPoints => 40308; /// /// Data Points count of the algorithm history @@ -169,7 +169,7 @@ public override void OnSecuritiesChanged(SecurityChanges changes) {"Total Orders", "2700"}, {"Average Win", "0.00%"}, {"Average Loss", "0.00%"}, - {"Compounding Annual Return", "-99.777%"}, + {"Compounding Annual Return", "-99.597%"}, {"Drawdown", "4.400%"}, {"Expectancy", "-0.724"}, {"Start Equity", "1000000"}, diff --git a/Algorithm.CSharp/BasicTemplateFuturesDailyAlgorithm.cs b/Algorithm.CSharp/BasicTemplateFuturesDailyAlgorithm.cs index f6854d47c2ec..86f014a1d569 100644 --- a/Algorithm.CSharp/BasicTemplateFuturesDailyAlgorithm.cs +++ b/Algorithm.CSharp/BasicTemplateFuturesDailyAlgorithm.cs @@ -18,8 +18,8 @@ using System.Collections.Generic; using System.Linq; using QuantConnect.Data; +using QuantConnect.Data.UniverseSelection; using QuantConnect.Interfaces; -using QuantConnect.Orders; using QuantConnect.Securities; using QuantConnect.Securities.Future; @@ -104,6 +104,16 @@ select futuresContract } } + public override void OnSecuritiesChanged(SecurityChanges changes) + { + if (changes.RemovedSecurities.Count > 0 && + Portfolio.Invested && + Securities.Values.Where(x => x.Invested).All(x => x.Exchange.Hours.IsOpen(Time, true))) + { + Liquidate(); + } + } + /// /// This is used by the regression test system to indicate if the open source Lean repository has the required data to run this algorithm. /// @@ -117,7 +127,7 @@ select futuresContract /// /// Data Points count of all timeslices of algorithm /// - public virtual long DataPoints => 12474; + public virtual long DataPoints => 5861; /// /// Data Points count of the algorithm history @@ -160,7 +170,7 @@ select futuresContract {"Estimated Strategy Capacity", "$0"}, {"Lowest Capacity Asset", "ES VRJST036ZY0X"}, {"Portfolio Turnover", "0.92%"}, - {"OrderListHash", "9507abc8348ff3cb1e2a9a5f48d128a7"} + {"OrderListHash", "c0713abdc4fb059c2be797fce36e4f36"} }; } } diff --git a/Algorithm.CSharp/BasicTemplateFuturesFrameworkAlgorithm.cs b/Algorithm.CSharp/BasicTemplateFuturesFrameworkAlgorithm.cs index 61c8876edcc9..610edbd98b38 100644 --- a/Algorithm.CSharp/BasicTemplateFuturesFrameworkAlgorithm.cs +++ b/Algorithm.CSharp/BasicTemplateFuturesFrameworkAlgorithm.cs @@ -136,7 +136,7 @@ public override IEnumerable CreateTargets(QCAlgorithm algorith /// /// Data Points count of all timeslices of algorithm /// - public virtual long DataPoints => 57759; + public virtual long DataPoints => 24883; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/BasicTemplateFuturesFrameworkWithExtendedMarketAlgorithm.cs b/Algorithm.CSharp/BasicTemplateFuturesFrameworkWithExtendedMarketAlgorithm.cs index 560934813d2f..87eb8c1f2e73 100644 --- a/Algorithm.CSharp/BasicTemplateFuturesFrameworkWithExtendedMarketAlgorithm.cs +++ b/Algorithm.CSharp/BasicTemplateFuturesFrameworkWithExtendedMarketAlgorithm.cs @@ -41,7 +41,7 @@ public class BasicTemplateFuturesFrameworkWithExtendedMarketAlgorithm : BasicTem /// /// Data Points count of all timeslices of algorithm /// - public override long DataPoints => 163416; + public override long DataPoints => 70262; /// /// This is used by the regression test system to indicate what the expected statistics are from running the algorithm diff --git a/Algorithm.CSharp/BasicTemplateFuturesHistoryAlgorithm.cs b/Algorithm.CSharp/BasicTemplateFuturesHistoryAlgorithm.cs index 8e10592d086c..b8a8ac57ff11 100644 --- a/Algorithm.CSharp/BasicTemplateFuturesHistoryAlgorithm.cs +++ b/Algorithm.CSharp/BasicTemplateFuturesHistoryAlgorithm.cs @@ -140,12 +140,12 @@ public override void OnOrderEvent(OrderEvent orderEvent) /// /// Data Points count of all timeslices of algorithm /// - public virtual long DataPoints => 48690; + public virtual long DataPoints => 25316; /// /// Data Points count of the algorithm history /// - public virtual int AlgorithmHistoryDataPoints => 5305; + public virtual int AlgorithmHistoryDataPoints => 6075; /// /// Final status of the algorithm diff --git a/Algorithm.CSharp/BasicTemplateFuturesHistoryWithExtendedMarketHoursAlgorithm.cs b/Algorithm.CSharp/BasicTemplateFuturesHistoryWithExtendedMarketHoursAlgorithm.cs index 548ceee07346..e037fae0555c 100644 --- a/Algorithm.CSharp/BasicTemplateFuturesHistoryWithExtendedMarketHoursAlgorithm.cs +++ b/Algorithm.CSharp/BasicTemplateFuturesHistoryWithExtendedMarketHoursAlgorithm.cs @@ -47,7 +47,7 @@ public class BasicTemplateFuturesHistoryWithExtendedMarketHoursAlgorithm : Basic /// /// Data Points count of all timeslices of algorithm /// - public override long DataPoints => 147771; + public override long DataPoints => 76063; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/BasicTemplateFuturesHourlyAlgorithm.cs b/Algorithm.CSharp/BasicTemplateFuturesHourlyAlgorithm.cs index 24894f583eba..921760b9872c 100644 --- a/Algorithm.CSharp/BasicTemplateFuturesHourlyAlgorithm.cs +++ b/Algorithm.CSharp/BasicTemplateFuturesHourlyAlgorithm.cs @@ -14,12 +14,7 @@ * */ -using System; using System.Collections.Generic; -using System.Linq; -using QuantConnect.Data; -using QuantConnect.Interfaces; -using QuantConnect.Securities; namespace QuantConnect.Algorithm.CSharp { @@ -41,40 +36,40 @@ public class BasicTemplateFuturesHourlyAlgorithm : BasicTemplateFuturesDailyAlgo /// /// Data Points count of all timeslices of algorithm /// - public override long DataPoints => 87292; + public override long DataPoints => 25312; /// /// This is used by the regression test system to indicate what the expected statistics are from running the algorithm /// public override Dictionary ExpectedStatistics => new Dictionary { - {"Total Orders", "716"}, + {"Total Orders", "718"}, {"Average Win", "0.03%"}, {"Average Loss", "-0.01%"}, - {"Compounding Annual Return", "-1.716%"}, + {"Compounding Annual Return", "-1.720%"}, {"Drawdown", "1.700%"}, {"Expectancy", "-0.770"}, {"Start Equity", "1000000"}, - {"End Equity", "982718.38"}, - {"Net Profit", "-1.728%"}, - {"Sharpe Ratio", "-8.845"}, - {"Sortino Ratio", "-5.449"}, + {"End Equity", "982676.58"}, + {"Net Profit", "-1.732%"}, + {"Sharpe Ratio", "-8.877"}, + {"Sortino Ratio", "-5.476"}, {"Probabilistic Sharpe Ratio", "0.000%"}, {"Loss Rate", "96%"}, {"Win Rate", "4%"}, - {"Profit-Loss Ratio", "4.89"}, + {"Profit-Loss Ratio", "4.90"}, {"Alpha", "-0.018"}, {"Beta", "-0.002"}, {"Annual Standard Deviation", "0.002"}, {"Annual Variance", "0"}, - {"Information Ratio", "-1.483"}, + {"Information Ratio", "-1.484"}, {"Tracking Error", "0.089"}, - {"Treynor Ratio", "9.102"}, - {"Total Fees", "$1634.12"}, + {"Treynor Ratio", "9.171"}, + {"Total Fees", "$1638.42"}, {"Estimated Strategy Capacity", "$8000.00"}, {"Lowest Capacity Asset", "ES VP274HSU1AF5"}, - {"Portfolio Turnover", "20.10%"}, - {"OrderListHash", "aa7e574f86b70428ca0afae381be80ba"} + {"Portfolio Turnover", "20.14%"}, + {"OrderListHash", "dedcc487d64e2f601990fc70393c89ed"} }; } } diff --git a/Algorithm.CSharp/BasicTemplateFuturesWithExtendedMarketAlgorithm.cs b/Algorithm.CSharp/BasicTemplateFuturesWithExtendedMarketAlgorithm.cs index d998030c316d..18c0d3b5d345 100644 --- a/Algorithm.CSharp/BasicTemplateFuturesWithExtendedMarketAlgorithm.cs +++ b/Algorithm.CSharp/BasicTemplateFuturesWithExtendedMarketAlgorithm.cs @@ -149,7 +149,7 @@ public override void OnSecuritiesChanged(SecurityChanges changes) /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 224662; + public long DataPoints => 117079; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/BasicTemplateFuturesWithExtendedMarketDailyAlgorithm.cs b/Algorithm.CSharp/BasicTemplateFuturesWithExtendedMarketDailyAlgorithm.cs index 15f4e02c9b1c..7283dd6e9d1a 100644 --- a/Algorithm.CSharp/BasicTemplateFuturesWithExtendedMarketDailyAlgorithm.cs +++ b/Algorithm.CSharp/BasicTemplateFuturesWithExtendedMarketDailyAlgorithm.cs @@ -36,7 +36,7 @@ public class BasicTemplateFuturesWithExtendedMarketDailyAlgorithm : BasicTemplat /// /// Data Points count of all timeslices of algorithm /// - public override long DataPoints => 14182; + public override long DataPoints => 5965; /// /// This is used by the regression test system to indicate what the expected statistics are from running the algorithm @@ -69,7 +69,7 @@ public class BasicTemplateFuturesWithExtendedMarketDailyAlgorithm : BasicTemplat {"Estimated Strategy Capacity", "$0"}, {"Lowest Capacity Asset", "ES VRJST036ZY0X"}, {"Portfolio Turnover", "0.87%"}, - {"OrderListHash", "ea6fdf3133bde7063e4fc0fa809ae260"} + {"OrderListHash", "8b8b733248a21fc717079be54b2e844c"} }; } } diff --git a/Algorithm.CSharp/BasicTemplateFuturesWithExtendedMarketHourlyAlgorithm.cs b/Algorithm.CSharp/BasicTemplateFuturesWithExtendedMarketHourlyAlgorithm.cs index 85a9aa32b4f7..d6f61ee1cede 100644 --- a/Algorithm.CSharp/BasicTemplateFuturesWithExtendedMarketHourlyAlgorithm.cs +++ b/Algorithm.CSharp/BasicTemplateFuturesWithExtendedMarketHourlyAlgorithm.cs @@ -41,7 +41,7 @@ public class BasicTemplateFuturesWithExtendedMarketHourlyAlgorithm : BasicTempla /// /// Data Points count of all timeslices of algorithm /// - public override long DataPoints => 228941; + public override long DataPoints => 67924; /// /// This is used by the regression test system to indicate what the expected statistics are from running the algorithm diff --git a/Algorithm.CSharp/ConsolidateRegressionAlgorithm.cs b/Algorithm.CSharp/ConsolidateRegressionAlgorithm.cs index 7346898866a5..24b20c03d5e9 100644 --- a/Algorithm.CSharp/ConsolidateRegressionAlgorithm.cs +++ b/Algorithm.CSharp/ConsolidateRegressionAlgorithm.cs @@ -47,7 +47,7 @@ public override void Initialize() SetEndDate(2020, 01, 20); var SP500 = QuantConnect.Symbol.Create(Futures.Indices.SP500EMini, SecurityType.Future, Market.CME); - var symbol = FutureChainProvider.GetFutureContractList(SP500, StartDate).First(); + var symbol = FuturesChain(SP500).First(); _future = AddFutureContract(symbol); var tradableDatesCount = QuantConnect.Time.EachTradeableDayInTimeZone(_future.Exchange.Hours, @@ -194,7 +194,7 @@ public override void OnData(Slice slice) /// /// Data Points count of the algorithm history /// - public int AlgorithmHistoryDataPoints => 0; + public int AlgorithmHistoryDataPoints => 1; /// /// Final status of the algorithm diff --git a/Algorithm.CSharp/ContinuousBackMonthRawFutureRegressionAlgorithm.cs b/Algorithm.CSharp/ContinuousBackMonthRawFutureRegressionAlgorithm.cs index 92a547a7563f..433b725a4835 100644 --- a/Algorithm.CSharp/ContinuousBackMonthRawFutureRegressionAlgorithm.cs +++ b/Algorithm.CSharp/ContinuousBackMonthRawFutureRegressionAlgorithm.cs @@ -139,7 +139,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 713371; + public long DataPoints => 162571; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/ContinuousFutureBackMonthRegressionAlgorithm.cs b/Algorithm.CSharp/ContinuousFutureBackMonthRegressionAlgorithm.cs index 77f6d858b5d1..8fbbdb0295de 100644 --- a/Algorithm.CSharp/ContinuousFutureBackMonthRegressionAlgorithm.cs +++ b/Algorithm.CSharp/ContinuousFutureBackMonthRegressionAlgorithm.cs @@ -155,7 +155,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 723498; + public long DataPoints => 172698; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/ContinuousFutureHistoryRegressionAlgorithm.cs b/Algorithm.CSharp/ContinuousFutureHistoryRegressionAlgorithm.cs index d81b2ed79f57..31bb208ee8cc 100644 --- a/Algorithm.CSharp/ContinuousFutureHistoryRegressionAlgorithm.cs +++ b/Algorithm.CSharp/ContinuousFutureHistoryRegressionAlgorithm.cs @@ -120,7 +120,7 @@ public override void OnSecuritiesChanged(SecurityChanges changes) /// /// Data Points count of all timeslices of algorithm /// - public virtual long DataPoints => 9953; + public virtual long DataPoints => 5469; /// /// Data Points count of the algorithm history @@ -160,7 +160,7 @@ public override void OnSecuritiesChanged(SecurityChanges changes) {"Tracking Error", "0"}, {"Treynor Ratio", "0"}, {"Total Fees", "$2.15"}, - {"Estimated Strategy Capacity", "$100000000.00"}, + {"Estimated Strategy Capacity", "$130000000.00"}, {"Lowest Capacity Asset", "ES VP274HSU1AF5"}, {"Portfolio Turnover", "41.23%"}, {"OrderListHash", "b9f8e1a0704c086944e5df07e0ab04d6"} diff --git a/Algorithm.CSharp/ContinuousFutureHistoryTimeSpanWarmupRegressionAlgorithm.cs b/Algorithm.CSharp/ContinuousFutureHistoryTimeSpanWarmupRegressionAlgorithm.cs index 12271e5c38af..e6f8e47577d1 100644 --- a/Algorithm.CSharp/ContinuousFutureHistoryTimeSpanWarmupRegressionAlgorithm.cs +++ b/Algorithm.CSharp/ContinuousFutureHistoryTimeSpanWarmupRegressionAlgorithm.cs @@ -34,6 +34,6 @@ public override void Initialize() /// /// Data Points count of all timeslices of algorithm /// - public override long DataPoints => 15813; + public override long DataPoints => 9079; } } diff --git a/Algorithm.CSharp/ContinuousFutureImmediateUniverseSelectionRegressionAlgorithm.cs b/Algorithm.CSharp/ContinuousFutureImmediateUniverseSelectionRegressionAlgorithm.cs index ebf044b4fff6..b406cc41dd58 100644 --- a/Algorithm.CSharp/ContinuousFutureImmediateUniverseSelectionRegressionAlgorithm.cs +++ b/Algorithm.CSharp/ContinuousFutureImmediateUniverseSelectionRegressionAlgorithm.cs @@ -78,7 +78,7 @@ public override void Initialize() } - return universe.Select(x => x); + return universe; }); _milk.SetFilter(universe => @@ -94,7 +94,7 @@ public override void Initialize() } } - return universe.Select(x => x); + return universe; }); } @@ -184,7 +184,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 596358; + public long DataPoints => 445961; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/ContinuousFutureLimitIfTouchedOrderRegressionAlgorithm.cs b/Algorithm.CSharp/ContinuousFutureLimitIfTouchedOrderRegressionAlgorithm.cs index f883aa001273..e0967fb6b06b 100644 --- a/Algorithm.CSharp/ContinuousFutureLimitIfTouchedOrderRegressionAlgorithm.cs +++ b/Algorithm.CSharp/ContinuousFutureLimitIfTouchedOrderRegressionAlgorithm.cs @@ -78,7 +78,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 19888; + public long DataPoints => 10883; /// /// Data Points count of the algorithm history @@ -98,7 +98,7 @@ public override void OnEndOfAlgorithm() {"Total Orders", "1"}, {"Average Win", "0%"}, {"Average Loss", "0%"}, - {"Compounding Annual Return", "-99.258%"}, + {"Compounding Annual Return", "-99.012%"}, {"Drawdown", "6.300%"}, {"Expectancy", "0"}, {"Start Equity", "100000"}, diff --git a/Algorithm.CSharp/ContinuousFutureOpenPositionsLiquidationOnDelistingRegressionAlgorithm.cs b/Algorithm.CSharp/ContinuousFutureOpenPositionsLiquidationOnDelistingRegressionAlgorithm.cs index 4993a78a2560..85101415fff3 100644 --- a/Algorithm.CSharp/ContinuousFutureOpenPositionsLiquidationOnDelistingRegressionAlgorithm.cs +++ b/Algorithm.CSharp/ContinuousFutureOpenPositionsLiquidationOnDelistingRegressionAlgorithm.cs @@ -188,7 +188,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of all timeslices of algorithm /// - public virtual long DataPoints => 396945; + public virtual long DataPoints => 159274; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/ContinuousFutureRegressionAlgorithm.cs b/Algorithm.CSharp/ContinuousFutureRegressionAlgorithm.cs index 303de0449f64..7da55bff4248 100644 --- a/Algorithm.CSharp/ContinuousFutureRegressionAlgorithm.cs +++ b/Algorithm.CSharp/ContinuousFutureRegressionAlgorithm.cs @@ -173,7 +173,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 713375; + public long DataPoints => 162575; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/ContinuousFutureRolloverDailyExchangeTimeZoneAheadOfDataRegressionAlgorithm.cs b/Algorithm.CSharp/ContinuousFutureRolloverDailyExchangeTimeZoneAheadOfDataRegressionAlgorithm.cs index 58321d23ec02..c96e620c275a 100644 --- a/Algorithm.CSharp/ContinuousFutureRolloverDailyExchangeTimeZoneAheadOfDataRegressionAlgorithm.cs +++ b/Algorithm.CSharp/ContinuousFutureRolloverDailyExchangeTimeZoneAheadOfDataRegressionAlgorithm.cs @@ -33,6 +33,6 @@ public class ContinuousFutureRolloverDailyExchangeTimeZoneAheadOfDataRegressionA /// /// Data Points count of all timeslices of algorithm /// - public override long DataPoints => 1014; + public override long DataPoints => 483; } } diff --git a/Algorithm.CSharp/ContinuousFutureRolloverDailyExchangeTimeZoneBehindOfDataRegressionAlgorithm.cs b/Algorithm.CSharp/ContinuousFutureRolloverDailyExchangeTimeZoneBehindOfDataRegressionAlgorithm.cs index 7733904b2907..4cc8c2d8f74c 100644 --- a/Algorithm.CSharp/ContinuousFutureRolloverDailyExchangeTimeZoneBehindOfDataRegressionAlgorithm.cs +++ b/Algorithm.CSharp/ContinuousFutureRolloverDailyExchangeTimeZoneBehindOfDataRegressionAlgorithm.cs @@ -33,6 +33,6 @@ public class ContinuousFutureRolloverDailyExchangeTimeZoneBehindOfDataRegression /// /// Data Points count of all timeslices of algorithm /// - public override long DataPoints => 1004; + public override long DataPoints => 479; } } diff --git a/Algorithm.CSharp/ContinuousFutureRolloverDailyExchangeTimeZoneSameAsDataRegressionAlgorithm.cs b/Algorithm.CSharp/ContinuousFutureRolloverDailyExchangeTimeZoneSameAsDataRegressionAlgorithm.cs index df67ff88901d..59b1b92f7b3a 100644 --- a/Algorithm.CSharp/ContinuousFutureRolloverDailyExchangeTimeZoneSameAsDataRegressionAlgorithm.cs +++ b/Algorithm.CSharp/ContinuousFutureRolloverDailyExchangeTimeZoneSameAsDataRegressionAlgorithm.cs @@ -33,6 +33,6 @@ public class ContinuousFutureRolloverDailyExchangeTimeZoneSameAsDataRegressionAl /// /// Data Points count of all timeslices of algorithm /// - public override long DataPoints => 1007; + public override long DataPoints => 483; } } diff --git a/Algorithm.CSharp/ContinuousFutureRolloverHourExchangeTimeZoneAheadOfDataRegressionAlgorithm.cs b/Algorithm.CSharp/ContinuousFutureRolloverHourExchangeTimeZoneAheadOfDataRegressionAlgorithm.cs index ae991fda65d9..27da7b0c0bc1 100644 --- a/Algorithm.CSharp/ContinuousFutureRolloverHourExchangeTimeZoneAheadOfDataRegressionAlgorithm.cs +++ b/Algorithm.CSharp/ContinuousFutureRolloverHourExchangeTimeZoneAheadOfDataRegressionAlgorithm.cs @@ -33,6 +33,6 @@ public class ContinuousFutureRolloverHourExchangeTimeZoneAheadOfDataRegressionAl /// /// Data Points count of all timeslices of algorithm /// - public override long DataPoints => 18850; + public override long DataPoints => 7424; } } diff --git a/Algorithm.CSharp/ContinuousFutureRolloverHourExchangeTimeZoneBehindOfDataRegressionAlgorithm.cs b/Algorithm.CSharp/ContinuousFutureRolloverHourExchangeTimeZoneBehindOfDataRegressionAlgorithm.cs index 4ca71fcd85d0..86e38897814c 100644 --- a/Algorithm.CSharp/ContinuousFutureRolloverHourExchangeTimeZoneBehindOfDataRegressionAlgorithm.cs +++ b/Algorithm.CSharp/ContinuousFutureRolloverHourExchangeTimeZoneBehindOfDataRegressionAlgorithm.cs @@ -33,6 +33,6 @@ public class ContinuousFutureRolloverHourExchangeTimeZoneBehindOfDataRegressionA /// /// Data Points count of all timeslices of algorithm /// - public override long DataPoints => 18844; + public override long DataPoints => 7440; } } diff --git a/Algorithm.CSharp/ContinuousFutureRolloverHourExchangeTimeZoneSameAsDataRegressionAlgorithm.cs b/Algorithm.CSharp/ContinuousFutureRolloverHourExchangeTimeZoneSameAsDataRegressionAlgorithm.cs index 57d85882b0f4..43d2b0b639f1 100644 --- a/Algorithm.CSharp/ContinuousFutureRolloverHourExchangeTimeZoneSameAsDataRegressionAlgorithm.cs +++ b/Algorithm.CSharp/ContinuousFutureRolloverHourExchangeTimeZoneSameAsDataRegressionAlgorithm.cs @@ -33,6 +33,6 @@ public class ContinuousFutureRolloverHourExchangeTimeZoneSameAsDataRegressionAlg /// /// Data Points count of all timeslices of algorithm /// - public override long DataPoints => 18846; + public override long DataPoints => 7434; } } diff --git a/Algorithm.CSharp/ContinuousFutureRolloverMinuteExchangeTimeZoneAheadOfDataRegressionAlgorithm.cs b/Algorithm.CSharp/ContinuousFutureRolloverMinuteExchangeTimeZoneAheadOfDataRegressionAlgorithm.cs index 3e77be5e229d..b6d5251e69b7 100644 --- a/Algorithm.CSharp/ContinuousFutureRolloverMinuteExchangeTimeZoneAheadOfDataRegressionAlgorithm.cs +++ b/Algorithm.CSharp/ContinuousFutureRolloverMinuteExchangeTimeZoneAheadOfDataRegressionAlgorithm.cs @@ -33,6 +33,6 @@ public class ContinuousFutureRolloverMinuteExchangeTimeZoneAheadOfDataRegression /// /// Data Points count of all timeslices of algorithm /// - public override long DataPoints => 1127376; + public override long DataPoints => 444159; } } diff --git a/Algorithm.CSharp/ContinuousFutureRolloverMinuteExchangeTimeZoneBehindOfDataRegressionAlgorithm.cs b/Algorithm.CSharp/ContinuousFutureRolloverMinuteExchangeTimeZoneBehindOfDataRegressionAlgorithm.cs index 93b3130d8734..29c98aa9de78 100644 --- a/Algorithm.CSharp/ContinuousFutureRolloverMinuteExchangeTimeZoneBehindOfDataRegressionAlgorithm.cs +++ b/Algorithm.CSharp/ContinuousFutureRolloverMinuteExchangeTimeZoneBehindOfDataRegressionAlgorithm.cs @@ -33,6 +33,6 @@ public class ContinuousFutureRolloverMinuteExchangeTimeZoneBehindOfDataRegressio /// /// Data Points count of all timeslices of algorithm /// - public override long DataPoints => 1127374; + public override long DataPoints => 445123; } } diff --git a/Algorithm.CSharp/ContinuousFutureRolloverMinuteExchangeTimeZoneSameAsDataRegressionAlgorithm.cs b/Algorithm.CSharp/ContinuousFutureRolloverMinuteExchangeTimeZoneSameAsDataRegressionAlgorithm.cs index be11903cfd31..08be913f557e 100644 --- a/Algorithm.CSharp/ContinuousFutureRolloverMinuteExchangeTimeZoneSameAsDataRegressionAlgorithm.cs +++ b/Algorithm.CSharp/ContinuousFutureRolloverMinuteExchangeTimeZoneSameAsDataRegressionAlgorithm.cs @@ -33,6 +33,6 @@ public class ContinuousFutureRolloverMinuteExchangeTimeZoneSameAsDataRegressionA /// /// Data Points count of all timeslices of algorithm /// - public override long DataPoints => 1127488; + public override long DataPoints => 444757; } } diff --git a/Algorithm.CSharp/ContinuousFuturesDailyRegressionAlgorithm.cs b/Algorithm.CSharp/ContinuousFuturesDailyRegressionAlgorithm.cs index 8673a19efa9d..8d066eb3d2b6 100644 --- a/Algorithm.CSharp/ContinuousFuturesDailyRegressionAlgorithm.cs +++ b/Algorithm.CSharp/ContinuousFuturesDailyRegressionAlgorithm.cs @@ -109,7 +109,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 1276; + public long DataPoints => 848; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/DefaultFutureChainRegressionAlgorithm.cs b/Algorithm.CSharp/DefaultFutureChainRegressionAlgorithm.cs index d16eafb845b4..5f0a754a7138 100644 --- a/Algorithm.CSharp/DefaultFutureChainRegressionAlgorithm.cs +++ b/Algorithm.CSharp/DefaultFutureChainRegressionAlgorithm.cs @@ -62,7 +62,7 @@ public override void OnSecuritiesChanged(SecurityChanges changes) /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 516622; + public long DataPoints => 70735; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/DelistedFutureLiquidateDailyRegressionAlgorithm.cs b/Algorithm.CSharp/DelistedFutureLiquidateDailyRegressionAlgorithm.cs index 1283343cdee6..a2c3d956003b 100644 --- a/Algorithm.CSharp/DelistedFutureLiquidateDailyRegressionAlgorithm.cs +++ b/Algorithm.CSharp/DelistedFutureLiquidateDailyRegressionAlgorithm.cs @@ -28,7 +28,7 @@ public class DelistedFutureLiquidateDailyRegressionAlgorithm : DelistedFutureLiq /// /// Data Points count of all timeslices of algorithm /// - public override long DataPoints => 1690; + public override long DataPoints => 1235; /// /// This is used by the regression test system to indicate what the expected statistics are from running the algorithm @@ -44,24 +44,24 @@ public class DelistedFutureLiquidateDailyRegressionAlgorithm : DelistedFutureLiq {"Start Equity", "100000"}, {"End Equity", "107779.1"}, {"Net Profit", "7.779%"}, - {"Sharpe Ratio", "3.132"}, + {"Sharpe Ratio", "3.128"}, {"Sortino Ratio", "0"}, - {"Probabilistic Sharpe Ratio", "99.474%"}, + {"Probabilistic Sharpe Ratio", "99.450%"}, {"Loss Rate", "0%"}, {"Win Rate", "100%"}, {"Profit-Loss Ratio", "0"}, {"Alpha", "0.145"}, {"Beta", "0.271"}, {"Annual Standard Deviation", "0.081"}, - {"Annual Variance", "0.006"}, + {"Annual Variance", "0.007"}, {"Information Ratio", "-1.459"}, {"Tracking Error", "0.099"}, - {"Treynor Ratio", "0.932"}, + {"Treynor Ratio", "0.931"}, {"Total Fees", "$2.15"}, {"Estimated Strategy Capacity", "$150000000000.00"}, {"Lowest Capacity Asset", "ES VMKLFZIH2MTD"}, {"Portfolio Turnover", "1.98%"}, - {"OrderListHash", "b337ac27f46a6298dd4e9f0f04b49427"} + {"OrderListHash", "6365adfc234509e390295a150f25c295"} }; } } diff --git a/Algorithm.CSharp/DelistedFutureLiquidateRegressionAlgorithm.cs b/Algorithm.CSharp/DelistedFutureLiquidateRegressionAlgorithm.cs index beb4fa356103..51bc2438a569 100644 --- a/Algorithm.CSharp/DelistedFutureLiquidateRegressionAlgorithm.cs +++ b/Algorithm.CSharp/DelistedFutureLiquidateRegressionAlgorithm.cs @@ -92,7 +92,7 @@ public override void OnOrderEvent(OrderEvent orderEvent) /// /// Data Points count of all timeslices of algorithm /// - public virtual long DataPoints => 525811; + public virtual long DataPoints => 288140; /// /// Data Points count of the algorithm history @@ -124,18 +124,18 @@ public override void OnOrderEvent(OrderEvent orderEvent) {"Loss Rate", "0%"}, {"Win Rate", "100%"}, {"Profit-Loss Ratio", "0"}, - {"Alpha", "0.228"}, - {"Beta", "0.108"}, + {"Alpha", "0.227"}, + {"Beta", "0.109"}, {"Annual Standard Deviation", "0.084"}, {"Annual Variance", "0.007"}, {"Information Ratio", "-1.122"}, {"Tracking Error", "0.112"}, - {"Treynor Ratio", "2.501"}, + {"Treynor Ratio", "2.49"}, {"Total Fees", "$2.15"}, {"Estimated Strategy Capacity", "$1700000000.00"}, {"Lowest Capacity Asset", "ES VMKLFZIH2MTD"}, {"Portfolio Turnover", "2.01%"}, - {"OrderListHash", "640ce720644ff0b580687e80105d0a92"} + {"OrderListHash", "de82efe4f019a5fa1fb79d111bf15811"} }; } } diff --git a/Algorithm.CSharp/DelistingFutureOptionDailyRegressionAlgorithm.cs b/Algorithm.CSharp/DelistingFutureOptionDailyRegressionAlgorithm.cs index 6e29750eff04..6afb56e2cf7b 100644 --- a/Algorithm.CSharp/DelistingFutureOptionDailyRegressionAlgorithm.cs +++ b/Algorithm.CSharp/DelistingFutureOptionDailyRegressionAlgorithm.cs @@ -14,7 +14,6 @@ */ using System.Collections.Generic; -using QuantConnect.Orders; namespace QuantConnect.Algorithm.CSharp { @@ -29,7 +28,7 @@ public class DelistingFutureOptionDailyRegressionAlgorithm : DelistingFutureOpti /// /// Data Points count of all timeslices of algorithm /// - public override long DataPoints => 12251; + public override long DataPoints => 3918; /// /// This is used by the regression test system to indicate what the expected statistics are from running the algorithm diff --git a/Algorithm.CSharp/DelistingFutureOptionRegressionAlgorithm.cs b/Algorithm.CSharp/DelistingFutureOptionRegressionAlgorithm.cs index 29b0f9c724e3..76507463846c 100644 --- a/Algorithm.CSharp/DelistingFutureOptionRegressionAlgorithm.cs +++ b/Algorithm.CSharp/DelistingFutureOptionRegressionAlgorithm.cs @@ -13,13 +13,11 @@ * limitations under the License. */ -using System; using QuantConnect.Data; using QuantConnect.Interfaces; using QuantConnect.Securities; using System.Collections.Generic; using System.Linq; -using QuantConnect.Orders; namespace QuantConnect.Algorithm.CSharp { @@ -107,7 +105,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of all timeslices of algorithm /// - public virtual long DataPoints => 4632655; + public virtual long DataPoints => 761073; /// /// Data Points count of the algorithm history @@ -131,10 +129,10 @@ public override void OnEndOfAlgorithm() {"Drawdown", "0.100%"}, {"Expectancy", "-0.678"}, {"Start Equity", "10000000"}, - {"End Equity", "9988860.24"}, + {"End Equity", "9988880.24"}, {"Net Profit", "-0.111%"}, - {"Sharpe Ratio", "-10.413"}, - {"Sortino Ratio", "-0.961"}, + {"Sharpe Ratio", "-10.416"}, + {"Sortino Ratio", "-0.959"}, {"Probabilistic Sharpe Ratio", "0.000%"}, {"Loss Rate", "80%"}, {"Win Rate", "20%"}, @@ -145,12 +143,12 @@ public override void OnEndOfAlgorithm() {"Annual Variance", "0"}, {"Information Ratio", "-1.076"}, {"Tracking Error", "0.107"}, - {"Treynor Ratio", "14.588"}, + {"Treynor Ratio", "14.634"}, {"Total Fees", "$19.76"}, - {"Estimated Strategy Capacity", "$1300000000.00"}, + {"Estimated Strategy Capacity", "$1400000000.00"}, {"Lowest Capacity Asset", "DC V5E8PHPRCHJ8|DC V5E8P9SH0U0X"}, {"Portfolio Turnover", "0.00%"}, - {"OrderListHash", "7f06f736e2f1294916fb2485519021a2"} + {"OrderListHash", "67b64c13cbc4aad88111503cf7b789bc"} }; } } diff --git a/Algorithm.CSharp/EqualWeightingPortfolioConstructionModelFutureRegressionAlgorithm.cs b/Algorithm.CSharp/EqualWeightingPortfolioConstructionModelFutureRegressionAlgorithm.cs index 6b588705595b..ab8fa84862cf 100644 --- a/Algorithm.CSharp/EqualWeightingPortfolioConstructionModelFutureRegressionAlgorithm.cs +++ b/Algorithm.CSharp/EqualWeightingPortfolioConstructionModelFutureRegressionAlgorithm.cs @@ -130,7 +130,7 @@ public override void OnOrderEvent(OrderEvent orderEvent) /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 94731; + public long DataPoints => 36213; /// /// Data Points count of the algorithm history @@ -150,7 +150,7 @@ public override void OnOrderEvent(OrderEvent orderEvent) {"Total Orders", "8"}, {"Average Win", "0.69%"}, {"Average Loss", "-2.47%"}, - {"Compounding Annual Return", "-99.966%"}, + {"Compounding Annual Return", "-99.946%"}, {"Drawdown", "28.600%"}, {"Expectancy", "-0.680"}, {"Start Equity", "100000"}, diff --git a/Algorithm.CSharp/FillForwardResolutionAdjustedOnRemovalRegressionAlgorithm.cs b/Algorithm.CSharp/FillForwardResolutionAdjustedOnRemovalRegressionAlgorithm.cs index 4fb267ed973f..d1f5329f4305 100644 --- a/Algorithm.CSharp/FillForwardResolutionAdjustedOnRemovalRegressionAlgorithm.cs +++ b/Algorithm.CSharp/FillForwardResolutionAdjustedOnRemovalRegressionAlgorithm.cs @@ -91,7 +91,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 872; + public long DataPoints => 852; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/FutureChainInternalSubscriptionsRegressionAlgorithm.cs b/Algorithm.CSharp/FutureChainInternalSubscriptionsRegressionAlgorithm.cs index d2cc240953cf..05331ec153fd 100644 --- a/Algorithm.CSharp/FutureChainInternalSubscriptionsRegressionAlgorithm.cs +++ b/Algorithm.CSharp/FutureChainInternalSubscriptionsRegressionAlgorithm.cs @@ -94,7 +94,7 @@ select futuresContract /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 54138; + public long DataPoints => 19043; /// /// Data Points count of the algorithm history @@ -114,7 +114,7 @@ select futuresContract {"Total Orders", "1"}, {"Average Win", "0%"}, {"Average Loss", "0%"}, - {"Compounding Annual Return", "-99.310%"}, + {"Compounding Annual Return", "-98.880%"}, {"Drawdown", "4.400%"}, {"Expectancy", "0"}, {"Start Equity", "100000"}, diff --git a/Algorithm.CSharp/FutureMarketOpenAndCloseRegressionAlgorithm.cs b/Algorithm.CSharp/FutureMarketOpenAndCloseRegressionAlgorithm.cs index a2d442d83a0e..bc2ebad33d70 100644 --- a/Algorithm.CSharp/FutureMarketOpenAndCloseRegressionAlgorithm.cs +++ b/Algorithm.CSharp/FutureMarketOpenAndCloseRegressionAlgorithm.cs @@ -100,7 +100,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of all timeslices of algorithm /// - public virtual long DataPoints => 13586; + public virtual long DataPoints => 91; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/FutureMarketOpenAndCloseWithExtendedMarketRegressionAlgorithm.cs b/Algorithm.CSharp/FutureMarketOpenAndCloseWithExtendedMarketRegressionAlgorithm.cs index 956b1bbb7ca4..aad1ab484a66 100644 --- a/Algorithm.CSharp/FutureMarketOpenAndCloseWithExtendedMarketRegressionAlgorithm.cs +++ b/Algorithm.CSharp/FutureMarketOpenAndCloseWithExtendedMarketRegressionAlgorithm.cs @@ -54,7 +54,7 @@ public class FutureMarketOpenAndCloseWithExtendedMarketRegressionAlgorithm : Fut /// /// Data Points count of all timeslices of algorithm /// - public override long DataPoints => 41467; + public override long DataPoints => 92; /// /// This is used by the regression test system to indicate what the expected statistics are from running the algorithm diff --git a/Algorithm.CSharp/FutureMarketOpenConsolidatorRegressionAlgorithm.cs b/Algorithm.CSharp/FutureMarketOpenConsolidatorRegressionAlgorithm.cs index 9cee896df9bb..db2e24882291 100644 --- a/Algorithm.CSharp/FutureMarketOpenConsolidatorRegressionAlgorithm.cs +++ b/Algorithm.CSharp/FutureMarketOpenConsolidatorRegressionAlgorithm.cs @@ -94,7 +94,7 @@ public void Assert(BaseData bar) /// /// Data Points count of all timeslices of algorithm /// - public virtual long DataPoints => 32073; + public virtual long DataPoints => 16313; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/FutureMarketOpenConsolidatorWithExtendedMarketRegressionAlgorithm.cs b/Algorithm.CSharp/FutureMarketOpenConsolidatorWithExtendedMarketRegressionAlgorithm.cs index fc1584788367..ab1d1d6283db 100644 --- a/Algorithm.CSharp/FutureMarketOpenConsolidatorWithExtendedMarketRegressionAlgorithm.cs +++ b/Algorithm.CSharp/FutureMarketOpenConsolidatorWithExtendedMarketRegressionAlgorithm.cs @@ -57,7 +57,7 @@ public class FutureMarketOpenConsolidatorWithExtendedMarketRegressionAlgorithm : /// /// Data Points count of all timeslices of algorithm /// - public override long DataPoints => 103818; + public override long DataPoints => 51933; /// /// This is used by the regression test system to indicate what the expected statistics are from running the algorithm diff --git a/Algorithm.CSharp/FutureNoTimeInUniverseRegressionAlgorithm.cs b/Algorithm.CSharp/FutureNoTimeInUniverseRegressionAlgorithm.cs index 7ac76a258511..58165f77a60b 100644 --- a/Algorithm.CSharp/FutureNoTimeInUniverseRegressionAlgorithm.cs +++ b/Algorithm.CSharp/FutureNoTimeInUniverseRegressionAlgorithm.cs @@ -90,7 +90,7 @@ public override void OnData(Slice slice) /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 18492; + public long DataPoints => 11768; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/FutureOptionBuySellCallIntradayRegressionAlgorithm.cs b/Algorithm.CSharp/FutureOptionBuySellCallIntradayRegressionAlgorithm.cs index 9c3724d89748..c99d91bcf929 100644 --- a/Algorithm.CSharp/FutureOptionBuySellCallIntradayRegressionAlgorithm.cs +++ b/Algorithm.CSharp/FutureOptionBuySellCallIntradayRegressionAlgorithm.cs @@ -117,7 +117,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of the algorithm history /// - public int AlgorithmHistoryDataPoints => 0; + public int AlgorithmHistoryDataPoints => 2; /// /// Final status of the algorithm diff --git a/Algorithm.CSharp/FutureOptionCallITMExpiryRegressionAlgorithm.cs b/Algorithm.CSharp/FutureOptionCallITMExpiryRegressionAlgorithm.cs index e173b2eb12a1..7993f57cac16 100644 --- a/Algorithm.CSharp/FutureOptionCallITMExpiryRegressionAlgorithm.cs +++ b/Algorithm.CSharp/FutureOptionCallITMExpiryRegressionAlgorithm.cs @@ -205,7 +205,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of the algorithm history /// - public int AlgorithmHistoryDataPoints => 0; + public int AlgorithmHistoryDataPoints => 1; /// /// Final status of the algorithm diff --git a/Algorithm.CSharp/FutureOptionCallITMGreeksExpiryRegressionAlgorithm.cs b/Algorithm.CSharp/FutureOptionCallITMGreeksExpiryRegressionAlgorithm.cs index d2d4b08323dc..10c042f9e28b 100644 --- a/Algorithm.CSharp/FutureOptionCallITMGreeksExpiryRegressionAlgorithm.cs +++ b/Algorithm.CSharp/FutureOptionCallITMGreeksExpiryRegressionAlgorithm.cs @@ -170,7 +170,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of the algorithm history /// - public int AlgorithmHistoryDataPoints => 0; + public int AlgorithmHistoryDataPoints => 1; /// /// Final status of the algorithm diff --git a/Algorithm.CSharp/FutureOptionCallOTMExpiryRegressionAlgorithm.cs b/Algorithm.CSharp/FutureOptionCallOTMExpiryRegressionAlgorithm.cs index 945e63fefb2d..e0487122e33c 100644 --- a/Algorithm.CSharp/FutureOptionCallOTMExpiryRegressionAlgorithm.cs +++ b/Algorithm.CSharp/FutureOptionCallOTMExpiryRegressionAlgorithm.cs @@ -181,7 +181,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of the algorithm history /// - public int AlgorithmHistoryDataPoints => 0; + public int AlgorithmHistoryDataPoints => 1; /// /// Final status of the algorithm diff --git a/Algorithm.CSharp/FutureOptionChainFullDataRegressionAlgorithm.cs b/Algorithm.CSharp/FutureOptionChainFullDataRegressionAlgorithm.cs new file mode 100644 index 000000000000..1eb4f6531edd --- /dev/null +++ b/Algorithm.CSharp/FutureOptionChainFullDataRegressionAlgorithm.cs @@ -0,0 +1,127 @@ +/* + * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. + * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +using System; +using System.Collections.Generic; +using System.Linq; +using QuantConnect.Data; +using QuantConnect.Interfaces; +using QuantConnect.Securities; + +namespace QuantConnect.Algorithm.CSharp +{ + /// + /// Regression algorithm illustrating the usage of the method + /// to get a future option chain. + /// + public class FutureOptionChainFullDataRegressionAlgorithm : QCAlgorithm, IRegressionAlgorithmDefinition + { + private Symbol _optionContract; + + public override void Initialize() + { + SetStartDate(2020, 1, 6); + SetEndDate(2020, 1, 6); + + var futureContract = AddFutureContract( + QuantConnect.Symbol.CreateFuture(Futures.Indices.SP500EMini, Market.CME, new DateTime(2020, 3, 20)), + Resolution.Minute).Symbol; + + _optionContract = OptionChain(futureContract) + // Get contracts expiring within 4 months + .Where(contractData => contractData.Expiry - Time <= TimeSpan.FromDays(120)) + // Get the contract with the latest expiration date, highest strike and lowest price + .OrderByDescending(x => x.Expiry) + .ThenByDescending(x => x.Strike) + .ThenBy(x => x.LastPrice) + .First(); + + AddFutureOptionContract(_optionContract); + } + + public override void OnData(Slice slice) + { + // Do some trading with the selected contract for sample purposes + if (!Portfolio.Invested) + { + SetHoldings(_optionContract, 0.5); + } + else + { + Liquidate(); + } + } + + /// + /// This is used by the regression test system to indicate if the open source Lean repository has the required data to run this algorithm. + /// + public bool CanRunLocally { get; } = true; + + /// + /// This is used by the regression test system to indicate which languages this algorithm is written in. + /// + public virtual List Languages { get; } = new() { Language.CSharp, Language.Python }; + + /// + /// Data Points count of all timeslices of algorithm + /// + public long DataPoints => 1817; + + /// + /// Data Points count of the algorithm history + /// + public int AlgorithmHistoryDataPoints => 1; + + /// + /// Final status of the algorithm + /// + public AlgorithmStatus AlgorithmStatus => AlgorithmStatus.Completed; + + /// + /// This is used by the regression test system to indicate what the expected statistics are from running the algorithm + /// + public Dictionary ExpectedStatistics => new Dictionary + { + {"Total Orders", "450"}, + {"Average Win", "0%"}, + {"Average Loss", "0%"}, + {"Compounding Annual Return", "0%"}, + {"Drawdown", "0%"}, + {"Expectancy", "0"}, + {"Start Equity", "100000"}, + {"End Equity", "65398.86"}, + {"Net Profit", "0%"}, + {"Sharpe Ratio", "0"}, + {"Sortino Ratio", "0"}, + {"Probabilistic Sharpe Ratio", "0%"}, + {"Loss Rate", "0%"}, + {"Win Rate", "0%"}, + {"Profit-Loss Ratio", "0"}, + {"Alpha", "0"}, + {"Beta", "0"}, + {"Annual Standard Deviation", "0"}, + {"Annual Variance", "0"}, + {"Information Ratio", "0"}, + {"Tracking Error", "0"}, + {"Treynor Ratio", "0"}, + {"Total Fees", "$34601.14"}, + {"Estimated Strategy Capacity", "$0"}, + {"Lowest Capacity Asset", "ES XCZJLCGM383O|ES XCZJLC9NOB29"}, + {"Portfolio Turnover", "112.25%"}, + {"OrderListHash", "f18259d04c2d899e7162b88e10239eb8"} + }; + } +} diff --git a/Algorithm.CSharp/FutureOptionChainsMultipleFullDataRegressionAlgorithm.cs b/Algorithm.CSharp/FutureOptionChainsMultipleFullDataRegressionAlgorithm.cs new file mode 100644 index 000000000000..1fa3da0f8c02 --- /dev/null +++ b/Algorithm.CSharp/FutureOptionChainsMultipleFullDataRegressionAlgorithm.cs @@ -0,0 +1,147 @@ +/* + * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. + * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +using System; +using System.Collections.Generic; +using System.Linq; +using QuantConnect.Data; +using QuantConnect.Data.Market; +using QuantConnect.Interfaces; +using QuantConnect.Securities; + +namespace QuantConnect.Algorithm.CSharp +{ + /// + /// Regression algorithm illustrating the usage of the method + /// to get multiple future option chains. + /// + public class FutureOptionChainsMultipleFullDataRegressionAlgorithm : QCAlgorithm, IRegressionAlgorithmDefinition + { + private Symbol _esOptionContract; + private Symbol _gcOptionContract; + + public override void Initialize() + { + SetStartDate(2020, 1, 6); + SetEndDate(2020, 1, 6); + SetCash(100000); + + var esFutureContract = AddFutureContract( + QuantConnect.Symbol.CreateFuture(Futures.Indices.SP500EMini, Market.CME, new DateTime(2020, 3, 20)), + Resolution.Minute).Symbol; + + var gcFutureContract = AddFutureContract( + QuantConnect.Symbol.CreateFuture(Futures.Metals.Gold, Market.COMEX, new DateTime(2020, 4, 28)), + Resolution.Minute).Symbol; + + var chains = OptionChains([esFutureContract, gcFutureContract]); + + _esOptionContract = GetContract(chains, esFutureContract); + _gcOptionContract = GetContract(chains, gcFutureContract); + + AddFutureOptionContract(_esOptionContract); + AddFutureOptionContract(_gcOptionContract); + } + + private Symbol GetContract(OptionChains chains, Symbol underlying) + { + return chains + .Where(kvp => kvp.Key.Underlying == underlying) + .Select(kvp => kvp.Value) + .Single() + // Get contracts expiring within 5 months + .Where(contractData => contractData.Expiry - Time <= TimeSpan.FromDays(120)) + // Get the contract with the latest expiration date, highest strike and lowest price + .OrderByDescending(x => x.Expiry) + .ThenByDescending(x => x.Strike) + .ThenBy(x => x.LastPrice) + .First(); + } + + public override void OnData(Slice slice) + { + // Do some trading with the selected contract for sample purposes + if (!Portfolio.Invested) + { + SetHoldings(_esOptionContract, 0.25); + SetHoldings(_gcOptionContract, 0.25); + } + else + { + Liquidate(); + } + } + + /// + /// This is used by the regression test system to indicate if the open source Lean repository has the required data to run this algorithm. + /// + public bool CanRunLocally { get; } = true; + + /// + /// This is used by the regression test system to indicate which languages this algorithm is written in. + /// + public virtual List Languages { get; } = new() { Language.CSharp, Language.Python }; + + /// + /// Data Points count of all timeslices of algorithm + /// + public long DataPoints => 1819; + + /// + /// Data Points count of the algorithm history + /// + public int AlgorithmHistoryDataPoints => 2; + + /// + /// Final status of the algorithm + /// + public AlgorithmStatus AlgorithmStatus => AlgorithmStatus.Completed; + + /// + /// This is used by the regression test system to indicate what the expected statistics are from running the algorithm + /// + public Dictionary ExpectedStatistics => new Dictionary + { + {"Total Orders", "450"}, + {"Average Win", "0%"}, + {"Average Loss", "0%"}, + {"Compounding Annual Return", "0%"}, + {"Drawdown", "0%"}, + {"Expectancy", "0"}, + {"Start Equity", "100000"}, + {"End Equity", "80983.36"}, + {"Net Profit", "0%"}, + {"Sharpe Ratio", "0"}, + {"Sortino Ratio", "0"}, + {"Probabilistic Sharpe Ratio", "0%"}, + {"Loss Rate", "0%"}, + {"Win Rate", "0%"}, + {"Profit-Loss Ratio", "0"}, + {"Alpha", "0"}, + {"Beta", "0"}, + {"Annual Standard Deviation", "0"}, + {"Annual Variance", "0"}, + {"Information Ratio", "0"}, + {"Tracking Error", "0"}, + {"Treynor Ratio", "0"}, + {"Total Fees", "$19016.64"}, + {"Estimated Strategy Capacity", "$0"}, + {"Lowest Capacity Asset", "ES XCZJLCGM383O|ES XCZJLC9NOB29"}, + {"Portfolio Turnover", "49.52%"}, + {"OrderListHash", "9b39296a82d51d51fa1df02aad39d804"} + }; + } +} diff --git a/Algorithm.CSharp/FutureOptionDailyRegressionAlgorithm.cs b/Algorithm.CSharp/FutureOptionDailyRegressionAlgorithm.cs index 0a94b6140b9f..3f4a86482051 100644 --- a/Algorithm.CSharp/FutureOptionDailyRegressionAlgorithm.cs +++ b/Algorithm.CSharp/FutureOptionDailyRegressionAlgorithm.cs @@ -124,7 +124,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of the algorithm history /// - public virtual int AlgorithmHistoryDataPoints => 0; + public virtual int AlgorithmHistoryDataPoints => 1; /// /// Final status of the algorithm diff --git a/Algorithm.CSharp/FutureOptionHourlyRegressionAlgorithm.cs b/Algorithm.CSharp/FutureOptionHourlyRegressionAlgorithm.cs index 8ca9fa6d2495..f5ee40525a00 100644 --- a/Algorithm.CSharp/FutureOptionHourlyRegressionAlgorithm.cs +++ b/Algorithm.CSharp/FutureOptionHourlyRegressionAlgorithm.cs @@ -73,7 +73,7 @@ public override void OnData(Slice slice) /// /// Data Points count of the algorithm history /// - public override int AlgorithmHistoryDataPoints => 0; + public override int AlgorithmHistoryDataPoints => 1; /// /// Final status of the algorithm diff --git a/Algorithm.CSharp/FutureOptionIndicatorsRegressionAlgorithm.cs b/Algorithm.CSharp/FutureOptionIndicatorsRegressionAlgorithm.cs index 8a4e9674f079..aabfc0166dce 100644 --- a/Algorithm.CSharp/FutureOptionIndicatorsRegressionAlgorithm.cs +++ b/Algorithm.CSharp/FutureOptionIndicatorsRegressionAlgorithm.cs @@ -51,6 +51,11 @@ public override void Initialize() /// public override long DataPoints => 1817; + /// + /// Data Points count of the algorithm history + /// + public override int AlgorithmHistoryDataPoints => 1; + /// /// This is used by the regression test system to indicate what the expected statistics are from running the algorithm /// diff --git a/Algorithm.CSharp/FutureOptionMultipleContractsInDifferentContractMonthsWithSameUnderlyingFutureRegressionAlgorithm.cs b/Algorithm.CSharp/FutureOptionMultipleContractsInDifferentContractMonthsWithSameUnderlyingFutureRegressionAlgorithm.cs index fec8ca9eb321..dcbad2f93f04 100644 --- a/Algorithm.CSharp/FutureOptionMultipleContractsInDifferentContractMonthsWithSameUnderlyingFutureRegressionAlgorithm.cs +++ b/Algorithm.CSharp/FutureOptionMultipleContractsInDifferentContractMonthsWithSameUnderlyingFutureRegressionAlgorithm.cs @@ -109,7 +109,7 @@ private static Symbol CreateOption(DateTime expiry, OptionRight optionRight, dec /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 24379; + public long DataPoints => 13942; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/FutureOptionPutITMExpiryRegressionAlgorithm.cs b/Algorithm.CSharp/FutureOptionPutITMExpiryRegressionAlgorithm.cs index 177f9372d5bc..3f35a405d0c1 100644 --- a/Algorithm.CSharp/FutureOptionPutITMExpiryRegressionAlgorithm.cs +++ b/Algorithm.CSharp/FutureOptionPutITMExpiryRegressionAlgorithm.cs @@ -206,7 +206,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of the algorithm history /// - public int AlgorithmHistoryDataPoints => 0; + public int AlgorithmHistoryDataPoints => 1; /// /// Final status of the algorithm diff --git a/Algorithm.CSharp/FutureOptionPutOTMExpiryRegressionAlgorithm.cs b/Algorithm.CSharp/FutureOptionPutOTMExpiryRegressionAlgorithm.cs index c60149c64e81..a207d58c01e8 100644 --- a/Algorithm.CSharp/FutureOptionPutOTMExpiryRegressionAlgorithm.cs +++ b/Algorithm.CSharp/FutureOptionPutOTMExpiryRegressionAlgorithm.cs @@ -179,7 +179,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of the algorithm history /// - public int AlgorithmHistoryDataPoints => 0; + public int AlgorithmHistoryDataPoints => 1; /// /// Final status of the algorithm diff --git a/Algorithm.CSharp/FutureOptionShortCallITMExpiryRegressionAlgorithm.cs b/Algorithm.CSharp/FutureOptionShortCallITMExpiryRegressionAlgorithm.cs index ed67a742d933..e7fb06c2a86d 100644 --- a/Algorithm.CSharp/FutureOptionShortCallITMExpiryRegressionAlgorithm.cs +++ b/Algorithm.CSharp/FutureOptionShortCallITMExpiryRegressionAlgorithm.cs @@ -190,7 +190,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of the algorithm history /// - public int AlgorithmHistoryDataPoints => 0; + public int AlgorithmHistoryDataPoints => 1; /// /// Final status of the algorithm diff --git a/Algorithm.CSharp/FutureOptionShortCallOTMExpiryRegressionAlgorithm.cs b/Algorithm.CSharp/FutureOptionShortCallOTMExpiryRegressionAlgorithm.cs index 45b8f5f2ba24..91ddb92c934f 100644 --- a/Algorithm.CSharp/FutureOptionShortCallOTMExpiryRegressionAlgorithm.cs +++ b/Algorithm.CSharp/FutureOptionShortCallOTMExpiryRegressionAlgorithm.cs @@ -173,7 +173,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of the algorithm history /// - public int AlgorithmHistoryDataPoints => 0; + public int AlgorithmHistoryDataPoints => 1; /// /// Final status of the algorithm diff --git a/Algorithm.CSharp/FutureOptionShortPutITMExpiryRegressionAlgorithm.cs b/Algorithm.CSharp/FutureOptionShortPutITMExpiryRegressionAlgorithm.cs index 10b05989581b..6ec16ffd6ee4 100644 --- a/Algorithm.CSharp/FutureOptionShortPutITMExpiryRegressionAlgorithm.cs +++ b/Algorithm.CSharp/FutureOptionShortPutITMExpiryRegressionAlgorithm.cs @@ -187,7 +187,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of the algorithm history /// - public int AlgorithmHistoryDataPoints => 0; + public int AlgorithmHistoryDataPoints => 1; /// /// Final status of the algorithm diff --git a/Algorithm.CSharp/FutureOptionShortPutOTMExpiryRegressionAlgorithm.cs b/Algorithm.CSharp/FutureOptionShortPutOTMExpiryRegressionAlgorithm.cs index 4b9132b16c8d..463a357aa924 100644 --- a/Algorithm.CSharp/FutureOptionShortPutOTMExpiryRegressionAlgorithm.cs +++ b/Algorithm.CSharp/FutureOptionShortPutOTMExpiryRegressionAlgorithm.cs @@ -172,7 +172,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of the algorithm history /// - public int AlgorithmHistoryDataPoints => 0; + public int AlgorithmHistoryDataPoints => 1; /// /// Final status of the algorithm diff --git a/Algorithm.CSharp/FutureSharingTickerRegressionAlgorithm.cs b/Algorithm.CSharp/FutureSharingTickerRegressionAlgorithm.cs index d55a557f9640..f5dbcf8403e9 100644 --- a/Algorithm.CSharp/FutureSharingTickerRegressionAlgorithm.cs +++ b/Algorithm.CSharp/FutureSharingTickerRegressionAlgorithm.cs @@ -80,7 +80,7 @@ select futuresContract /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 51429; + public long DataPoints => 23079; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/FutureStopMarketOrderOnExtendedHoursRegressionAlgorithm.cs b/Algorithm.CSharp/FutureStopMarketOrderOnExtendedHoursRegressionAlgorithm.cs index 24affa9ea1d8..4d7c02b79b9f 100644 --- a/Algorithm.CSharp/FutureStopMarketOrderOnExtendedHoursRegressionAlgorithm.cs +++ b/Algorithm.CSharp/FutureStopMarketOrderOnExtendedHoursRegressionAlgorithm.cs @@ -26,8 +26,8 @@ namespace QuantConnect.Algorithm.CSharp { /// - /// Continuous Futures Regression algorithm. - /// Asserting the behavior of stop market order in extended market hours + /// Continuous Futures Regression algorithm. + /// Asserting the behavior of stop market order in extended market hours /// /// public class FutureStopMarketOrderOnExtendedHoursRegressionAlgorithm : QCAlgorithm, IRegressionAlgorithmDefinition @@ -43,6 +43,12 @@ public override void Initialize() Schedule.On(DateRules.EveryDay(), TimeRules.At(19, 0), () => { + // Don't place orders at the end of the last date, the market-on-stop order won't have time to fill + if (Time.Date == EndDate.Date.AddDays(-1)) + { + return; + } + MarketOrder(_SP500EMini.Mapped, 1); _ticket = StopMarketOrder(_SP500EMini.Mapped, -1, _SP500EMini.Price * 1.1m); }); @@ -113,7 +119,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of all time slices of algorithm /// - public long DataPoints => 75961; + public long DataPoints => 41486; /// /// Data Points count of the algorithm history @@ -133,7 +139,7 @@ public override void OnEndOfAlgorithm() {"Total Orders", "10"}, {"Average Win", "0%"}, {"Average Loss", "-0.02%"}, - {"Compounding Annual Return", "-6.736%"}, + {"Compounding Annual Return", "-6.419%"}, {"Drawdown", "0.100%"}, {"Expectancy", "-1"}, {"Start Equity", "100000"}, diff --git a/Algorithm.CSharp/FutureUniverseHistoryRegressionAlgorithm.cs b/Algorithm.CSharp/FutureUniverseHistoryRegressionAlgorithm.cs new file mode 100644 index 000000000000..b238b866d624 --- /dev/null +++ b/Algorithm.CSharp/FutureUniverseHistoryRegressionAlgorithm.cs @@ -0,0 +1,131 @@ +/* + * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. + * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +using System.Collections.Generic; +using System.Linq; +using QuantConnect.Data.UniverseSelection; +using QuantConnect.Interfaces; +using QuantConnect.Securities; + +namespace QuantConnect.Algorithm.CSharp +{ + /// + /// Regression algorithm testing history requests for type work as expected + /// and return the same data as the futures chain provider. + /// + public class FutureUniverseHistoryRegressionAlgorithm : QCAlgorithm, IRegressionAlgorithmDefinition + { + public override void Initialize() + { + SetStartDate(2013, 10, 11); + SetEndDate(2013, 10, 11); + + var future = AddFuture(Futures.Indices.SP500EMini, Resolution.Minute).Symbol; + + var historicalFuturesData = History(future, 3, Resolution.Daily).ToList(); + + if (historicalFuturesData.Count != 3) + { + throw new RegressionTestException($"Expected 3 futures chains from history request, " + + $"but got {historicalFuturesData.Count}"); + } + + foreach (var historyFutureUniverse in historicalFuturesData) + { + var date = historyFutureUniverse.EndTime; + var chain = FutureChainProvider.GetFutureContractList(future, date).ToList(); + + if (chain.Count == 0) + { + throw new RegressionTestException($"No futures in chain on {date}"); + } + + if (chain.Count != historyFutureUniverse.Data.Count) + { + throw new RegressionTestException($"Expected {chain.Count} futures in chain on {date}, " + + $"but got {historyFutureUniverse.Data.Count}"); + } + + for (var i = 0; i < chain.Count; i++) + { + if (historyFutureUniverse.Data[i].Symbol != chain[i]) + { + throw new RegressionTestException($"Missing future contract {chain[i]} on {date}"); + } + } + } + } + + /// + /// This is used by the regression test system to indicate if the open source Lean repository has the required data to run this algorithm. + /// + public bool CanRunLocally { get; } = true; + + /// + /// This is used by the regression test system to indicate which languages this algorithm is written in. + /// + public List Languages { get; } = new() { Language.CSharp, Language.Python }; + + /// + /// Data Points count of all timeslices of algorithm + /// + public long DataPoints => 2735; + + /// + /// Data Points count of the algorithm history + /// + public int AlgorithmHistoryDataPoints => 6; + + /// + /// Final status of the algorithm + /// + public AlgorithmStatus AlgorithmStatus => AlgorithmStatus.Completed; + + /// + /// This is used by the regression test system to indicate what the expected statistics are from running the algorithm + /// + public Dictionary ExpectedStatistics => new Dictionary + { + {"Total Orders", "0"}, + {"Average Win", "0%"}, + {"Average Loss", "0%"}, + {"Compounding Annual Return", "0%"}, + {"Drawdown", "0%"}, + {"Expectancy", "0"}, + {"Start Equity", "100000"}, + {"End Equity", "100000"}, + {"Net Profit", "0%"}, + {"Sharpe Ratio", "0"}, + {"Sortino Ratio", "0"}, + {"Probabilistic Sharpe Ratio", "0%"}, + {"Loss Rate", "0%"}, + {"Win Rate", "0%"}, + {"Profit-Loss Ratio", "0"}, + {"Alpha", "0"}, + {"Beta", "0"}, + {"Annual Standard Deviation", "0"}, + {"Annual Variance", "0"}, + {"Information Ratio", "0"}, + {"Tracking Error", "0"}, + {"Treynor Ratio", "0"}, + {"Total Fees", "$0.00"}, + {"Estimated Strategy Capacity", "$0"}, + {"Lowest Capacity Asset", ""}, + {"Portfolio Turnover", "0%"}, + {"OrderListHash", "d41d8cd98f00b204e9800998ecf8427e"} + }; + } +} diff --git a/Algorithm.CSharp/FuturesChainFullDataRegressionAlgorithm.cs b/Algorithm.CSharp/FuturesChainFullDataRegressionAlgorithm.cs new file mode 100644 index 000000000000..0f8790251f72 --- /dev/null +++ b/Algorithm.CSharp/FuturesChainFullDataRegressionAlgorithm.cs @@ -0,0 +1,133 @@ +/* + * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. + * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +using System; +using System.Collections.Generic; +using System.Linq; +using QuantConnect.Data; +using QuantConnect.Interfaces; +using QuantConnect.Securities; + +namespace QuantConnect.Algorithm.CSharp +{ + /// + /// Regression algorithm illustrating the usage of the + /// method to get a future chain. + /// + public class FuturesChainFullDataRegressionAlgorithm : QCAlgorithm, IRegressionAlgorithmDefinition + { + private Symbol _futureContract; + + public override void Initialize() + { + SetStartDate(2013, 10, 7); + SetEndDate(2013, 10, 7); + + var future = AddFuture(Futures.Indices.SP500EMini, Resolution.Minute).Symbol; + + var chain = FuturesChain(future); + foreach (var contract in chain) + { + if (contract.BidPrice == 0 && contract.AskPrice == 0 && contract.Volume == 0) + { + throw new RegressionTestException("FuturesChain() returned contract with no data."); + } + } + + _futureContract = chain + // Get contracts expiring within 6 months + .Where(contractData => contractData.Expiry - Time <= TimeSpan.FromDays(180)) + // Get the contract with the latest expiration date, and lowest price + .OrderByDescending(x => x.Expiry) + .ThenBy(x => x.LastPrice) + .First(); + + AddFutureContract(_futureContract); + } + + public override void OnData(Slice slice) + { + // Do some trading with the selected contract for sample purposes + if (!Portfolio.Invested) + { + SetHoldings(_futureContract, 0.5); + } + else + { + Liquidate(); + } + } + + /// + /// This is used by the regression test system to indicate if the open source Lean repository has the required data to run this algorithm. + /// + public bool CanRunLocally { get; } = true; + + /// + /// This is used by the regression test system to indicate which languages this algorithm is written in. + /// + public virtual List Languages { get; } = new() { Language.CSharp, Language.Python }; + + /// + /// Data Points count of all timeslices of algorithm + /// + public long DataPoints => 4083; + + /// + /// Data Points count of the algorithm history + /// + public int AlgorithmHistoryDataPoints => 1; + + /// + /// Final status of the algorithm + /// + public AlgorithmStatus AlgorithmStatus => AlgorithmStatus.Completed; + + /// + /// This is used by the regression test system to indicate what the expected statistics are from running the algorithm + /// + public Dictionary ExpectedStatistics => new Dictionary + { + {"Total Orders", "450"}, + {"Average Win", "0%"}, + {"Average Loss", "0%"}, + {"Compounding Annual Return", "0%"}, + {"Drawdown", "0%"}, + {"Expectancy", "0"}, + {"Start Equity", "100000"}, + {"End Equity", "50272.1"}, + {"Net Profit", "0%"}, + {"Sharpe Ratio", "0"}, + {"Sortino Ratio", "0"}, + {"Probabilistic Sharpe Ratio", "0%"}, + {"Loss Rate", "0%"}, + {"Win Rate", "0%"}, + {"Profit-Loss Ratio", "0"}, + {"Alpha", "0"}, + {"Beta", "0"}, + {"Annual Standard Deviation", "0"}, + {"Annual Variance", "0"}, + {"Information Ratio", "0"}, + {"Tracking Error", "0"}, + {"Treynor Ratio", "0"}, + {"Total Fees", "$8290.40"}, + {"Estimated Strategy Capacity", "$13000.00"}, + {"Lowest Capacity Asset", "ES VP274HSU1AF5"}, + {"Portfolio Turnover", "639698.49%"}, + {"OrderListHash", "312461917700d86df1b5c43e1e7ec0eb"} + }; + } +} diff --git a/Algorithm.CSharp/FuturesChainsMultipleFullDataRegressionAlgorithm.cs b/Algorithm.CSharp/FuturesChainsMultipleFullDataRegressionAlgorithm.cs new file mode 100644 index 000000000000..d670aa4b19a8 --- /dev/null +++ b/Algorithm.CSharp/FuturesChainsMultipleFullDataRegressionAlgorithm.cs @@ -0,0 +1,140 @@ +/* + * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. + * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +using System; +using System.Collections.Generic; +using System.Linq; +using QuantConnect.Data; +using QuantConnect.Data.Market; +using QuantConnect.Interfaces; +using QuantConnect.Securities; + +namespace QuantConnect.Algorithm.CSharp +{ + /// + /// Regression algorithm illustrating the usage of the + /// method to get multiple futures chains. + /// + public class FuturesChainsMultipleFullDataRegressionAlgorithm : QCAlgorithm, IRegressionAlgorithmDefinition + { + private Symbol _esFutureContract; + private Symbol _gcFutureContract; + + public override void Initialize() + { + SetStartDate(2013, 10, 7); + SetEndDate(2013, 10, 7); + + var esFuture= AddFuture(Futures.Indices.SP500EMini).Symbol; + var gcFuture = AddFuture(Futures.Metals.Gold).Symbol; + + var chains = FuturesChains([esFuture, gcFuture]); + + _esFutureContract = GetContract(chains, esFuture); + _gcFutureContract = GetContract(chains, gcFuture); + + AddFutureContract(_esFutureContract); + AddFutureContract(_gcFutureContract); + } + + private Symbol GetContract(FuturesChains chains, Symbol canonical) + { + return chains + .Where(kvp => kvp.Key == canonical) + .Select(kvp => kvp.Value) + .Single() + // Get contracts expiring within 6 months + .Where(contractData => contractData.Expiry - Time <= TimeSpan.FromDays(180)) + // Get the contract with the latest expiration date, and lowest price + .OrderByDescending(x => x.Expiry) + .ThenBy(x => x.LastPrice) + .First(); + } + + public override void OnData(Slice slice) + { + // Do some trading with the selected contract for sample purposes + if (!Portfolio.Invested) + { + SetHoldings(_esFutureContract, 0.25); + SetHoldings(_gcFutureContract, 0.25); + } + else + { + Liquidate(); + } + } + + /// + /// This is used by the regression test system to indicate if the open source Lean repository has the required data to run this algorithm. + /// + public bool CanRunLocally { get; } = true; + + /// + /// This is used by the regression test system to indicate which languages this algorithm is written in. + /// + public virtual List Languages { get; } = new() { Language.CSharp, Language.Python }; + + /// + /// Data Points count of all timeslices of algorithm + /// + public long DataPoints => 8184; + + /// + /// Data Points count of the algorithm history + /// + public int AlgorithmHistoryDataPoints => 2; + + /// + /// Final status of the algorithm + /// + public AlgorithmStatus AlgorithmStatus => AlgorithmStatus.Completed; + + /// + /// This is used by the regression test system to indicate what the expected statistics are from running the algorithm + /// + public Dictionary ExpectedStatistics => new Dictionary + { + {"Total Orders", "900"}, + {"Average Win", "0%"}, + {"Average Loss", "0%"}, + {"Compounding Annual Return", "0%"}, + {"Drawdown", "0%"}, + {"Expectancy", "0"}, + {"Start Equity", "100000"}, + {"End Equity", "57108.26"}, + {"Net Profit", "0%"}, + {"Sharpe Ratio", "0"}, + {"Sortino Ratio", "0"}, + {"Probabilistic Sharpe Ratio", "0%"}, + {"Loss Rate", "0%"}, + {"Win Rate", "0%"}, + {"Profit-Loss Ratio", "0"}, + {"Alpha", "0"}, + {"Beta", "0"}, + {"Annual Standard Deviation", "0"}, + {"Annual Variance", "0"}, + {"Information Ratio", "0"}, + {"Tracking Error", "0"}, + {"Treynor Ratio", "0"}, + {"Total Fees", "$5701.74"}, + {"Estimated Strategy Capacity", "$19000.00"}, + {"Lowest Capacity Asset", "GC VOFJUCDY9XNH"}, + {"Portfolio Turnover", "432921.78%"}, + {"OrderListHash", "c75de8eb115be82a0ec2afaec8d034ff"} + }; + } +} diff --git a/Algorithm.CSharp/FuturesDailySettlementLongRegressionAlgorithm.cs b/Algorithm.CSharp/FuturesDailySettlementLongRegressionAlgorithm.cs index 4014c408f9e2..dcd12dbb7f34 100644 --- a/Algorithm.CSharp/FuturesDailySettlementLongRegressionAlgorithm.cs +++ b/Algorithm.CSharp/FuturesDailySettlementLongRegressionAlgorithm.cs @@ -62,7 +62,7 @@ public override void Initialize() var future = QuantConnect.Symbol.Create(Futures.Indices.SP500EMini, SecurityType.Future, Market.CME); - _contractSymbol = FutureChainProvider.GetFutureContractList(future, Time).OrderBy(x => x.ID.Date).FirstOrDefault(); + _contractSymbol = FuturesChain(future).OrderBy(x => x.ID.Date).First(); _future = AddFutureContract(_contractSymbol); _future.Holdings.SetHoldings(1600, 1 * OrderSide); @@ -180,7 +180,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of the algorithm history /// - public int AlgorithmHistoryDataPoints => 0; + public int AlgorithmHistoryDataPoints => 1; /// /// Final status of the algorithm diff --git a/Algorithm.CSharp/FuturesExpiredContractRegression.cs b/Algorithm.CSharp/FuturesExpiredContractRegression.cs index 0c8ec37ef63e..738ff93e6697 100644 --- a/Algorithm.CSharp/FuturesExpiredContractRegression.cs +++ b/Algorithm.CSharp/FuturesExpiredContractRegression.cs @@ -89,7 +89,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 268275; + public long DataPoints => 24508; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/FuturesExtendedMarketHoursRegressionAlgorithm.cs b/Algorithm.CSharp/FuturesExtendedMarketHoursRegressionAlgorithm.cs index 69a687b6a8aa..0b19c91767cd 100644 --- a/Algorithm.CSharp/FuturesExtendedMarketHoursRegressionAlgorithm.cs +++ b/Algorithm.CSharp/FuturesExtendedMarketHoursRegressionAlgorithm.cs @@ -113,7 +113,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 3631; + public long DataPoints => 2197; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/FuturesFrameworkRegressionAlgorithm.cs b/Algorithm.CSharp/FuturesFrameworkRegressionAlgorithm.cs index 642def7821e8..c691adb784d3 100644 --- a/Algorithm.CSharp/FuturesFrameworkRegressionAlgorithm.cs +++ b/Algorithm.CSharp/FuturesFrameworkRegressionAlgorithm.cs @@ -185,7 +185,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of all timeslices of algorithm /// - public virtual long DataPoints => 126811; + public virtual long DataPoints => 101119; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/HSIFutureDailyRegressionAlgorithm.cs b/Algorithm.CSharp/HSIFutureDailyRegressionAlgorithm.cs index d497a26a5bac..b94fb1e20478 100644 --- a/Algorithm.CSharp/HSIFutureDailyRegressionAlgorithm.cs +++ b/Algorithm.CSharp/HSIFutureDailyRegressionAlgorithm.cs @@ -31,7 +31,7 @@ public class HSIFutureDailyRegressionAlgorithm : HSIFutureHourRegressionAlgorith /// /// Data Points count of all timeslices of algorithm /// - public override long DataPoints => 177; + public override long DataPoints => 174; /// /// Data Points count of the algorithm history @@ -74,7 +74,7 @@ public class HSIFutureDailyRegressionAlgorithm : HSIFutureHourRegressionAlgorith {"Estimated Strategy Capacity", "$0"}, {"Lowest Capacity Asset", "HSI VL6DN7UV65S9"}, {"Portfolio Turnover", "1590.77%"}, - {"OrderListHash", "42cd8e3b58361b181c911a603f69d2f7"} + {"OrderListHash", "ca159879e35579b71717638fe2a6844c"} }; } } diff --git a/Algorithm.CSharp/HSIFutureHourRegressionAlgorithm.cs b/Algorithm.CSharp/HSIFutureHourRegressionAlgorithm.cs index 657ced59c790..66a35ab23187 100644 --- a/Algorithm.CSharp/HSIFutureHourRegressionAlgorithm.cs +++ b/Algorithm.CSharp/HSIFutureHourRegressionAlgorithm.cs @@ -161,7 +161,7 @@ public override void OnSecuritiesChanged(SecurityChanges changes) /// /// Data Points count of all timeslices of algorithm /// - public virtual long DataPoints => 823; + public virtual long DataPoints => 652; /// /// Data Points count of the algorithm history @@ -204,7 +204,7 @@ public override void OnSecuritiesChanged(SecurityChanges changes) {"Estimated Strategy Capacity", "$120000000.00"}, {"Lowest Capacity Asset", "HSI VL6DN7UV65S9"}, {"Portfolio Turnover", "7099.25%"}, - {"OrderListHash", "174bdb031f17212dc9d92372f4fb75c2"} + {"OrderListHash", "da41f273d264b6b1fec2cfa106f3b446"} }; } } diff --git a/Algorithm.CSharp/HistoryWithDifferentContinuousContractDepthOffsetsRegressionAlgorithm.cs b/Algorithm.CSharp/HistoryWithDifferentContinuousContractDepthOffsetsRegressionAlgorithm.cs index c33ea8617577..3b6d80a7d219 100644 --- a/Algorithm.CSharp/HistoryWithDifferentContinuousContractDepthOffsetsRegressionAlgorithm.cs +++ b/Algorithm.CSharp/HistoryWithDifferentContinuousContractDepthOffsetsRegressionAlgorithm.cs @@ -129,7 +129,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 1432; + public long DataPoints => 968; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/HistoryWithDifferentDataMappingModeRegressionAlgorithm.cs b/Algorithm.CSharp/HistoryWithDifferentDataMappingModeRegressionAlgorithm.cs index b563fcafbb75..a31e93ddf540 100644 --- a/Algorithm.CSharp/HistoryWithDifferentDataMappingModeRegressionAlgorithm.cs +++ b/Algorithm.CSharp/HistoryWithDifferentDataMappingModeRegressionAlgorithm.cs @@ -101,7 +101,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 1432; + public long DataPoints => 968; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/HistoryWithDifferentDataNormalizationModeRegressionAlgorithm.cs b/Algorithm.CSharp/HistoryWithDifferentDataNormalizationModeRegressionAlgorithm.cs index 83d7d0b9e3a2..f87ab5b26331 100644 --- a/Algorithm.CSharp/HistoryWithDifferentDataNormalizationModeRegressionAlgorithm.cs +++ b/Algorithm.CSharp/HistoryWithDifferentDataNormalizationModeRegressionAlgorithm.cs @@ -93,7 +93,7 @@ private void CheckHistoryResultsForDataNormalizationModes(Symbol symbol, DateTim /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 1490; + public long DataPoints => 1026; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/IndicatorSelectorsWorkWithDifferentOptions.cs b/Algorithm.CSharp/IndicatorSelectorsWorkWithDifferentOptions.cs index c72c2fdae79e..2b60e159fba5 100644 --- a/Algorithm.CSharp/IndicatorSelectorsWorkWithDifferentOptions.cs +++ b/Algorithm.CSharp/IndicatorSelectorsWorkWithDifferentOptions.cs @@ -186,7 +186,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 1575349; + public long DataPoints => 454077; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/LimitOrdersAreFilledAfterHoursForFuturesRegressionAlgorithm.cs b/Algorithm.CSharp/LimitOrdersAreFilledAfterHoursForFuturesRegressionAlgorithm.cs index 7af2780d0a10..258790f106ec 100644 --- a/Algorithm.CSharp/LimitOrdersAreFilledAfterHoursForFuturesRegressionAlgorithm.cs +++ b/Algorithm.CSharp/LimitOrdersAreFilledAfterHoursForFuturesRegressionAlgorithm.cs @@ -48,7 +48,7 @@ public override void Initialize() contractDepthOffset: 0, extendedMarketHours: true ); - _futureContract = AddFutureContract(FutureChainProvider.GetFutureContractList(_continuousContract.Symbol, Time).First(), extendedMarketHours: true); + _futureContract = AddFutureContract(FuturesChain(_continuousContract.Symbol).First(), extendedMarketHours: true); } public override void OnWarmupFinished() @@ -113,12 +113,12 @@ public override void OnOrderEvent(OrderEvent orderEvent) /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 82372; + public long DataPoints => 52987; /// /// Data Points count of the algorithm history /// - public int AlgorithmHistoryDataPoints => 0; + public int AlgorithmHistoryDataPoints => 1; /// /// Final status of the algorithm diff --git a/Algorithm.CSharp/ManualContinuousFuturesPositionRolloverRegressionAlgorithm.cs b/Algorithm.CSharp/ManualContinuousFuturesPositionRolloverRegressionAlgorithm.cs index bebf0a5d7bdb..6ee3e8613234 100644 --- a/Algorithm.CSharp/ManualContinuousFuturesPositionRolloverRegressionAlgorithm.cs +++ b/Algorithm.CSharp/ManualContinuousFuturesPositionRolloverRegressionAlgorithm.cs @@ -103,7 +103,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 713375; + public long DataPoints => 162575; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/MarketOrdersAreSupportedOnExtendedHoursForFuturesRegressionAlgorithm.cs b/Algorithm.CSharp/MarketOrdersAreSupportedOnExtendedHoursForFuturesRegressionAlgorithm.cs index 9bdeeada06c0..e12df5f1027d 100644 --- a/Algorithm.CSharp/MarketOrdersAreSupportedOnExtendedHoursForFuturesRegressionAlgorithm.cs +++ b/Algorithm.CSharp/MarketOrdersAreSupportedOnExtendedHoursForFuturesRegressionAlgorithm.cs @@ -43,7 +43,7 @@ public override void Initialize() contractDepthOffset: 0, extendedMarketHours: true ); - _futureContract = AddFutureContract(FutureChainProvider.GetFutureContractList(_continuousContract.Symbol, Time).First(), + _futureContract = AddFutureContract(FuturesChain(_continuousContract.Symbol).First(), extendedMarketHours: true); } public override void OnData(Slice slice) @@ -90,12 +90,12 @@ public override void OnOrderEvent(OrderEvent orderEvent) /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 82372; + public long DataPoints => 52987; /// /// Data Points count of the algorithm history /// - public int AlgorithmHistoryDataPoints => 0; + public int AlgorithmHistoryDataPoints => 1; /// /// Final status of the algorithm diff --git a/Algorithm.CSharp/OpenInterestFuturesRegressionAlgorithm.cs b/Algorithm.CSharp/OpenInterestFuturesRegressionAlgorithm.cs index 546a6640bc48..d2e250a52de3 100644 --- a/Algorithm.CSharp/OpenInterestFuturesRegressionAlgorithm.cs +++ b/Algorithm.CSharp/OpenInterestFuturesRegressionAlgorithm.cs @@ -92,12 +92,12 @@ public override void OnData(Slice slice) /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 2794076; + public long DataPoints => 526055; /// /// Data Points count of the algorithm history /// - public int AlgorithmHistoryDataPoints => 252; + public int AlgorithmHistoryDataPoints => 232; /// /// Final status of the algorithm diff --git a/Algorithm.CSharp/OptionIndicatorsRegressionAlgorithm.cs b/Algorithm.CSharp/OptionIndicatorsRegressionAlgorithm.cs index 09aae25c7d8c..103177836378 100644 --- a/Algorithm.CSharp/OptionIndicatorsRegressionAlgorithm.cs +++ b/Algorithm.CSharp/OptionIndicatorsRegressionAlgorithm.cs @@ -90,7 +90,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of the algorithm history /// - public int AlgorithmHistoryDataPoints => 0; + public virtual int AlgorithmHistoryDataPoints => 0; /// /// Final status of the algorithm diff --git a/Algorithm.CSharp/OptionOTMExpiryOrderHasZeroPriceRegressionAlgorithm.cs b/Algorithm.CSharp/OptionOTMExpiryOrderHasZeroPriceRegressionAlgorithm.cs index e695e5583065..a6105b79f7ff 100644 --- a/Algorithm.CSharp/OptionOTMExpiryOrderHasZeroPriceRegressionAlgorithm.cs +++ b/Algorithm.CSharp/OptionOTMExpiryOrderHasZeroPriceRegressionAlgorithm.cs @@ -158,7 +158,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of the algorithm history /// - public int AlgorithmHistoryDataPoints => 0; + public int AlgorithmHistoryDataPoints => 1; /// /// Final status of the algorithm diff --git a/Algorithm.CSharp/RegisterIndicatorRegressionAlgorithm.cs b/Algorithm.CSharp/RegisterIndicatorRegressionAlgorithm.cs index c39c08b7a929..77c8b2175075 100644 --- a/Algorithm.CSharp/RegisterIndicatorRegressionAlgorithm.cs +++ b/Algorithm.CSharp/RegisterIndicatorRegressionAlgorithm.cs @@ -165,7 +165,7 @@ protected override decimal ComputeNextValue(QuoteBar input) /// /// Data Points count of the algorithm history /// - public int AlgorithmHistoryDataPoints => 0; + public int AlgorithmHistoryDataPoints => 1; /// /// Final status of the algorithm diff --git a/Algorithm.CSharp/SetDataNormalizationModeOnAddSecurityAlgorithm.cs b/Algorithm.CSharp/SetDataNormalizationModeOnAddSecurityAlgorithm.cs index 4c9dbfe12217..aa50452d6ae6 100644 --- a/Algorithm.CSharp/SetDataNormalizationModeOnAddSecurityAlgorithm.cs +++ b/Algorithm.CSharp/SetDataNormalizationModeOnAddSecurityAlgorithm.cs @@ -99,7 +99,7 @@ private void CheckEquityDataNormalizationMode(Security security, DataNormalizati /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 7322; + public long DataPoints => 5072; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/SetHoldingsFutureRegressionAlgorithm.cs b/Algorithm.CSharp/SetHoldingsFutureRegressionAlgorithm.cs index 888f1ac6a0f0..4cbdd1db4a2a 100644 --- a/Algorithm.CSharp/SetHoldingsFutureRegressionAlgorithm.cs +++ b/Algorithm.CSharp/SetHoldingsFutureRegressionAlgorithm.cs @@ -151,7 +151,7 @@ public override void OnOrderEvent(OrderEvent orderEvent) /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 21665; + public long DataPoints => 14920; /// /// Data Points count of the algorithm history @@ -171,7 +171,7 @@ public override void OnOrderEvent(OrderEvent orderEvent) {"Total Orders", "3"}, {"Average Win", "0%"}, {"Average Loss", "-1.34%"}, - {"Compounding Annual Return", "-97.000%"}, + {"Compounding Annual Return", "-95.782%"}, {"Drawdown", "2.600%"}, {"Expectancy", "-1"}, {"Start Equity", "1000000"}, diff --git a/Algorithm.CSharp/StatisticsResultsAlgorithm.cs b/Algorithm.CSharp/StatisticsResultsAlgorithm.cs index 1c312c378fd8..6b89219fe1c2 100644 --- a/Algorithm.CSharp/StatisticsResultsAlgorithm.cs +++ b/Algorithm.CSharp/StatisticsResultsAlgorithm.cs @@ -229,8 +229,8 @@ private void CheckMostTradedSecurityStatistic(Dictionary statist {"Estimated Strategy Capacity", "$1100000.00"}, {"Lowest Capacity Asset", "IBM R735QTJ8XC9X"}, {"Portfolio Turnover", "549.26%"}, - {"Most Traded Security", "IBM"}, {"Most Traded Security Trade Count", "63"}, + {"Most Traded Security", "IBM"}, {"OrderListHash", "8dd77e35338a81410a5b68dc8345f402"} }; } diff --git a/Algorithm.CSharp/WarmupFutureRegressionAlgorithm.cs b/Algorithm.CSharp/WarmupFutureRegressionAlgorithm.cs index 0ef63fa51c55..c3b26d478c01 100644 --- a/Algorithm.CSharp/WarmupFutureRegressionAlgorithm.cs +++ b/Algorithm.CSharp/WarmupFutureRegressionAlgorithm.cs @@ -137,7 +137,7 @@ protected void AssertDataTime(DateTime start, DateTime end, List times /// /// Data Points count of all timeslices of algorithm /// - public virtual long DataPoints => 21683; + public virtual long DataPoints => 14938; /// /// Data Points count of the algorithm history @@ -157,7 +157,7 @@ protected void AssertDataTime(DateTime start, DateTime end, List times {"Total Orders", "1"}, {"Average Win", "0%"}, {"Average Loss", "0%"}, - {"Compounding Annual Return", "130.234%"}, + {"Compounding Annual Return", "112.304%"}, {"Drawdown", "1.400%"}, {"Expectancy", "0"}, {"Start Equity", "100000"}, diff --git a/Algorithm.CSharp/WarmupFutureTimeSpanWarmupRegressionAlgorithm.cs b/Algorithm.CSharp/WarmupFutureTimeSpanWarmupRegressionAlgorithm.cs index 8bc3c4d26cd3..f7f5031da9eb 100644 --- a/Algorithm.CSharp/WarmupFutureTimeSpanWarmupRegressionAlgorithm.cs +++ b/Algorithm.CSharp/WarmupFutureTimeSpanWarmupRegressionAlgorithm.cs @@ -36,6 +36,6 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of all timeslices of algorithm /// - public override long DataPoints => 28892; + public override long DataPoints => 19892; } } diff --git a/Algorithm.Framework/Selection/OpenInterestFutureUniverseSelectionModel.cs b/Algorithm.Framework/Selection/OpenInterestFutureUniverseSelectionModel.cs index 18b280c8fac4..ba7ae7c1ce33 100644 --- a/Algorithm.Framework/Selection/OpenInterestFutureUniverseSelectionModel.cs +++ b/Algorithm.Framework/Selection/OpenInterestFutureUniverseSelectionModel.cs @@ -75,7 +75,8 @@ public OpenInterestFutureUniverseSelectionModel(IAlgorithm algorithm, PyObject f protected override FutureFilterUniverse Filter(FutureFilterUniverse filter) { // Remove duplicated keys - return filter.Contracts(FilterByOpenInterest(filter.DistinctBy(x => x).ToDictionary(x => x, x => _marketHoursDatabase.GetEntry(x.ID.Market, x, x.ID.SecurityType)))); + return filter.Contracts(FilterByOpenInterest( + filter.DistinctBy(x => x).ToDictionary(x => x.Symbol, x => _marketHoursDatabase.GetEntry(x.ID.Market, x, x.ID.SecurityType)))); } /// diff --git a/Algorithm.Python/AddFutureOptionSingleOptionChainSelectedInUniverseFilterRegressionAlgorithm.py b/Algorithm.Python/AddFutureOptionSingleOptionChainSelectedInUniverseFilterRegressionAlgorithm.py index a7e208776ee3..4b6b654c02ed 100644 --- a/Algorithm.Python/AddFutureOptionSingleOptionChainSelectedInUniverseFilterRegressionAlgorithm.py +++ b/Algorithm.Python/AddFutureOptionSingleOptionChainSelectedInUniverseFilterRegressionAlgorithm.py @@ -46,9 +46,7 @@ def option_contract_universe_filter_function(self, option_contracts: OptionFilte if expiry is None or symbol is None: raise AssertionError("Expected a single Option contract in the chain, found 0 contracts") - enumerator = option_contracts.get_enumerator() - while enumerator.move_next(): - self.expected_symbols_received.append(enumerator.current.symbol) + self.expected_symbols_received.extend([x.symbol for x in option_contracts]) return option_contracts @@ -74,7 +72,7 @@ def on_data(self, data: Slice): if self.invested or not has_option_quote_bars: return - for chain in data.option_chains.values(): + for chain in sorted(data.option_chains.values(), key=lambda chain: chain.symbol.underlying.id.date): future_invested = False option_invested = False diff --git a/Algorithm.Python/BasicTemplateFuturesDailyAlgorithm.py b/Algorithm.Python/BasicTemplateFuturesDailyAlgorithm.py index 3f043afe652b..fd4ec9c24f4f 100644 --- a/Algorithm.Python/BasicTemplateFuturesDailyAlgorithm.py +++ b/Algorithm.Python/BasicTemplateFuturesDailyAlgorithm.py @@ -54,6 +54,12 @@ def on_data(self,slice): elif all(x.exchange.hours.is_open(self.time, True) for x in self.securities.values() if x.invested): self.liquidate() + def on_securities_changed(self, changes: SecurityChanges) -> None: + if len(changes.removed_securities) > 0 and \ + self.portfolio.invested and \ + all(x.exchange.hours.is_open(self.time, True) for x in self.securities.values() if x.invested): + self.liquidate() + def get_resolution(self): return Resolution.DAILY diff --git a/Algorithm.Python/ConsolidateRegressionAlgorithm.py b/Algorithm.Python/ConsolidateRegressionAlgorithm.py index a39fdbfe3adc..aff1a04783f0 100644 --- a/Algorithm.Python/ConsolidateRegressionAlgorithm.py +++ b/Algorithm.Python/ConsolidateRegressionAlgorithm.py @@ -25,7 +25,7 @@ def initialize(self): self.set_end_date(2020, 1, 20) SP500 = Symbol.create(Futures.Indices.SP_500_E_MINI, SecurityType.FUTURE, Market.CME) - symbol = self.future_chain_provider.get_future_contract_list(SP500, self.start_date)[0] + symbol = list(self.futures_chain(SP500))[0] self._future = self.add_future_contract(symbol) tradable_dates_count = len(list(Time.each_tradeable_day_in_time_zone(self._future.exchange.hours, diff --git a/Algorithm.Python/FutureOptionChainFullDataRegressionAlgorithm.py b/Algorithm.Python/FutureOptionChainFullDataRegressionAlgorithm.py new file mode 100644 index 000000000000..147a908d377e --- /dev/null +++ b/Algorithm.Python/FutureOptionChainFullDataRegressionAlgorithm.py @@ -0,0 +1,46 @@ +# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. +# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from AlgorithmImports import * + +### +### Regression algorithm illustrating the usage of the method +### to get a future option chain. +### +class FutureOptionChainFullDataRegressionAlgorithm(QCAlgorithm): + + def initialize(self): + self.set_start_date(2020, 1, 6) + self.set_end_date(2020, 1, 6) + + future_contract = self.add_future_contract( + Symbol.create_future(Futures.Indices.SP_500_E_MINI, Market.CME, datetime(2020, 3, 20)), + Resolution.MINUTE).symbol + + option_chain = self.option_chain(future_contract, flatten=True) + + # Demonstration using data frame: + df = option_chain.data_frame + # Get contracts expiring within 4 months, with the latest expiration date, highest strike and lowest price + contracts = df.loc[(df.expiry <= self.time + timedelta(days=120))] + contracts = contracts.sort_values(['expiry', 'strike', 'lastprice'], ascending=[False, False, True]) + self._option_contract = contracts.index[0] + + self.add_future_option_contract(self._option_contract) + + def on_data(self, data): + # Do some trading with the selected contract for sample purposes + if not self.portfolio.invested: + self.set_holdings(self._option_contract, 0.5) + else: + self.liquidate() diff --git a/Algorithm.Python/FutureOptionChainsMultipleFullDataRegressionAlgorithm.py b/Algorithm.Python/FutureOptionChainsMultipleFullDataRegressionAlgorithm.py new file mode 100644 index 000000000000..21f083d57343 --- /dev/null +++ b/Algorithm.Python/FutureOptionChainsMultipleFullDataRegressionAlgorithm.py @@ -0,0 +1,62 @@ +# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. +# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from AlgorithmImports import * + +### +### Regression algorithm illustrating the usage of the method +### to get multiple future option chains. +### +class FutureOptionChainsMultipleFullDataRegressionAlgorithm(QCAlgorithm): + + def initialize(self): + self.set_start_date(2020, 1, 6) + self.set_end_date(2020, 1, 6) + + es_future_contract = self.add_future_contract( + Symbol.create_future(Futures.Indices.SP_500_E_MINI, Market.CME, datetime(2020, 3, 20)), + Resolution.MINUTE).symbol + + gc_future_contract = self.add_future_contract( + Symbol.create_future(Futures.Metals.GOLD, Market.COMEX, datetime(2020, 4, 28)), + Resolution.MINUTE).symbol + + chains = self.option_chains([es_future_contract, gc_future_contract], flatten=True) + + self._es_option_contract = self.get_contract(chains, es_future_contract) + self._gc_option_contract = self.get_contract(chains, gc_future_contract) + + self.add_future_option_contract(self._es_option_contract) + self.add_future_option_contract(self._gc_option_contract) + + def get_contract(self, chains: OptionChains, underlying: Symbol) -> Symbol: + df = chains.data_frame + + # Index by the requested underlying, by getting all data with canonicals which underlying is the requested underlying symbol: + canonicals = df.index.get_level_values('canonical') + condition = [canonical for canonical in canonicals if canonical.underlying == underlying] + contracts = df.loc[condition] + + # Get contracts expiring within 4 months, with the latest expiration date, highest strike and lowest price + contracts = contracts.loc[(df.expiry <= self.time + timedelta(days=120))] + contracts = contracts.sort_values(['expiry', 'strike', 'lastprice'], ascending=[False, False, True]) + + return contracts.index[0][1] + + def on_data(self, data): + # Do some trading with the selected contract for sample purposes + if not self.portfolio.invested: + self.set_holdings(self._es_option_contract, 0.25) + self.set_holdings(self._gc_option_contract, 0.25) + else: + self.liquidate() diff --git a/Algorithm.Python/FutureStopMarketOrderOnExtendedHoursRegressionAlgorithm.py b/Algorithm.Python/FutureStopMarketOrderOnExtendedHoursRegressionAlgorithm.py index 21f2cc11d11d..3ddb45b1ca26 100644 --- a/Algorithm.Python/FutureStopMarketOrderOnExtendedHoursRegressionAlgorithm.py +++ b/Algorithm.Python/FutureStopMarketOrderOnExtendedHoursRegressionAlgorithm.py @@ -36,6 +36,10 @@ def initialize(self): # This method is opened 2 new orders by scheduler def make_market_and_stop_market_order(self): + # Don't place orders at the end of the last date, the market-on-stop order won't have time to fill + if self.time.date() == self.end_date.date() - timedelta(days=1): + return + self.market_order(self.sp_500_e_mini.mapped, 1) self.stop_market_ticket = self.stop_market_order(self.sp_500_e_mini.mapped, -1, self.sp_500_e_mini.price * 1.1) diff --git a/Algorithm.Python/FutureUniverseHistoryRegressionAlgorithm.py b/Algorithm.Python/FutureUniverseHistoryRegressionAlgorithm.py new file mode 100644 index 000000000000..a3ac91abb39b --- /dev/null +++ b/Algorithm.Python/FutureUniverseHistoryRegressionAlgorithm.py @@ -0,0 +1,50 @@ +# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. +# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from AlgorithmImports import * + +### +### Regression algorithm testing history requests for type work as expected +### and return the same data as the futures chain provider. +### +class OptionUniverseHistoryRegressionAlgorithm(QCAlgorithm): + + def initialize(self): + self.set_start_date(2013, 10, 11) + self.set_end_date(2013, 10, 11) + + future = self.add_future(Futures.Indices.SP_500_E_MINI).symbol + + historical_futures_data_df = self.history(FutureUniverse, future, 3, flatten=True) + + # Level 0 of the multi-index is the date, we expect 3 dates, 3 future chains + if historical_futures_data_df.index.levshape[0] != 3: + raise RegressionTestException(f"Expected 3 futures chains from history request, " + f"but got {historical_futures_data_df.index.levshape[1]}") + + for date in historical_futures_data_df.index.levels[0]: + expected_chain = list(self.future_chain_provider.get_future_contract_list(future, date)) + expected_chain_count = len(expected_chain) + + actual_chain = historical_futures_data_df.loc[date] + actual_chain_count = len(actual_chain) + + if expected_chain_count != actual_chain_count: + raise RegressionTestException(f"Expected {expected_chain_count} futures in chain on {date}, " + f"but got {actual_chain_count}") + + for i, symbol in enumerate(actual_chain.index): + expected_symbol = expected_chain[i] + if symbol != expected_symbol: + raise RegressionTestException(f"Expected symbol {expected_symbol} at index " + f" {i} on {date}, but got {symbol}") diff --git a/Algorithm.Python/FuturesChainFullDataRegressionAlgorithm.py b/Algorithm.Python/FuturesChainFullDataRegressionAlgorithm.py new file mode 100644 index 000000000000..6f35e7b0c7b1 --- /dev/null +++ b/Algorithm.Python/FuturesChainFullDataRegressionAlgorithm.py @@ -0,0 +1,49 @@ +# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. +# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from AlgorithmImports import * + +### +### Regression algorithm illustrating the usage of the +### method to get a future chain. +### +class FuturesChainFullDataRegressionAlgorithm(QCAlgorithm): + + def initialize(self): + self.set_start_date(2013, 10, 7) + self.set_end_date(2013, 10, 7) + + future = self.add_future(Futures.Indices.SP_500_E_MINI, Resolution.MINUTE).symbol + + chain = self.futures_chain(future, flatten=True) + + # Demonstration using data frame: + df = chain.data_frame + + for index, row in df.iterrows(): + if row['bidprice'] == 0 and row['askprice'] == 0 and row['volume'] == 0: + raise Exception("FuturesChain() returned contract with no data."); + + # Get contracts expiring within 6 months, with the latest expiration date, and lowest price + contracts = df.loc[(df.expiry <= self.time + timedelta(days=180))] + contracts = contracts.sort_values(['expiry', 'lastprice'], ascending=[False, True]) + self._future_contract = contracts.index[0] + + self.add_future_contract(self._future_contract) + + def on_data(self, data): + # Do some trading with the selected contract for sample purposes + if not self.portfolio.invested: + self.set_holdings(self._future_contract, 0.5) + else: + self.liquidate() diff --git a/Algorithm.Python/FuturesChainsMultipleFullDataRegressionAlgorithm.py b/Algorithm.Python/FuturesChainsMultipleFullDataRegressionAlgorithm.py new file mode 100644 index 000000000000..3f1c48d7408a --- /dev/null +++ b/Algorithm.Python/FuturesChainsMultipleFullDataRegressionAlgorithm.py @@ -0,0 +1,57 @@ +# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. +# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from AlgorithmImports import * + +### +### Regression algorithm illustrating the usage of the +### method to get multiple futures chains. +### +class FuturesChainsMultipleFullDataRegressionAlgorithm(QCAlgorithm): + + def initialize(self): + self.set_start_date(2013, 10, 7) + self.set_end_date(2013, 10, 7) + + es_future = self.add_future(Futures.Indices.SP_500_E_MINI).symbol + gc_future = self.add_future(Futures.Metals.GOLD).symbol + + chains = self.futures_chains([es_future, gc_future], flatten=True) + + self._es_contract = self.get_contract(chains, es_future) + self._gc_contract = self.get_contract(chains, gc_future) + + self.add_future_contract(self._es_contract) + self.add_future_contract(self._gc_contract) + + def get_contract(self, chains: FuturesChains, canonical: Symbol) -> Symbol: + df = chains.data_frame + + # Index by the requested underlying, by getting all data with canonicals which underlying is the requested underlying symbol: + canonicals = df.index.get_level_values('canonical') + condition = [symbol for symbol in canonicals if symbol == canonical] + contracts = df.loc[condition] + + # Get contracts expiring within 6 months, with the latest expiration date, and lowest price + contracts = contracts.loc[(df.expiry <= self.time + timedelta(days=180))] + contracts = contracts.sort_values(['expiry', 'lastprice'], ascending=[False, True]) + + return contracts.index[0][1] + + def on_data(self, data): + # Do some trading with the selected contract for sample purposes + if not self.portfolio.invested: + self.set_holdings(self._es_contract, 0.25) + self.set_holdings(self._gc_contract, 0.25) + else: + self.liquidate() diff --git a/Algorithm.Python/QuantConnect.Algorithm.Python.csproj b/Algorithm.Python/QuantConnect.Algorithm.Python.csproj index 9262550227bd..9b566b925e35 100644 --- a/Algorithm.Python/QuantConnect.Algorithm.Python.csproj +++ b/Algorithm.Python/QuantConnect.Algorithm.Python.csproj @@ -43,6 +43,11 @@ + + + + + diff --git a/Algorithm/QCAlgorithm.History.cs b/Algorithm/QCAlgorithm.History.cs index 06428254e44c..50c4d5e0faa9 100644 --- a/Algorithm/QCAlgorithm.History.cs +++ b/Algorithm/QCAlgorithm.History.cs @@ -1026,7 +1026,7 @@ private IEnumerable CreateBarCountHistoryRequests(IEnumerable GetMatchingSubscriptions(Symbol symb if (symbol.IsCanonical() && configs.Count > 1) { // option/future (canonicals) might add in a ZipEntryName auxiliary data type used for selection, we filter it out from history requests by default - return configs.Where(s => s.Type != typeof(ZipEntryName)); + return configs.Where(s => !s.Type.IsAssignableTo(typeof(BaseChainUniverseData))); } return configs; } else { - resolution = GetResolution(symbol, resolution, type); + var res = GetResolution(symbol, resolution, type); // If type was specified and not a lean data type and also not abstract, we create a new subscription if (type != null && !LeanData.IsCommonLeanDataType(type) && !type.IsAbstract) @@ -1145,7 +1145,7 @@ private IEnumerable GetMatchingSubscriptions(Symbol symb return new[] { new SubscriptionDataConfig( type, symbol, - resolution.Value, + res, entry.DataTimeZone, entry.ExchangeHours.TimeZone, UniverseSettings.FillForward, @@ -1158,18 +1158,19 @@ private IEnumerable GetMatchingSubscriptions(Symbol symb } return SubscriptionManager - .LookupSubscriptionConfigDataTypes(symbol.SecurityType, resolution.Value, symbol.IsCanonical()) + .LookupSubscriptionConfigDataTypes(symbol.SecurityType, res, symbol.IsCanonical()) .Where(tuple => SubscriptionDataConfigTypeFilter(type, tuple.Item1)) .Select(x => { var configType = x.Item1; // Use the config type to get an accurate mhdb entry var entry = MarketHoursDatabase.GetEntry(symbol, new[] { configType }); + var res = GetResolution(symbol, resolution, configType); return new SubscriptionDataConfig( configType, symbol, - resolution.Value, + res, entry.DataTimeZone, entry.ExchangeHours.TimeZone, UniverseSettings.FillForward, @@ -1288,6 +1289,7 @@ private bool HistoryRequestValid(Symbol symbol) return symbol.SecurityType == SecurityType.Future || symbol.SecurityType == SecurityType.Option || symbol.SecurityType == SecurityType.IndexOption || + symbol.SecurityType == SecurityType.FutureOption || !symbol.IsCanonical(); } diff --git a/Algorithm/QCAlgorithm.cs b/Algorithm/QCAlgorithm.cs index 0224eb60d098..ae4fe805c224 100644 --- a/Algorithm/QCAlgorithm.cs +++ b/Algorithm/QCAlgorithm.cs @@ -475,7 +475,7 @@ public IAlgorithmSettings Settings /// [DocumentationAttribute(AddingData)] [Obsolete("OptionChainProvider property is will soon be deprecated. " + - "The new OptionChain() method should be used to fetch equity and index option chains, " + + "The new OptionChain() method should be used to fetch option chains, " + "which will contain additional data per contract, like daily price data, implied volatility and greeks.")] public IOptionChainProvider OptionChainProvider { get; private set; } @@ -483,6 +483,9 @@ public IAlgorithmSettings Settings /// Gets the future chain provider, used to get the list of future contracts for an underlying symbol /// [DocumentationAttribute(AddingData)] + [Obsolete("FutureChainProvider property is will soon be deprecated. " + + "The new FuturesChain() method should be used to fetch futures chains, " + + "which will contain additional data per contract, like daily price data.")] public IFutureChainProvider FutureChainProvider { get; private set; } /// @@ -1937,9 +1940,9 @@ public Security AddSecurity(Symbol symbol, Resolution? resolution = null, bool f var securityResolution = resolution; var securityFillForward = fillForward; - if (isCanonical && symbol.SecurityType.IsOption() && symbol.SecurityType != SecurityType.FutureOption) + if (isCanonical) { - // option is daily only, for now exclude FOPs + // canonical options and futures are daily only securityResolution = Resolution.Daily; securityFillForward = false; } @@ -1980,11 +1983,7 @@ public Security AddSecurity(Symbol symbol, Resolution? resolution = null, bool f if (!UniverseManager.ContainsKey(symbol)) { var canonicalConfig = configs.First(); - var universeSettingsResolution = canonicalConfig.Resolution; - if (symbol.SecurityType.IsOption()) - { - universeSettingsResolution = resolution ?? UniverseSettings.Resolution; - } + var universeSettingsResolution = resolution ?? UniverseSettings.Resolution; var settings = new UniverseSettings(universeSettingsResolution, leverage, fillForward, extendedMarketHours, UniverseSettings.MinimumTimeInUniverse) { Asynchronous = UniverseSettings.Asynchronous @@ -3325,6 +3324,7 @@ public List Fundamentals(List symbols) /// /// As of 2024/09/11, future options chain will not contain any additional data (e.g. daily price data, implied volatility and greeks), /// it will be populated with the contract symbol only. This is expected to change in the future. + /// As of 2024/12/18, future options data will contain daily price data but not implied volatility and greeks. /// [DocumentationAttribute(AddingData)] public OptionChain OptionChain(Symbol symbol, bool flatten = false) @@ -3349,27 +3349,12 @@ public OptionChain OptionChain(Symbol symbol, bool flatten = false) public OptionChains OptionChains(IEnumerable symbols, bool flatten = false) { var canonicalSymbols = symbols.Select(GetCanonicalOptionSymbol).ToList(); - var optionCanonicalSymbols = canonicalSymbols.Where(x => x.SecurityType != SecurityType.FutureOption); - var futureOptionCanonicalSymbols = canonicalSymbols.Where(x => x.SecurityType == SecurityType.FutureOption); - - var optionChainsData = History(optionCanonicalSymbols, 1).GetUniverseData() + var optionChainsData = History(canonicalSymbols, 1).GetUniverseData() .Select(x => (x.Keys.Single(), x.Values.Single().Cast())); - // TODO: For FOPs, we fall back to the option chain provider until OptionUniverse supports them - var futureOptionChainsData = futureOptionCanonicalSymbols.Select(symbol => - { - var optionChainData = OptionChainProvider.GetOptionContractList(symbol, Time) - .Select(contractSymbol => new OptionUniverse() - { - Symbol = contractSymbol, - EndTime = Time.Date, - }); - return (symbol, optionChainData); - }); - var time = Time.Date; var chains = new OptionChains(time, flatten); - foreach (var (symbol, contracts) in optionChainsData.Concat(futureOptionChainsData)) + foreach (var (symbol, contracts) in optionChainsData) { var symbolProperties = SymbolPropertiesDatabase.GetSymbolProperties(symbol.ID.Market, symbol, symbol.SecurityType, AccountCurrency); var optionChain = new OptionChain(symbol, time, contracts, symbolProperties, flatten); @@ -3379,6 +3364,59 @@ public OptionChains OptionChains(IEnumerable symbols, bool flatten = fal return chains; } + /// + /// Get the futures chain for the specified symbol at the current time () + /// + /// + /// The symbol for which the futures chain is asked for. + /// It can be either the canonical future, a contract or an option symbol. + /// + /// + /// Whether to flatten the resulting data frame. Used from Python when accessing . + /// See + /// + /// The futures chain + [DocumentationAttribute(AddingData)] + public FuturesChain FuturesChain(Symbol symbol, bool flatten = false) + { + return FuturesChains(new[] { symbol }, flatten).Values.SingleOrDefault() ?? + new FuturesChain(GetCanonicalFutureSymbol(symbol), Time.Date); + } + + /// + /// Get the futures chains for the specified symbols at the current time () + /// + /// + /// The symbols for which the futures chains are asked for. + /// It can be either the canonical future, a contract or an option symbol. + /// + /// + /// Whether to flatten the resulting data frame. Used from Python when accessing . + /// See + /// + /// The futures chains + [DocumentationAttribute(AddingData)] + public FuturesChains FuturesChains(IEnumerable symbols, bool flatten = false) + { + var canonicalSymbols = symbols.Select(GetCanonicalFutureSymbol).ToList(); + var futureChainsData = History(canonicalSymbols, 1) + .SelectMany(dict => dict.Select(kvp => (kvp.Key, kvp.Value.Cast()))); + + var time = Time.Date; + var chains = new FuturesChains(time, flatten); + + if (futureChainsData != null) + { + foreach (var (symbol, contracts) in futureChainsData) + { + var chain = new FuturesChain(symbol, time, contracts.Cast(), flatten); + chains.Add(symbol, chain); + } + } + + return chains; + } + /// /// Get an authenticated link to execute the given command instance /// @@ -3505,6 +3543,22 @@ private static Symbol GetCanonicalOptionSymbol(Symbol symbol) throw new ArgumentException($"The symbol {symbol} is not an option or an underlying symbol."); } + private static Symbol GetCanonicalFutureSymbol(Symbol symbol) + { + // We got either a contract or the canonical itself + if (symbol.SecurityType == SecurityType.Future) + { + return symbol.Canonical; + } + + if (symbol.SecurityType == SecurityType.FutureOption) + { + return symbol.Underlying.Canonical; + } + + throw new ArgumentException($"The symbol {symbol} is neither a future nor a future option symbol."); + } + /// /// Set the properties and exchange hours for a given key into our databases /// diff --git a/Common/Data/Auxiliary/ZipEntryName.cs b/Common/Data/Auxiliary/ZipEntryName.cs deleted file mode 100644 index cd2abbff1e75..000000000000 --- a/Common/Data/Auxiliary/ZipEntryName.cs +++ /dev/null @@ -1,98 +0,0 @@ -/* - * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. - * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ - -using System; -using QuantConnect.Util; - -namespace QuantConnect.Data.Auxiliary -{ - /// - /// Defines a data type that just produces data points from the zip entry names in a zip file - /// - public class ZipEntryName : BaseData - { - private DateTime _endTime; - - /// - /// Initializes a new instance of the class - /// - public ZipEntryName() - { - DataType = MarketDataType.Auxiliary; - } - - /// - /// Gets or sets the end time of this data - /// - public override DateTime EndTime - { - get - { - if (_endTime == default) - { - // to be user friendly let's return Time if not set, like BaseData does - return Time; - } - return _endTime; - } - set - { - _endTime = value; - } - } - - /// - /// Indicates whether this contains data that should be stored in the security cache - /// - /// Whether this contains data that should be stored in the security cache - public override bool ShouldCacheToSecurity() - { - return false; - } - - /// - /// Reader converts each line of the data source into BaseData objects. Each data type creates its own factory method, and returns a new instance of the object - /// each time it is called. The returned object is assumed to be time stamped in the config.ExchangeTimeZone. - /// - /// Subscription data config setup object - /// Line of the source document - /// Date of the requested data - /// true if we're in live mode, false for backtesting mode - /// Instance of the T:BaseData object generated by this line of the CSV - public override BaseData Reader(SubscriptionDataConfig config, string line, DateTime date, bool isLiveMode) - { - var symbol = LeanData.ReadSymbolFromZipEntry(config.Symbol, config.Resolution, line); - return new ZipEntryName {Time = date, Symbol = symbol}; - } - - /// - /// Return the URL string source of the file. This will be converted to a stream - /// - /// Configuration object - /// Date of this source file - /// true if we're in live mode, false for backtesting mode - /// String URL of source file. - public override SubscriptionDataSource GetSource(SubscriptionDataConfig config, DateTime date, bool isLiveMode) - { - if (isLiveMode) - { - return new SubscriptionDataSource(string.Empty, SubscriptionTransportMedium.LocalFile); - } - - var source = LeanData.GenerateZipFilePath(Globals.DataFolder, config.Symbol, date, config.Resolution, config.TickType); - return new SubscriptionDataSource(source, SubscriptionTransportMedium.LocalFile, FileFormat.ZipEntryName); - } - } -} diff --git a/Common/Data/Market/BaseChain.cs b/Common/Data/Market/BaseChain.cs new file mode 100644 index 000000000000..937b1411dbbd --- /dev/null +++ b/Common/Data/Market/BaseChain.cs @@ -0,0 +1,315 @@ +/* + * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. + * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Python.Runtime; +using QuantConnect.Python; +using QuantConnect.Securities.Option; +using QuantConnect.Util; + +namespace QuantConnect.Data.Market +{ + /// + /// Base representation of an entire chain of contracts for a single underlying security. + /// This type is where T is , , etc. + /// + public class BaseChain : BaseData, IEnumerable + where T : BaseContract + where TContractsCollection : DataDictionary, new() + { + private Dictionary>> _auxiliaryData; + private readonly Lazy _dataframe; + private readonly bool _flatten; + + private Dictionary>> AuxiliaryData + { + get + { + if (_auxiliaryData == null) + { + _auxiliaryData = new Dictionary>>(); + } + + return _auxiliaryData; + } + } + + /// + /// Gets the most recent trade information for the underlying. This may + /// be a or a + /// + [PandasIgnore] + public BaseData Underlying + { + get; internal set; + } + + /// + /// Gets all ticks for every option contract in this chain, keyed by option symbol + /// + [PandasIgnore] + public Ticks Ticks + { + get; protected set; + } + + /// + /// Gets all trade bars for every option contract in this chain, keyed by option symbol + /// + [PandasIgnore] + public TradeBars TradeBars + { + get; protected set; + } + + /// + /// Gets all quote bars for every option contract in this chain, keyed by option symbol + /// + [PandasIgnore] + public QuoteBars QuoteBars + { + get; protected set; + } + + /// + /// Gets all contracts in the chain, keyed by option symbol + /// + public TContractsCollection Contracts + { + get; private set; + } + + /// + /// Gets the set of symbols that passed the + /// + [PandasIgnore] + public HashSet FilteredContracts + { + get; protected set; + } + + /// + /// The data frame representation of the option chain + /// + [PandasIgnore] + public PyObject DataFrame => _dataframe.Value; + + /// + /// Initializes a new default instance of the class + /// + protected BaseChain(MarketDataType dataType, bool flatten) + { + DataType = dataType; + _flatten = flatten; + _dataframe = new Lazy( + () => + { + if (!PythonEngine.IsInitialized) + { + return null; + } + return new PandasConverter().GetDataFrame(new[] { this }, symbolOnlyIndex: true, flatten: _flatten); + }, + isThreadSafe: false); + } + + /// + /// Initializes a new instance of the class + /// + /// The symbol for this chain. + /// The time of this chain + /// Whether to flatten the data frame + protected BaseChain(Symbol canonicalOptionSymbol, DateTime time, MarketDataType dataType, bool flatten = true) + : this(dataType, flatten) + { + Time = time; + Symbol = canonicalOptionSymbol; + Ticks = new Ticks(time); + TradeBars = new TradeBars(time); + QuoteBars = new QuoteBars(time); + FilteredContracts = new HashSet(); + Underlying = new QuoteBar(); + Contracts = new(); + Contracts.Time = time; + } + + /// + /// Initializes a new instance of the class as a copy of the specified chain + /// + protected BaseChain(BaseChain other) + : this(other.DataType, other._flatten) + { + Symbol = other.Symbol; + Time = other.Time; + Value = other.Value; + Underlying = other.Underlying; + Ticks = other.Ticks; + QuoteBars = other.QuoteBars; + TradeBars = other.TradeBars; + Contracts = other.Contracts; + FilteredContracts = other.FilteredContracts; + } + + /// + /// Gets the auxiliary data with the specified type and symbol + /// + /// The type of auxiliary data + /// The symbol of the auxiliary data + /// The last auxiliary data with the specified type and symbol + public TAux GetAux(Symbol symbol) + { + List list; + Dictionary> dictionary; + if (!AuxiliaryData.TryGetValue(typeof(TAux), out dictionary) || !dictionary.TryGetValue(symbol, out list)) + { + return default; + } + return list.OfType().LastOrDefault(); + } + + /// + /// Gets all auxiliary data of the specified type as a dictionary keyed by symbol + /// + /// The type of auxiliary data + /// A dictionary containing all auxiliary data of the specified type + public DataDictionary GetAux() + { + Dictionary> d; + if (!AuxiliaryData.TryGetValue(typeof(TAux), out d)) + { + return new DataDictionary(); + } + var dictionary = new DataDictionary(); + foreach (var kvp in d) + { + var item = kvp.Value.OfType().LastOrDefault(); + if (item != null) + { + dictionary.Add(kvp.Key, item); + } + } + return dictionary; + } + + /// + /// Gets all auxiliary data of the specified type as a dictionary keyed by symbol + /// + /// The type of auxiliary data + /// A dictionary containing all auxiliary data of the specified type + public Dictionary> GetAuxList() + { + Dictionary> dictionary; + if (!AuxiliaryData.TryGetValue(typeof(TAux), out dictionary)) + { + return new Dictionary>(); + } + return dictionary; + } + + /// + /// Gets a list of auxiliary data with the specified type and symbol + /// + /// The type of auxiliary data + /// The symbol of the auxiliary data + /// The list of auxiliary data with the specified type and symbol + public List GetAuxList(Symbol symbol) + { + List list; + Dictionary> dictionary; + if (!AuxiliaryData.TryGetValue(typeof(TAux), out dictionary) || !dictionary.TryGetValue(symbol, out list)) + { + return new List(); + } + return list.OfType().ToList(); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// + /// An enumerator that can be used to iterate through the collection. + /// + public IEnumerator GetEnumerator() + { + return Contracts.Values.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through a collection. + /// + /// + /// An object that can be used to iterate through the collection. + /// + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + /// + /// Adds the specified data to this chain + /// + /// The data to be added + internal void AddData(BaseData data) + { + switch (data) + { + case Tick tick: + Ticks.Add(tick.Symbol, tick); + break; + + case TradeBar tradeBar: + TradeBars[tradeBar.Symbol] = tradeBar; + break; + + case QuoteBar quoteBar: + QuoteBars[quoteBar.Symbol] = quoteBar; + break; + + default: + if (data.DataType == MarketDataType.Base) + { + AddAuxData(data); + } + break; + } + } + + /// + /// Adds the specified auxiliary data to this option chain + /// + /// The auxiliary data to be added + private void AddAuxData(BaseData baseData) + { + var type = baseData.GetType(); + Dictionary> dictionary; + if (!AuxiliaryData.TryGetValue(type, out dictionary)) + { + dictionary = new Dictionary>(); + AuxiliaryData[type] = dictionary; + } + + List list; + if (!dictionary.TryGetValue(baseData.Symbol, out list)) + { + list = new List(); + dictionary[baseData.Symbol] = list; + } + list.Add(baseData); + } + } +} diff --git a/Common/Data/Market/BaseChains.cs b/Common/Data/Market/BaseChains.cs new file mode 100644 index 000000000000..e90ec134c492 --- /dev/null +++ b/Common/Data/Market/BaseChains.cs @@ -0,0 +1,87 @@ +/* + * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. + * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ + +using Python.Runtime; +using QuantConnect.Python; +using QuantConnect.Securities; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace QuantConnect.Data.Market +{ + /// + /// Collection of keyed by canonical option symbol + /// + public class BaseChains : DataDictionary + where T : BaseChain + where TContract : BaseContract + where TContractsCollection : DataDictionary, new() + { + private static readonly IEnumerable _flattenedDfIndexNames = new[] { "canonical", "symbol" }; + + private readonly Lazy _dataframe; + private readonly bool _flatten; + + /// + /// The data frame representation of the option chains + /// + public PyObject DataFrame => _dataframe.Value; + + /// + /// Creates a new instance of the dictionary + /// + protected BaseChains() + : this(default, true) + { + } + + /// + /// Creates a new instance of the dictionary + /// + protected BaseChains(bool flatten) + : this(default, flatten) + { + } + + /// + /// Creates a new instance of the dictionary + /// + protected BaseChains(DateTime time, bool flatten) + : base(time) + { + _flatten = flatten; + _dataframe = new Lazy(InitializeDataFrame, isThreadSafe: false); + } + + private PyObject InitializeDataFrame() + { + if (!PythonEngine.IsInitialized) + { + return null; + } + + var dataFrames = this.Select(kvp => kvp.Value.DataFrame).ToList(); + + if (_flatten) + { + var canonicalSymbols = this.Select(kvp => kvp.Key); + return PandasConverter.ConcatDataFrames(dataFrames, keys: canonicalSymbols, names: _flattenedDfIndexNames, sort: false); + } + + return PandasConverter.ConcatDataFrames(dataFrames, sort: false); + } + } +} diff --git a/Common/Data/Market/BaseContract.cs b/Common/Data/Market/BaseContract.cs new file mode 100644 index 000000000000..9ae321f0e7d4 --- /dev/null +++ b/Common/Data/Market/BaseContract.cs @@ -0,0 +1,117 @@ +/* + * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. + * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ + +using QuantConnect.Python; +using System; + +namespace QuantConnect.Data.Market +{ + /// + /// Defines a base for a single contract, like an option or future contract + /// + public abstract class BaseContract : ISymbolProvider + { + /// + /// Gets the contract's symbol + /// + [PandasIgnore] + public Symbol Symbol + { + get; set; + } + + /// + /// The security identifier of the symbol + /// + [PandasIgnore] + public SecurityIdentifier ID => Symbol.ID; + + /// + /// Gets the underlying security's symbol + /// + public Symbol UnderlyingSymbol => Symbol.Underlying; + + /// + /// Gets the expiration date + /// + public DateTime Expiry => Symbol.ID.Date; + + /// + /// Gets the local date time this contract's data was last updated + /// + [PandasIgnore] + public DateTime Time + { + get; set; + } + + /// + /// Gets the open interest + /// + public virtual decimal OpenInterest { get; set; } + + /// + /// Gets the last price this contract traded at + /// + public virtual decimal LastPrice { get; set; } + + /// + /// Gets the last volume this contract traded at + /// + public virtual long Volume { get; set; } + + /// + /// Gets the current bid price + /// + public virtual decimal BidPrice { get; set; } + + /// + /// Get the current bid size + /// + public virtual long BidSize { get; set; } + + /// + /// Gets the ask price + /// + public virtual decimal AskPrice { get; set; } + + /// + /// Gets the current ask size + /// + public virtual long AskSize { get; set; } + + /// + /// Initializes a new instance of the class + /// + /// The contract symbol + protected BaseContract(Symbol symbol) + { + Symbol = symbol; + } + + /// + /// Returns a string that represents the current object. + /// + /// + /// A string that represents the current object. + /// + public override string ToString() => Symbol.Value; + + /// + /// Updates the contract with the new data, which can be a or or + /// + internal abstract void Update(BaseData data); + } +} diff --git a/Common/Data/Market/FuturesChain.cs b/Common/Data/Market/FuturesChain.cs index 14f10940bbdf..ef65999f40fc 100644 --- a/Common/Data/Market/FuturesChain.cs +++ b/Common/Data/Market/FuturesChain.cs @@ -14,10 +14,8 @@ */ using System; -using System.Collections; using System.Collections.Generic; -using System.Linq; -using QuantConnect.Securities.Future; +using QuantConnect.Data.UniverseSelection; namespace QuantConnect.Data.Market { @@ -25,82 +23,17 @@ namespace QuantConnect.Data.Market /// Represents an entire chain of futures contracts for a single underlying /// This type is /// - public class FuturesChain : BaseData, IEnumerable + public class FuturesChain : BaseChain { - private readonly Dictionary>> _auxiliaryData = new Dictionary>>(); - - /// - /// Gets the most recent trade information for the underlying. This may - /// be a or a - /// - public BaseData Underlying - { - get; internal set; - } - - /// - /// Gets all ticks for every futures contract in this chain, keyed by symbol - /// - public Ticks Ticks - { - get; private set; - } - - /// - /// Gets all trade bars for every futures contract in this chain, keyed by symbol - /// - public TradeBars TradeBars - { - get; private set; - } - - /// - /// Gets all quote bars for every futures contract in this chain, keyed by symbol - /// - public QuoteBars QuoteBars - { - get; private set; - } - - /// - /// Gets all contracts in the chain, keyed by symbol - /// - public FuturesContracts Contracts - { - get; private set; - } - - /// - /// Gets the set of symbols that passed the - /// - public HashSet FilteredContracts - { - get; private set; - } - - /// - /// Initializes a new default instance of the class - /// - private FuturesChain() - { - DataType = MarketDataType.FuturesChain; - } - /// /// Initializes a new instance of the class /// /// The symbol for this chain. /// The time of this chain - public FuturesChain(Symbol canonicalFutureSymbol, DateTime time) + /// Whether to flatten the data frame + public FuturesChain(Symbol canonicalFutureSymbol, DateTime time, bool flatten = true) + : base(canonicalFutureSymbol, time, MarketDataType.FuturesChain, flatten) { - Time = time; - Symbol = canonicalFutureSymbol; - DataType = MarketDataType.FuturesChain; - Ticks = new Ticks(time); - TradeBars = new TradeBars(time); - QuoteBars = new QuoteBars(time); - Contracts = new FuturesContracts(time); - FilteredContracts = new HashSet(); } /// @@ -108,163 +41,23 @@ public FuturesChain(Symbol canonicalFutureSymbol, DateTime time) /// /// The symbol for this chain. /// The time of this chain - /// All trade data for the entire futures chain - /// All quote data for the entire futures chain - /// All contracts for this futures chain - /// The filtered list of contracts for this futures chain - public FuturesChain(Symbol canonicalFutureSymbol, DateTime time, IEnumerable trades, IEnumerable quotes, IEnumerable contracts, IEnumerable filteredContracts) - { - Time = time; - Symbol = canonicalFutureSymbol; - DataType = MarketDataType.FuturesChain; - FilteredContracts = filteredContracts.ToHashSet(); - - Ticks = new Ticks(time); - TradeBars = new TradeBars(time); - QuoteBars = new QuoteBars(time); - Contracts = new FuturesContracts(time); - - foreach (var trade in trades) - { - var tick = trade as Tick; - if (tick != null) - { - List ticks; - if (!Ticks.TryGetValue(tick.Symbol, out ticks)) - { - ticks = new List(); - Ticks[tick.Symbol] = ticks; - } - ticks.Add(tick); - continue; - } - var bar = trade as TradeBar; - if (bar != null) - { - TradeBars[trade.Symbol] = bar; - } - } - - foreach (var quote in quotes) - { - var tick = quote as Tick; - if (tick != null) - { - List ticks; - if (!Ticks.TryGetValue(tick.Symbol, out ticks)) - { - ticks = new List(); - Ticks[tick.Symbol] = ticks; - } - ticks.Add(tick); - continue; - } - var bar = quote as QuoteBar; - if (bar != null) - { - QuoteBars[quote.Symbol] = bar; - } - } - - foreach (var contract in contracts) - { - Contracts[contract.Symbol] = contract; - } - } - - /// - /// Gets the auxiliary data with the specified type and symbol - /// - /// The type of auxiliary data - /// The symbol of the auxiliary data - /// The last auxiliary data with the specified type and symbol - public T GetAux(Symbol symbol) + /// The list of contracts that form this chain + /// Whether to flatten the data frame + public FuturesChain(Symbol canonicalFutureSymbol, DateTime time, IEnumerable contracts, bool flatten = true) + : this(canonicalFutureSymbol, time, flatten) { - List list; - Dictionary> dictionary; - if (!_auxiliaryData.TryGetValue(typeof(T), out dictionary) || !dictionary.TryGetValue(symbol, out list)) + foreach (var contractData in contracts) { - return default(T); + Contracts[contractData.Symbol] = new FuturesContract(contractData); } - return list.OfType().LastOrDefault(); } /// - /// Gets all auxiliary data of the specified type as a dictionary keyed by symbol + /// Initializes a new instance of the class as a clone of the specified instance /// - /// The type of auxiliary data - /// A dictionary containing all auxiliary data of the specified type - public DataDictionary GetAux() + private FuturesChain(FuturesChain other) + : base(other) { - Dictionary> d; - if (!_auxiliaryData.TryGetValue(typeof(T), out d)) - { - return new DataDictionary(); - } - var dictionary = new DataDictionary(); - foreach (var kvp in d) - { - var item = kvp.Value.OfType().LastOrDefault(); - if (item != null) - { - dictionary.Add(kvp.Key, item); - } - } - return dictionary; - } - - /// - /// Gets all auxiliary data of the specified type as a dictionary keyed by symbol - /// - /// The type of auxiliary data - /// A dictionary containing all auxiliary data of the specified type - public Dictionary> GetAuxList() - { - Dictionary> dictionary; - if (!_auxiliaryData.TryGetValue(typeof(T), out dictionary)) - { - return new Dictionary>(); - } - return dictionary; - } - - /// - /// Gets a list of auxiliary data with the specified type and symbol - /// - /// The type of auxiliary data - /// The symbol of the auxiliary data - /// The list of auxiliary data with the specified type and symbol - public List GetAuxList(Symbol symbol) - { - List list; - Dictionary> dictionary; - if (!_auxiliaryData.TryGetValue(typeof(T), out dictionary) || !dictionary.TryGetValue(symbol, out list)) - { - return new List(); - } - return list.OfType().ToList(); - } - - /// - /// Returns an enumerator that iterates through the collection. - /// - /// - /// An enumerator that can be used to iterate through the collection. - /// - public IEnumerator GetEnumerator() - { - return Contracts.Values.GetEnumerator(); - } - - /// - /// Returns an enumerator that iterates through a collection. - /// - /// - /// An object that can be used to iterate through the collection. - /// - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); } /// @@ -273,41 +66,7 @@ IEnumerator IEnumerable.GetEnumerator() /// A clone of the current object public override BaseData Clone() { - return new FuturesChain - { - Ticks = Ticks, - Contracts = Contracts, - QuoteBars = QuoteBars, - TradeBars = TradeBars, - FilteredContracts = FilteredContracts, - Symbol = Symbol, - Time = Time, - DataType = DataType, - Value = Value - }; - } - - /// - /// Adds the specified auxiliary data to this futures chain - /// - /// The auxiliary data to be added - internal void AddAuxData(BaseData baseData) - { - var type = baseData.GetType(); - Dictionary> dictionary; - if (!_auxiliaryData.TryGetValue(type, out dictionary)) - { - dictionary = new Dictionary>(); - _auxiliaryData[type] = dictionary; - } - - List list; - if (!dictionary.TryGetValue(baseData.Symbol, out list)) - { - list = new List(); - dictionary[baseData.Symbol] = list; - } - list.Add(baseData); + return new FuturesChain(this); } } -} \ No newline at end of file +} diff --git a/Common/Data/Market/FuturesChains.cs b/Common/Data/Market/FuturesChains.cs index a5cf3f9376ca..9b9e98f682b1 100644 --- a/Common/Data/Market/FuturesChains.cs +++ b/Common/Data/Market/FuturesChains.cs @@ -1,4 +1,4 @@ -/* +/* * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. * @@ -20,7 +20,7 @@ namespace QuantConnect.Data.Market /// /// Collection of keyed by canonical futures symbol /// - public class FuturesChains : DataDictionary + public class FuturesChains : BaseChains { /// /// Creates a new instance of the dictionary @@ -32,29 +32,17 @@ public FuturesChains() /// /// Creates a new instance of the dictionary /// - public FuturesChains(DateTime time) - : base(time) + public FuturesChains(bool flatten) + : base(flatten) { } /// - /// Gets or sets the FuturesChain with the specified ticker. - /// - /// - /// The FuturesChain with the specified ticker. - /// - /// The ticker of the element to get or set. - /// Wraps the base implementation to enable indexing in python algorithms due to pythonnet limitations - public new FuturesChain this[string ticker] { get { return base[ticker]; } set { base[ticker] = value; } } - - /// - /// Gets or sets the FuturesChain with the specified Symbol. + /// Creates a new instance of the dictionary /// - /// - /// The FuturesChain with the specified Symbol. - /// - /// The Symbol of the element to get or set. - /// Wraps the base implementation to enable indexing in python algorithms due to pythonnet limitations - public new FuturesChain this[Symbol symbol] { get { return base[symbol]; } set { base[symbol] = value; } } + public FuturesChains(DateTime time, bool flatten = true) + : base(time, flatten) + { + } } -} \ No newline at end of file +} diff --git a/Common/Data/Market/FuturesContract.cs b/Common/Data/Market/FuturesContract.cs index 6972fbdc5c98..8bf0e11bfbaa 100644 --- a/Common/Data/Market/FuturesContract.cs +++ b/Common/Data/Market/FuturesContract.cs @@ -1,4 +1,4 @@ -/* +/* * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. * @@ -13,117 +13,216 @@ * limitations under the License. */ -using System; +using QuantConnect.Data.UniverseSelection; namespace QuantConnect.Data.Market { /// /// Defines a single futures contract at a specific expiration /// - public class FuturesContract + public class FuturesContract : BaseContract { + private FutureUniverse _universeData; + private TradeBar _tradeBar; + private QuoteBar _quoteBar; + private Tick _tradeTick; + private Tick _quoteTick; + private Tick _openInterest; + /// - /// Gets the futures contract's symbol + /// Gets the open interest /// - public Symbol Symbol + public override decimal OpenInterest { - get; private set; + get + { + // Contract universe data is prioritized + if (_universeData != null) + { + return _universeData.OpenInterest; + } + return _openInterest?.Value ?? decimal.Zero; + } } /// - /// Gets the underlying security's symbol + /// Gets the last price this contract traded at /// - public Symbol UnderlyingSymbol + public override decimal LastPrice { - get; private set; - } + get + { + if (_universeData != null) + { + return _universeData.Close; + } - /// - /// Gets the expiration date - /// - public DateTime Expiry => Symbol.ID.Date; + if (_tradeBar == null && _tradeTick == null) + { + return decimal.Zero; + } + if (_tradeBar != null) + { + return _tradeTick != null && _tradeTick.EndTime > _tradeBar.EndTime ? _tradeTick.Price : _tradeBar.Close; + } + return _tradeTick.Price; + } + } /// - /// Gets the local date time this contract's data was last updated + /// Gets the last volume this contract traded at /// - public DateTime Time + public override long Volume { - get; set; + get + { + if (_universeData != null) + { + return (long)_universeData.Volume; + } + return (long)(_tradeBar?.Volume ?? 0); + } } /// - /// Gets the open interest + /// Get the current bid price /// - public decimal OpenInterest + public override decimal BidPrice { - get; set; + get + { + if (_universeData != null) + { + return _universeData.Close; + } + if (_quoteBar == null && _quoteTick == null) + { + return decimal.Zero; + } + if (_quoteBar != null) + { + return _quoteTick != null && _quoteTick.EndTime > _quoteBar.EndTime ? _quoteTick.BidPrice : _quoteBar.Bid.Close; + } + return _quoteTick.BidPrice; + } } /// - /// Gets the last price this contract traded at + /// Get the current bid size /// - public decimal LastPrice + public override long BidSize { - get; set; + get + { + if (_quoteBar == null && _quoteTick == null) + { + return 0; + } + if (_quoteBar != null) + { + return (long)(_quoteTick != null && _quoteTick.EndTime > _quoteBar.EndTime ? _quoteTick.BidSize : _quoteBar.LastBidSize); + } + return (long)_quoteTick.BidSize; + } } /// - /// Gets the last volume this contract traded at + /// Gets the current ask price /// - public long Volume + public override decimal AskPrice { - get; set; + get + { + if (_universeData != null) + { + return _universeData.Close; + } + if (_quoteBar == null && _quoteTick == null) + { + return decimal.Zero; + } + if (_quoteBar != null) + { + return _quoteTick != null && _quoteTick.EndTime > _quoteBar.EndTime ? _quoteTick.AskPrice : _quoteBar.Ask.Close; + } + return _quoteTick.AskPrice; + } } /// - /// Gets the current bid price + /// Get the current ask size /// - public decimal BidPrice + public override long AskSize { - get; set; + get + { + if (_quoteBar == null && _quoteTick == null) + { + return 0; + } + if (_quoteBar != null) + { + return (long)(_quoteTick != null && _quoteTick.EndTime > _quoteBar.EndTime ? _quoteTick.AskSize : _quoteBar.LastAskSize); + } + return (long)_quoteTick.AskSize; + } } /// - /// Get the current bid size + /// Initializes a new instance of the class /// - public long BidSize + /// The futures contract symbol + public FuturesContract(Symbol symbol) + : base(symbol) { - get; set; } /// - /// Gets the ask price + /// Initializes a new instance of the class /// - public decimal AskPrice + /// The contract universe data + public FuturesContract(FutureUniverse contractData) + : base(contractData.Symbol) { - get; set; + _universeData = contractData; } /// - /// Gets the current ask size + /// Implicit conversion into /// - public long AskSize + /// The option contract to be converted + public static implicit operator Symbol(FuturesContract contract) { - get; set; + return contract.Symbol; } /// - /// Initializes a new instance of the class + /// Updates the future contract with the new data, which can be a or or /// - /// The futures contract symbol - /// The symbol of the underlying security - public FuturesContract(Symbol symbol, Symbol underlyingSymbol) + internal override void Update(BaseData data) { - Symbol = symbol; - UnderlyingSymbol = underlyingSymbol; - } + switch (data) + { + case TradeBar tradeBar: + _tradeBar = tradeBar; + break; - /// - /// Returns a string that represents the current object. - /// - /// - /// A string that represents the current object. - /// - public override string ToString() => Symbol.Value; + case QuoteBar quoteBar: + _quoteBar = quoteBar; + break; + + case Tick tick when tick.TickType == TickType.Trade: + _tradeTick = tick; + break; + + case Tick tick when tick.TickType == TickType.Quote: + _quoteTick = tick; + break; + + case Tick tick when tick.TickType == TickType.OpenInterest: + _openInterest = tick; + break; + } + } } } diff --git a/Common/Data/Market/OptionChain.cs b/Common/Data/Market/OptionChain.cs index 3bd9cef7cce7..6b115622f43e 100644 --- a/Common/Data/Market/OptionChain.cs +++ b/Common/Data/Market/OptionChain.cs @@ -14,107 +14,18 @@ */ using System; -using System.Collections; using System.Collections.Generic; -using System.Linq; -using Python.Runtime; using QuantConnect.Data.UniverseSelection; -using QuantConnect.Python; using QuantConnect.Securities; -using QuantConnect.Securities.Option; -using QuantConnect.Util; namespace QuantConnect.Data.Market { /// - /// Represents an entire chain of option contracts for a single underying security. + /// Represents an entire chain of option contracts for a single underlying security. /// This type is /// - public class OptionChain : BaseData, IEnumerable + public class OptionChain : BaseChain { - private readonly Dictionary>> _auxiliaryData = new Dictionary>>(); - private readonly Lazy _dataframe; - private readonly bool _flatten; - - /// - /// Gets the most recent trade information for the underlying. This may - /// be a or a - /// - [PandasIgnore] - public BaseData Underlying - { - get; internal set; - } - - /// - /// Gets all ticks for every option contract in this chain, keyed by option symbol - /// - [PandasIgnore] - public Ticks Ticks - { - get; private set; - } - - /// - /// Gets all trade bars for every option contract in this chain, keyed by option symbol - /// - [PandasIgnore] - public TradeBars TradeBars - { - get; private set; - } - - /// - /// Gets all quote bars for every option contract in this chain, keyed by option symbol - /// - [PandasIgnore] - public QuoteBars QuoteBars - { - get; private set; - } - - /// - /// Gets all contracts in the chain, keyed by option symbol - /// - public OptionContracts Contracts - { - get; private set; - } - - /// - /// Gets the set of symbols that passed the - /// - [PandasIgnore] - public HashSet FilteredContracts - { - get; private set; - } - - /// - /// The data frame representation of the option chain - /// - [PandasIgnore] - public PyObject DataFrame => _dataframe.Value; - - /// - /// Initializes a new default instance of the class - /// - private OptionChain(bool flatten) - { - DataType = MarketDataType.OptionChain; - _flatten = flatten; - _dataframe = new Lazy( - () => - { - if (!PythonEngine.IsInitialized) - { - return null; - } - return new PandasConverter().GetDataFrame(new[] { this }, symbolOnlyIndex: true, flatten: _flatten); - }, - isThreadSafe: false); - } - /// /// Initializes a new instance of the class /// @@ -122,91 +33,8 @@ private OptionChain(bool flatten) /// The time of this chain /// Whether to flatten the data frame public OptionChain(Symbol canonicalOptionSymbol, DateTime time, bool flatten = true) - : this(flatten) - { - Time = time; - Symbol = canonicalOptionSymbol; - DataType = MarketDataType.OptionChain; - Ticks = new Ticks(time); - TradeBars = new TradeBars(time); - QuoteBars = new QuoteBars(time); - Contracts = new OptionContracts(time); - FilteredContracts = new HashSet(); - Underlying = new QuoteBar(); - } - - /// - /// Initializes a new instance of the class - /// - /// The symbol for this chain. - /// The time of this chain - /// The most recent underlying trade data - /// All trade data for the entire option chain - /// All quote data for the entire option chain - /// All contracts for this option chain - /// The filtered list of contracts for this option chain - /// Whether to flatten the data frame - public OptionChain(Symbol canonicalOptionSymbol, DateTime time, BaseData underlying, IEnumerable trades, - IEnumerable quotes, IEnumerable contracts, IEnumerable filteredContracts, bool flatten = true) - : this(flatten) + : base(canonicalOptionSymbol, time, MarketDataType.OptionChain, flatten) { - Time = time; - Underlying = underlying; - Symbol = canonicalOptionSymbol; - DataType = MarketDataType.OptionChain; - FilteredContracts = filteredContracts.ToHashSet(); - - Ticks = new Ticks(time); - TradeBars = new TradeBars(time); - QuoteBars = new QuoteBars(time); - Contracts = new OptionContracts(time); - - foreach (var trade in trades) - { - var tick = trade as Tick; - if (tick != null) - { - List ticks; - if (!Ticks.TryGetValue(tick.Symbol, out ticks)) - { - ticks = new List(); - Ticks[tick.Symbol] = ticks; - } - ticks.Add(tick); - continue; - } - var bar = trade as TradeBar; - if (bar != null) - { - TradeBars[trade.Symbol] = bar; - } - } - - foreach (var quote in quotes) - { - var tick = quote as Tick; - if (tick != null) - { - List ticks; - if (!Ticks.TryGetValue(tick.Symbol, out ticks)) - { - ticks = new List(); - Ticks[tick.Symbol] = ticks; - } - ticks.Add(tick); - continue; - } - var bar = quote as QuoteBar; - if (bar != null) - { - QuoteBars[quote.Symbol] = bar; - } - } - - foreach (var contract in contracts) - { - Contracts[contract.Symbol] = contract; - } } /// @@ -221,15 +49,6 @@ public OptionChain(Symbol canonicalOptionSymbol, DateTime time, IEnumerable - /// Gets the auxiliary data with the specified type and symbol + /// Initializes a new instance of the class as a clone of the specified instance /// - /// The type of auxiliary data - /// The symbol of the auxiliary data - /// The last auxiliary data with the specified type and symbol - public T GetAux(Symbol symbol) + private OptionChain(OptionChain other) + : base(other) { - List list; - Dictionary> dictionary; - if (!_auxiliaryData.TryGetValue(typeof(T), out dictionary) || !dictionary.TryGetValue(symbol, out list)) - { - return default(T); - } - return list.OfType().LastOrDefault(); - } - - /// - /// Gets all auxiliary data of the specified type as a dictionary keyed by symbol - /// - /// The type of auxiliary data - /// A dictionary containing all auxiliary data of the specified type - public DataDictionary GetAux() - { - Dictionary> d; - if (!_auxiliaryData.TryGetValue(typeof(T), out d)) - { - return new DataDictionary(); - } - var dictionary = new DataDictionary(); - foreach (var kvp in d) - { - var item = kvp.Value.OfType().LastOrDefault(); - if (item != null) - { - dictionary.Add(kvp.Key, item); - } - } - return dictionary; - } - - /// - /// Gets all auxiliary data of the specified type as a dictionary keyed by symbol - /// - /// The type of auxiliary data - /// A dictionary containing all auxiliary data of the specified type - public Dictionary> GetAuxList() - { - Dictionary> dictionary; - if (!_auxiliaryData.TryGetValue(typeof(T), out dictionary)) - { - return new Dictionary>(); - } - return dictionary; - } - - /// - /// Gets a list of auxiliary data with the specified type and symbol - /// - /// The type of auxiliary data - /// The symbol of the auxiliary data - /// The list of auxiliary data with the specified type and symbol - public List GetAuxList(Symbol symbol) - { - List list; - Dictionary> dictionary; - if (!_auxiliaryData.TryGetValue(typeof(T), out dictionary) || !dictionary.TryGetValue(symbol, out list)) - { - return new List(); - } - return list.OfType().ToList(); - } - - /// - /// Returns an enumerator that iterates through the collection. - /// - /// - /// An enumerator that can be used to iterate through the collection. - /// - public IEnumerator GetEnumerator() - { - return Contracts.Values.GetEnumerator(); - } - - /// - /// Returns an enumerator that iterates through a collection. - /// - /// - /// An object that can be used to iterate through the collection. - /// - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); } /// @@ -338,42 +70,7 @@ IEnumerator IEnumerable.GetEnumerator() /// A clone of the current object public override BaseData Clone() { - return new OptionChain(_flatten) - { - Underlying = Underlying, - Ticks = Ticks, - Contracts = Contracts, - QuoteBars = QuoteBars, - TradeBars = TradeBars, - FilteredContracts = FilteredContracts, - Symbol = Symbol, - Time = Time, - DataType = DataType, - Value = Value - }; - } - - /// - /// Adds the specified auxiliary data to this option chain - /// - /// The auxiliary data to be added - internal void AddAuxData(BaseData baseData) - { - var type = baseData.GetType(); - Dictionary> dictionary; - if (!_auxiliaryData.TryGetValue(type, out dictionary)) - { - dictionary = new Dictionary>(); - _auxiliaryData[type] = dictionary; - } - - List list; - if (!dictionary.TryGetValue(baseData.Symbol, out list)) - { - list = new List(); - dictionary[baseData.Symbol] = list; - } - list.Add(baseData); + return new OptionChain(this); } } } diff --git a/Common/Data/Market/OptionChains.cs b/Common/Data/Market/OptionChains.cs index c78bf21e04eb..641b9378ba8a 100644 --- a/Common/Data/Market/OptionChains.cs +++ b/Common/Data/Market/OptionChains.cs @@ -13,29 +13,19 @@ * limitations under the License. */ -using Python.Runtime; -using QuantConnect.Python; using System; -using System.Collections.Generic; -using System.Linq; namespace QuantConnect.Data.Market { /// /// Collection of keyed by canonical option symbol /// - public class OptionChains : DataDictionary + public class OptionChains : BaseChains { - private static readonly IEnumerable _flattenedDfIndexNames = new[] { "canonical", "symbol" }; - - private readonly Lazy _dataframe; - private readonly bool _flatten; - /// /// Creates a new instance of the dictionary /// - public OptionChains() - : this(default, true) + public OptionChains() : base() { } @@ -43,7 +33,7 @@ public OptionChains() /// Creates a new instance of the dictionary /// public OptionChains(bool flatten) - : this(default, flatten) + : base(flatten) { } @@ -51,53 +41,8 @@ public OptionChains(bool flatten) /// Creates a new instance of the dictionary /// public OptionChains(DateTime time, bool flatten = true) - : base(time) + : base(time, flatten) { - _flatten = flatten; - _dataframe = new Lazy(InitializeDataFrame, isThreadSafe: false); - } - - /// - /// The data frame representation of the option chains - /// - public PyObject DataFrame => _dataframe.Value; - - /// - /// Gets or sets the OptionChain with the specified ticker. - /// - /// - /// The OptionChain with the specified ticker. - /// - /// The ticker of the element to get or set. - /// Wraps the base implementation to enable indexing in python algorithms due to pythonnet limitations - public new OptionChain this[string ticker] { get { return base[ticker]; } set { base[ticker] = value; } } - - /// - /// Gets or sets the OptionChain with the specified Symbol. - /// - /// - /// The OptionChain with the specified Symbol. - /// - /// The Symbol of the element to get or set. - /// Wraps the base implementation to enable indexing in python algorithms due to pythonnet limitations - public new OptionChain this[Symbol symbol] { get { return base[symbol]; } set { base[symbol] = value; } } - - private PyObject InitializeDataFrame() - { - if (!PythonEngine.IsInitialized) - { - return null; - } - - var dataFrames = this.Select(kvp => kvp.Value.DataFrame).ToList(); - - if (_flatten) - { - var canonicalSymbols = this.Select(kvp => kvp.Key); - return PandasConverter.ConcatDataFrames(dataFrames, keys: canonicalSymbols, names: _flattenedDfIndexNames, sort: false); - } - - return PandasConverter.ConcatDataFrames(dataFrames, sort: false); } } } diff --git a/Common/Data/Market/OptionContract.cs b/Common/Data/Market/OptionContract.cs index 271db0553404..3d44ec15f2c9 100644 --- a/Common/Data/Market/OptionContract.cs +++ b/Common/Data/Market/OptionContract.cs @@ -15,7 +15,6 @@ using QuantConnect.Data.UniverseSelection; using QuantConnect.Interfaces; -using QuantConnect.Python; using QuantConnect.Securities; using QuantConnect.Securities.Option; using System; @@ -25,31 +24,11 @@ namespace QuantConnect.Data.Market /// /// Defines a single option contract at a specific expiration and strike price /// - public class OptionContract : ISymbolProvider, ISymbol + public class OptionContract : BaseContract { private IOptionData _optionData = OptionPriceModelResultData.Null; private readonly SymbolProperties _symbolProperties; - /// - /// Gets the option contract's symbol - /// - [PandasIgnore] - public Symbol Symbol - { - get; set; - } - - /// - /// The security identifier of the option symbol - /// - [PandasIgnore] - public SecurityIdentifier ID => Symbol.ID; - - /// - /// Gets the underlying security's symbol - /// - public Symbol UnderlyingSymbol => Symbol.Underlying; - /// /// Gets the strike price /// @@ -60,11 +39,6 @@ public Symbol Symbol /// public decimal ScaledStrike => Strike * _symbolProperties.StrikeMultiplier; - /// - /// Gets the expiration date - /// - public DateTime Expiry => Symbol.ID.Date; - /// /// Gets the right being purchased (call [right to buy] or put [right to sell]) /// @@ -90,49 +64,40 @@ public Symbol Symbol /// public Greeks Greeks => _optionData.Greeks; - /// - /// Gets the local date time this contract's data was last updated - /// - [PandasIgnore] - public DateTime Time - { - get; set; - } - /// /// Gets the open interest /// - public decimal OpenInterest => _optionData.OpenInterest; + public override decimal OpenInterest => _optionData.OpenInterest; /// /// Gets the last price this contract traded at /// - public decimal LastPrice => _optionData.LastPrice; + public override decimal LastPrice => _optionData.LastPrice; /// /// Gets the last volume this contract traded at /// - public long Volume => _optionData.Volume; + public override long Volume => _optionData.Volume; /// /// Gets the current bid price /// - public decimal BidPrice => _optionData.BidPrice; + public override decimal BidPrice => _optionData.BidPrice; /// /// Get the current bid size /// - public long BidSize => _optionData.BidSize; + public override long BidSize => _optionData.BidSize; /// /// Gets the ask price /// - public decimal AskPrice => _optionData.AskPrice; + public override decimal AskPrice => _optionData.AskPrice; /// /// Gets the current ask size /// - public long AskSize => _optionData.AskSize; + public override long AskSize => _optionData.AskSize; /// /// Gets the last price the underlying security traded at @@ -144,8 +109,8 @@ public DateTime Time /// /// The option contract security public OptionContract(ISecurityPrice security) + : base(security.Symbol) { - Symbol = security.Symbol; _symbolProperties = security.SymbolProperties; } @@ -155,8 +120,8 @@ public OptionContract(ISecurityPrice security) /// The option universe contract data to use as source for this contract /// The contract symbol properties public OptionContract(OptionUniverse contractData, SymbolProperties symbolProperties) + : base(contractData.Symbol) { - Symbol = contractData.Symbol; _symbolProperties = symbolProperties; _optionData = new OptionUniverseData(contractData); } @@ -170,14 +135,6 @@ internal void SetOptionPriceModel(Func optionPriceModelE _optionData = new OptionPriceModelResultData(optionPriceModelEvaluator, _optionData as OptionPriceModelResultData); } - /// - /// Returns a string that represents the current object. - /// - /// - /// A string that represents the current object. - /// - public override string ToString() => Symbol.Value; - /// /// Creates a /// @@ -234,13 +191,13 @@ public static implicit operator Symbol(OptionContract contract) /// /// Updates the option contract with the new data, which can be a or or /// - internal void Update(BaseData data) + internal override void Update(BaseData data) { - if (data.Symbol == Symbol) + if (data.Symbol.SecurityType.IsOption()) { _optionData.Update(data); } - else if (data.Symbol == UnderlyingSymbol) + else if (data.Symbol.SecurityType == Symbol.GetUnderlyingFromOptionType(Symbol.SecurityType)) { _optionData.SetUnderlying(data); } diff --git a/Common/Data/UniverseSelection/BaseChainUniverseData.cs b/Common/Data/UniverseSelection/BaseChainUniverseData.cs new file mode 100644 index 000000000000..70a45fbd72ad --- /dev/null +++ b/Common/Data/UniverseSelection/BaseChainUniverseData.cs @@ -0,0 +1,245 @@ +/* + * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. + * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ + +using System; +using System.IO; +using QuantConnect.Python; +using QuantConnect.Securities; +using QuantConnect.Util; + +namespace QuantConnect.Data.UniverseSelection +{ + /// + /// Represents a chain universe. + /// Intended as a base for options and futures universe data. + /// + public abstract class BaseChainUniverseData : BaseDataCollection, IChainUniverseData + { + /// + /// Csv line to get the values from + /// + /// We keep the properties as they are in the csv file to reduce memory usage (strings vs decimals) + protected string CsvLine { get; } + + /// + /// The security identifier of the option symbol + /// + [PandasIgnore] + public SecurityIdentifier ID => Symbol.ID; + + /// + /// Price of the security + /// + [PandasIgnore] + public override decimal Value => Close; + + /// + /// Open price of the security + /// + public decimal Open + { + get + { + // Parse the values every time to avoid keeping them in memory + return CsvLine.GetDecimalFromCsv(0); + } + } + + /// + /// High price of the security + /// + public decimal High + { + get + { + return CsvLine.GetDecimalFromCsv(1); + } + } + + /// + /// Low price of the security + /// + public decimal Low + { + get + { + return CsvLine.GetDecimalFromCsv(2); + } + } + + /// + /// Close price of the security + /// + public decimal Close + { + get + { + return CsvLine.GetDecimalFromCsv(3); + } + } + + /// + /// Volume value of the security + /// + public decimal Volume + { + get + { + return CsvLine.GetDecimalFromCsv(4); + } + } + + /// + /// Open interest value + /// + public virtual decimal OpenInterest + { + get + { + return CsvLine.GetDecimalFromCsv(5); + } + } + + /// + /// Time that the data became available to use + /// + public override DateTime EndTime + { + get { return Time + QuantConnect.Time.OneDay; } + set { Time = value - QuantConnect.Time.OneDay; } + } + + /// + /// Creates a new instance of the class + /// + protected BaseChainUniverseData() + { + } + + /// + /// Creates a new instance of the class + /// + protected BaseChainUniverseData(DateTime date, Symbol symbol, string csv) + : base(date, date, symbol, null, null) + { + CsvLine = csv; + } + + /// + /// Creates a new instance of the class as a copy of the given instance + /// + protected BaseChainUniverseData(BaseChainUniverseData other) + : base(other) + { + CsvLine = other.CsvLine; + } + + /// + /// Return the URL string source of the file. This will be converted to a stream + /// + /// Configuration object + /// Date of this source file + /// true if we're in live mode, false for backtesting mode + /// String URL of source file. + public override SubscriptionDataSource GetSource(SubscriptionDataConfig config, DateTime date, bool isLiveMode) + { + var path = LeanData.GenerateUniversesDirectory(Globals.DataFolder, config.Symbol); + path = Path.Combine(path, $"{date:yyyyMMdd}.csv"); + + return new SubscriptionDataSource(path, SubscriptionTransportMedium.LocalFile, FileFormat.FoldingCollection); + } + + /// + /// Reader converts each line of the data source into BaseData objects. Each data type creates its own factory method, and returns a new instance of the object + /// each time it is called. + /// + /// Subscription data config setup object + /// Stream reader of the source document + /// Date of the requested data + /// The symbol read and parsed from the current line in the stream + /// The remaining string after reading the symbol from the current line in the stream + /// Whether a valid line starting with a symbol was read + protected static bool TryRead(SubscriptionDataConfig config, StreamReader stream, DateTime date, out Symbol symbol, out string remainingLine) + { + symbol = null; + remainingLine = null; + + if (stream == null || stream.EndOfStream) + { + return false; + } + + var sidStr = stream.GetString(); + + if (sidStr.StartsWith("#", StringComparison.InvariantCulture)) + { + stream.ReadLine(); + return false; + } + + var symbolValue = stream.GetString(); + remainingLine = stream.ReadLine(); + + var key = $"{sidStr}:{symbolValue}"; + + if (!TryGetCachedSymbol(key, out symbol)) + { + var sid = SecurityIdentifier.Parse(sidStr); + + if (sid.HasUnderlying) + { + // Let's try to get the underlying symbol from the cache + SymbolRepresentation.TryDecomposeOptionTickerOSI(symbolValue, sid.SecurityType, + out var _, out var underlyingValue, out var _, out var _, out var _); + var underlyingKey = $"{sid.Underlying}:{underlyingValue}"; + var underlyingWasCached = TryGetCachedSymbol(underlyingKey, out var underlyingSymbol); + + symbol = Symbol.CreateOption(sid, symbolValue, underlyingSymbol); + + if (!underlyingWasCached) + { + CacheSymbol(underlyingKey, symbol.Underlying); + } + } + else + { + symbol = new Symbol(sid, symbolValue); + } + + CacheSymbol(key, symbol); + } + + return true; + } + + /// + /// Gets the default resolution for this data and security type + /// + /// This is a method and not a property so that python + /// custom data types can override it + public override Resolution DefaultResolution() + { + return Resolution.Daily; + } + + /// + /// Gets the symbol of the option + /// + public Symbol ToSymbol() + { + return Symbol; + } + } +} diff --git a/Common/Data/UniverseSelection/FutureUniverse.cs b/Common/Data/UniverseSelection/FutureUniverse.cs new file mode 100644 index 000000000000..3163a0d292ff --- /dev/null +++ b/Common/Data/UniverseSelection/FutureUniverse.cs @@ -0,0 +1,111 @@ +/* + * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. + * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ + +using System; +using System.IO; + +namespace QuantConnect.Data.UniverseSelection +{ + /// + /// Represents a universe of futures data + /// + public class FutureUniverse : BaseChainUniverseData + { + /// + /// Creates a new instance of the class + /// + public FutureUniverse() + { + } + + /// + /// Creates a new instance of the class + /// + public FutureUniverse(DateTime date, Symbol symbol, string csv) + : base(date, symbol, csv) + { + } + + /// + /// Creates a new instance of the class as a copy of the given instance + /// + public FutureUniverse(FutureUniverse other) + : base(other) + { + } + + /// + /// Reader converts each line of the data source into BaseData objects. Each data type creates its own factory method, and returns a new instance of the object + /// each time it is called. + /// + /// Subscription data config setup object + /// Stream reader of the source document + /// Date of the requested data + /// true if we're in live mode, false for backtesting mode + /// Instance of the T:BaseData object generated by this line of the CSV + public override BaseData Reader(SubscriptionDataConfig config, StreamReader stream, DateTime date, bool isLiveMode) + { + if (TryRead(config, stream, date, out var symbol, out var remainingLine)) + { + return new FutureUniverse(date, symbol, remainingLine); + } + + return null; + } + + /// + /// Creates a copy of the instance + /// + /// Clone of the instance + public override BaseData Clone() + { + return new FutureUniverse(this); + } + + /// + /// Gets the default resolution for this data and security type + /// + /// This is a method and not a property so that python + /// custom data types can override it + public override Resolution DefaultResolution() + { + return Resolution.Daily; + } + + /// + /// Implicit conversion into + /// + /// The option universe data to be converted +#pragma warning disable CA2225 // Operator overloads have named alternates + public static implicit operator Symbol(FutureUniverse data) +#pragma warning restore CA2225 // Operator overloads have named alternates + { + return data.Symbol; + } + + /// + /// Gets the CSV string representation of this universe entry + /// + public static string ToCsv(Symbol symbol, decimal open, decimal high, decimal low, decimal close, decimal volume, decimal? openInterest) + { + return $"{symbol.ID},{symbol.Value},{open},{high},{low},{close},{volume},{openInterest}"; + } + + /// + /// Gets the CSV header string for this universe entry + /// + public static string CsvHeader => "symbol_id,symbol_value,open,high,low,close,volume,open_interest"; + } +} diff --git a/Common/Data/UniverseSelection/FuturesChainUniverse.cs b/Common/Data/UniverseSelection/FuturesChainUniverse.cs index d1893664c430..36d222b80a42 100644 --- a/Common/Data/UniverseSelection/FuturesChainUniverse.cs +++ b/Common/Data/UniverseSelection/FuturesChainUniverse.cs @@ -17,7 +17,6 @@ using System; using System.Collections.Generic; using System.Linq; -using QuantConnect.Interfaces; using QuantConnect.Securities; using QuantConnect.Securities.Future; @@ -28,8 +27,6 @@ namespace QuantConnect.Data.UniverseSelection /// public class FuturesChainUniverse : Universe { - private DateTime _cacheDate; - /// /// True if this universe filter can run async in the data stack /// @@ -86,38 +83,11 @@ public override UniverseSettings UniverseSettings /// The data that passes the filter public override IEnumerable SelectSymbols(DateTime utcTime, BaseDataCollection data) { - // date change detection needs to be done in exchange time zone var localEndTime = utcTime.ConvertFromUtc(Future.Exchange.TimeZone); - var exchangeDate = localEndTime.Date; - if (_cacheDate == exchangeDate) - { - return Unchanged; - } - - var availableContracts = data.Data.Select(x => x.Symbol); + var availableContracts = data.Data.Cast().ToList(); var results = Future.ContractFilter.Filter(new FutureFilterUniverse(availableContracts, localEndTime)); - _cacheDate = exchangeDate; - - return results; - } - - /// - /// Gets the subscription requests to be added for the specified security - /// - /// The security to get subscriptions for - /// The current time in utc. This is the frontier time of the algorithm - /// The max end time - /// Instance which implements interface - /// All subscriptions required by this security - public override IEnumerable GetSubscriptionRequests(Security security, DateTime currentTimeUtc, DateTime maximumEndTimeUtc, - ISubscriptionDataConfigService subscriptionService) - { - if (Future.Symbol.Underlying == security.Symbol) - { - Future.Underlying = security; - } - return base.GetSubscriptionRequests(security, currentTimeUtc, maximumEndTimeUtc, subscriptionService); + return results.Select(x => x.Symbol); } } } diff --git a/Common/Data/UniverseSelection/OptionChainUniverse.cs b/Common/Data/UniverseSelection/OptionChainUniverse.cs index d078bfed3a57..64640f77dd65 100644 --- a/Common/Data/UniverseSelection/OptionChainUniverse.cs +++ b/Common/Data/UniverseSelection/OptionChainUniverse.cs @@ -31,7 +31,6 @@ public class OptionChainUniverse : Universe private readonly OptionFilterUniverse _optionFilterUniverse; // as an array to make it easy to prepend to selected symbols private readonly Symbol[] _underlyingSymbol; - private DateTime _cacheDate; /// /// True if this universe filter can run async in the data stack @@ -91,30 +90,9 @@ public override UniverseSettings UniverseSettings /// The data that passes the filter public override IEnumerable SelectSymbols(DateTime utcTime, BaseDataCollection data) { - // date change detection needs to be done in exchange time zone var localEndTime = utcTime.ConvertFromUtc(Option.Exchange.TimeZone); - var exchangeDate = localEndTime.Date; - if (data.Symbol.SecurityType == SecurityType.FutureOption) - { - if (_cacheDate == exchangeDate) - { - return Unchanged; - } - _cacheDate = exchangeDate; - } - - // Temporary: this can be removed when future options universe selection is also file-based - var availableContractsData = data.Symbol.SecurityType != SecurityType.FutureOption - ? data.Data.Cast() - : data.Data.Select(x => new OptionUniverse() - { - Symbol = x.Symbol, - Underlying = data.Underlying, - Time = x.Time - }); - // we will only update unique strikes when there is an exchange date change - _optionFilterUniverse.Refresh(availableContractsData, data.Underlying, localEndTime); + _optionFilterUniverse.Refresh(data.Data.Cast().ToList(), data.Underlying, localEndTime); var results = Option.ContractFilter.Filter(_optionFilterUniverse); diff --git a/Common/Data/UniverseSelection/OptionUniverse.cs b/Common/Data/UniverseSelection/OptionUniverse.cs index 5ed49ae8af12..305f19377b9b 100644 --- a/Common/Data/UniverseSelection/OptionUniverse.cs +++ b/Common/Data/UniverseSelection/OptionUniverse.cs @@ -18,98 +18,25 @@ using System.Runtime.CompilerServices; using QuantConnect.Data.Market; using QuantConnect.Python; -using QuantConnect.Securities; -using QuantConnect.Util; namespace QuantConnect.Data.UniverseSelection { /// /// Represents a universe of options data /// - public class OptionUniverse : BaseDataCollection, ISymbol + public class OptionUniverse : BaseChainUniverseData { private const int StartingGreeksCsvIndex = 7; - // We keep the properties as they are in the csv file to reduce memory usage (strings vs decimals) - private readonly string _csvLine; - - /// - /// The security identifier of the option symbol - /// - [PandasIgnore] - public SecurityIdentifier ID => Symbol.ID; - - /// - /// Price of the option/underlying - /// - [PandasIgnore] - public override decimal Value => Close; - - /// - /// Open price of the option/underlying - /// - public decimal Open - { - get - { - // Parse the values every time to avoid keeping them in memory - return _csvLine.GetDecimalFromCsv(0); - } - } - - /// - /// High price of the option/underlying - /// - public decimal High - { - get - { - return _csvLine.GetDecimalFromCsv(1); - } - } - - /// - /// Low price of the option/underlying - /// - public decimal Low - { - get - { - return _csvLine.GetDecimalFromCsv(2); - } - } - - /// - /// Close price of the option/underlying - /// - public decimal Close - { - get - { - return _csvLine.GetDecimalFromCsv(3); - } - } - - /// - /// Volume of the option/underlying - /// - public decimal Volume - { - get - { - return _csvLine.GetDecimalFromCsv(4); - } - } - /// /// Open interest value of the option /// - public decimal OpenInterest + public override decimal OpenInterest { get { ThrowIfNotAnOption(nameof(OpenInterest)); - return _csvLine.GetDecimalFromCsv(5); + return base.OpenInterest; } } @@ -121,7 +48,7 @@ public decimal ImpliedVolatility get { ThrowIfNotAnOption(nameof(ImpliedVolatility)); - return _csvLine.GetDecimalFromCsv(6); + return CsvLine.GetDecimalFromCsv(6); } } @@ -133,19 +60,10 @@ public Greeks Greeks get { ThrowIfNotAnOption(nameof(Greeks)); - return new PreCalculatedGreeks(_csvLine); + return new PreCalculatedGreeks(CsvLine); } } - /// - /// Time that the data became available to use - /// - public override DateTime EndTime - { - get { return Time + QuantConnect.Time.OneDay; } - set { Time = value - QuantConnect.Time.OneDay; } - } - /// /// Creates a new instance of the class /// @@ -157,9 +75,8 @@ public OptionUniverse() /// Creates a new instance of the class /// public OptionUniverse(DateTime date, Symbol symbol, string csv) - : base(date, date, symbol, null, null) + : base(date, symbol, csv) { - _csvLine = csv; } /// @@ -168,22 +85,6 @@ public OptionUniverse(DateTime date, Symbol symbol, string csv) public OptionUniverse(OptionUniverse other) : base(other) { - _csvLine = other._csvLine; - } - - /// - /// Return the URL string source of the file. This will be converted to a stream - /// - /// Configuration object - /// Date of this source file - /// true if we're in live mode, false for backtesting mode - /// String URL of source file. - public override SubscriptionDataSource GetSource(SubscriptionDataConfig config, DateTime date, bool isLiveMode) - { - var path = LeanData.GenerateUniversesDirectory(Globals.DataFolder, config.Symbol); - path = Path.Combine(path, $"{date:yyyyMMdd}.csv"); - - return new SubscriptionDataSource(path, SubscriptionTransportMedium.LocalFile, FileFormat.FoldingCollection); } /// @@ -197,52 +98,12 @@ public override SubscriptionDataSource GetSource(SubscriptionDataConfig config, /// Instance of the T:BaseData object generated by this line of the CSV public override BaseData Reader(SubscriptionDataConfig config, StreamReader stream, DateTime date, bool isLiveMode) { - if (stream == null || stream.EndOfStream) - { - return null; - } - - var sidStr = stream.GetString(); - - if (sidStr.StartsWith("#", StringComparison.InvariantCulture)) + if (TryRead(config, stream, date, out var symbol, out var remainingLine)) { - stream.ReadLine(); - return null; + return new OptionUniverse(date, symbol, remainingLine); } - var symbolValue = stream.GetString(); - var remainingLine = stream.ReadLine(); - - var key = $"{sidStr}:{symbolValue}"; - - if (!TryGetCachedSymbol(key, out var symbol)) - { - var sid = SecurityIdentifier.Parse(sidStr); - - if (sid.HasUnderlying) - { - // Let's try to get the underlying symbol from the cache - SymbolRepresentation.TryDecomposeOptionTickerOSI(symbolValue, sid.SecurityType, - out var _, out var underlyingValue, out var _, out var _, out var _); - var underlyingKey = $"{sid.Underlying}:{underlyingValue}"; - var underlyingWasCached = TryGetCachedSymbol(underlyingKey, out var underlyingSymbol); - - symbol = Symbol.CreateOption(sid, symbolValue, underlyingSymbol); - - if (!underlyingWasCached) - { - CacheSymbol(underlyingKey, symbol.Underlying); - } - } - else - { - symbol = new Symbol(sid, symbolValue); - } - - CacheSymbol(key, symbol); - } - - return new OptionUniverse(date, symbol, remainingLine); + return null; } /// @@ -252,7 +113,7 @@ public override BaseData Reader(SubscriptionDataConfig config, StreamReader stre /// The new data point to add public override void Add(BaseData newDataPoint) { - if (newDataPoint is OptionUniverse optionUniverseDataPoint) + if (newDataPoint is BaseChainUniverseData optionUniverseDataPoint) { if (optionUniverseDataPoint.Symbol.HasUnderlying) { @@ -262,7 +123,7 @@ public override void Add(BaseData newDataPoint) else { Underlying = optionUniverseDataPoint; - foreach (OptionUniverse data in Data) + foreach (BaseChainUniverseData data in Data) { data.Underlying = optionUniverseDataPoint; } @@ -279,22 +140,17 @@ public override BaseData Clone() return new OptionUniverse(this); } - /// - /// Gets the default resolution for this data and security type - /// - /// This is a method and not a property so that python - /// custom data types can override it - public override Resolution DefaultResolution() - { - return Resolution.Daily; - } - /// /// Gets the CSV string representation of this universe entry /// public static string ToCsv(Symbol symbol, decimal open, decimal high, decimal low, decimal close, decimal volume, decimal? openInterest, decimal? impliedVolatility, Greeks greeks) { + if (symbol.SecurityType == SecurityType.FutureOption || symbol.SecurityType == SecurityType.Future) + { + return $"{symbol.ID},{symbol.Value},{open},{high},{low},{close},{volume},{openInterest}"; + } + return $"{symbol.ID},{symbol.Value},{open},{high},{low},{close},{volume}," + $"{openInterest},{impliedVolatility},{greeks?.Delta},{greeks?.Gamma},{greeks?.Vega},{greeks?.Theta},{greeks?.Rho}"; } @@ -303,23 +159,26 @@ public static string ToCsv(Symbol symbol, decimal open, decimal high, decimal lo /// Implicit conversion into /// /// The option universe data to be converted +#pragma warning disable CA2225 // Operator overloads have named alternates public static implicit operator Symbol(OptionUniverse data) +#pragma warning restore CA2225 // Operator overloads have named alternates { return data.Symbol; } /// - /// Gets the symbol of the option + /// Gets the CSV header string for this universe entry /// - public Symbol ToSymbol() + public static string CsvHeader(SecurityType securityType) { - return (Symbol)this; - } + // FOPs don't have greeks + if (securityType == SecurityType.FutureOption || securityType == SecurityType.Future) + { + return "symbol_id,symbol_value,open,high,low,close,volume,open_interest"; + } - /// - /// Gets the CSV header string for this universe entry - /// - public static string CsvHeader => "symbol_id,symbol_value,open,high,low,close,volume,open_interest,implied_volatility,delta,gamma,vega,theta,rho"; + return "symbol_id,symbol_value,open,high,low,close,volume,open_interest,implied_volatility,delta,gamma,vega,theta,rho"; + } [MethodImpl(MethodImplOptions.AggressiveInlining)] private void ThrowIfNotAnOption(string propertyName) diff --git a/Common/Extensions.cs b/Common/Extensions.cs index 51f0d4396e9a..3fc2d9d71c66 100644 --- a/Common/Extensions.cs +++ b/Common/Extensions.cs @@ -193,11 +193,11 @@ public static MarketHoursDatabase.Entry GetEntry(this MarketHoursDatabase market var result = marketHoursDatabase.GetEntry(symbol.ID.Market, symbol, symbol.ID.SecurityType); - // For the OptionUniverse type, the exchange and data time zones are set to the same value (exchange tz). - // This is not actual options data, just option chains/universe selection, so we don't want any offsets + // For the OptionUniverse and FutureUniverse types, the exchange and data time zones are set to the same value (exchange tz). + // This is not actual options/futures data, just chains/universe selection, so we don't want any offsets // between the exchange and data time zones. // If the MHDB were data type dependent as well, this would be taken care in there. - if (result != null && dataTypes.Any(dataType => dataType == typeof(OptionUniverse))) + if (result != null && dataTypes.Any(dataType => dataType.IsAssignableTo(typeof(BaseChainUniverseData)))) { result = new MarketHoursDatabase.Entry(result.ExchangeHours.TimeZone, result.ExchangeHours); } @@ -4134,7 +4134,7 @@ public static bool ShouldEmitData(this SubscriptionDataConfig config, BaseData d var expectedType = type.IsAssignableTo(config.Type); // Check our config type first to be lazy about using data.GetType() unless required - var configTypeFilter = (config.Type == typeof(TradeBar) || config.Type == typeof(ZipEntryName) || + var configTypeFilter = (config.Type == typeof(TradeBar) || config.Type.IsAssignableTo(typeof(BaseChainUniverseData)) || config.Type == typeof(Tick) && config.TickType == TickType.Trade || config.IsCustomData); if (!configTypeFilter) diff --git a/Common/Securities/ContractSecurityFilterUniverse.cs b/Common/Securities/ContractSecurityFilterUniverse.cs index 5e100925595e..1ab0c6e4edc0 100644 --- a/Common/Securities/ContractSecurityFilterUniverse.cs +++ b/Common/Securities/ContractSecurityFilterUniverse.cs @@ -28,9 +28,7 @@ namespace QuantConnect.Securities /// public abstract class ContractSecurityFilterUniverse : IDerivativeSecurityFilterUniverse where T: ContractSecurityFilterUniverse - // TODO: The universe data type abstraction could end up being IBaseData once Futures and FOPs universe are file-based like - // equity and index options. - where TData: ISymbol + where TData: IChainUniverseData { private bool _alreadyAppliedTypeFilters; @@ -94,13 +92,13 @@ internal IEnumerable AllSymbols { get { - return _data.Select(GetSymbol); + return _data.Select(x => x.Symbol); } set { // We create a "fake" data instance for each symbol that is not in the data, // so we are polite to the user and keep backwards compatibility - _data = value.Select(symbol => _data.FirstOrDefault(x => GetSymbol(x) == symbol) ?? CreateDataInstance(symbol)).ToList(); + _data = value.Select(symbol => _data.FirstOrDefault(x => x.Symbol == symbol) ?? CreateDataInstance(symbol)).ToList(); } } @@ -127,14 +125,6 @@ protected ContractSecurityFilterUniverse(IEnumerable allData, DateTime lo /// True if standard type protected abstract bool IsStandard(Symbol symbol); - /// - /// Gets the symbol from the data - /// - /// The symbol that represents the datum - /// TODO: This method should be removed once we have a file-based universe for futures and FOPs - /// and the universe data type is commonly abstracted to something like IBaseData which has a Symbol property. - protected abstract Symbol GetSymbol(TData data); - /// /// Creates a new instance of the data type for the given symbol /// @@ -162,7 +152,7 @@ internal T ApplyTypesFilter() bool result; if (memoizedMap.TryGetValue(dt, out result)) return result; - var res = IsStandard(GetSymbol(data)); + var res = IsStandard(data.Symbol); memoizedMap[dt] = res; return res; diff --git a/Common/Securities/EmptyContractFilter.cs b/Common/Securities/EmptyContractFilter.cs index 8f1c87c13c06..f3540542e224 100644 --- a/Common/Securities/EmptyContractFilter.cs +++ b/Common/Securities/EmptyContractFilter.cs @@ -24,7 +24,8 @@ namespace QuantConnect.Securities /// /// Derivate security universe selection filter which will always return empty /// - public class EmptyContractFilter : IDerivativeSecurityFilter + public class EmptyContractFilter : IDerivativeSecurityFilter + where T : IChainUniverseData { /// /// True if this universe filter can run async in the data stack @@ -36,23 +37,23 @@ public class EmptyContractFilter : IDerivativeSecurityFilter /// /// derivative symbols universe used in filtering /// The filtered set of symbols - public IDerivativeSecurityFilterUniverse Filter(IDerivativeSecurityFilterUniverse universe) + public IDerivativeSecurityFilterUniverse Filter(IDerivativeSecurityFilterUniverse universe) { return new NoneIDerivativeSecurityFilterUniverse(); } - private class NoneIDerivativeSecurityFilterUniverse : IDerivativeSecurityFilterUniverse + private class NoneIDerivativeSecurityFilterUniverse : IDerivativeSecurityFilterUniverse { public DateTime LocalTime => default; - public IEnumerator GetEnumerator() + public IEnumerator GetEnumerator() { - return Enumerable.Empty().GetEnumerator(); + return Enumerable.Empty().GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { - return Enumerable.Empty().GetEnumerator(); + return Enumerable.Empty().GetEnumerator(); } } } diff --git a/Common/Securities/FuncSecurityDerivativeFilter.cs b/Common/Securities/FuncSecurityDerivativeFilter.cs index 3460be41bc2e..20a5d80ca0d9 100644 --- a/Common/Securities/FuncSecurityDerivativeFilter.cs +++ b/Common/Securities/FuncSecurityDerivativeFilter.cs @@ -22,7 +22,7 @@ namespace QuantConnect.Securities /// Provides a functional implementation of /// public class FuncSecurityDerivativeFilter : IDerivativeSecurityFilter - where T : ISymbol + where T : IChainUniverseData { private readonly Func, IDerivativeSecurityFilterUniverse> _filter; diff --git a/Common/Securities/Future/Future.cs b/Common/Securities/Future/Future.cs index 1e72c102bd2a..3b226009537c 100644 --- a/Common/Securities/Future/Future.cs +++ b/Common/Securities/Future/Future.cs @@ -20,6 +20,7 @@ using QuantConnect.Orders.Slippage; using Python.Runtime; using QuantConnect.Util; +using QuantConnect.Data.UniverseSelection; namespace QuantConnect.Securities.Future { @@ -27,7 +28,7 @@ namespace QuantConnect.Securities.Future /// Futures Security Object Implementation for Futures Assets /// /// - public class Future : Security, IDerivativeSecurity, IContinuousSecurity + public class Future : Security, IContinuousSecurity { private bool _isTradable; @@ -98,7 +99,7 @@ IRegisteredSecurityDataTypesProvider registeredTypes // for now all futures are cash settled as we don't allow underlying (Live Cattle?) to be posted on the account SettlementType = SettlementType.Cash; Holdings = new FutureHolding(this, currencyConverter); - ContractFilter = new EmptyContractFilter(); + ContractFilter = new EmptyContractFilter(); } /// @@ -112,16 +113,13 @@ IRegisteredSecurityDataTypesProvider registeredTypes /// instances into units of the account currency /// Provides all data types registered in the algorithm /// Cache to store security information - /// Future underlying security public Future(Symbol symbol, SecurityExchangeHours exchangeHours, Cash quoteCurrency, SymbolProperties symbolProperties, ICurrencyConverter currencyConverter, IRegisteredSecurityDataTypesProvider registeredTypes, - SecurityCache securityCache, - Security underlying = null - ) + SecurityCache securityCache) : base(symbol, quoteCurrency, symbolProperties, @@ -145,8 +143,7 @@ public Future(Symbol symbol, // for now all futures are cash settled as we don't allow underlying (Live Cattle?) to be posted on the account SettlementType = SettlementType.Cash; Holdings = new FutureHolding(this, currencyConverter); - ContractFilter = new EmptyContractFilter(); - Underlying = underlying; + ContractFilter = new EmptyContractFilter(); } /// @@ -175,14 +172,6 @@ public SettlementType SettlementType get; set; } - /// - /// Gets or sets the underlying security object. - /// - public Security Underlying - { - get; set; - } - /// /// Gets or sets the currently mapped symbol for the security /// @@ -194,7 +183,7 @@ public Symbol Mapped /// /// Gets or sets the contract filter /// - public IDerivativeSecurityFilter ContractFilter + public IDerivativeSecurityFilter ContractFilter { get; set; } @@ -263,13 +252,13 @@ public void SetFilter(PyObject universeFunc) private void SetFilterImp(Func universeFunc) { - Func, IDerivativeSecurityFilterUniverse> func = universe => + Func, IDerivativeSecurityFilterUniverse> func = universe => { var futureUniverse = universe as FutureFilterUniverse; var result = universeFunc(futureUniverse); return result.ApplyTypesFilter(); }; - ContractFilter = new FuncSecurityDerivativeFilter(func); + ContractFilter = new FuncSecurityDerivativeFilter(func); } } } diff --git a/Common/Securities/Future/FutureFilterUniverse.cs b/Common/Securities/Future/FutureFilterUniverse.cs index e3ec55845119..3af6b50747da 100644 --- a/Common/Securities/Future/FutureFilterUniverse.cs +++ b/Common/Securities/Future/FutureFilterUniverse.cs @@ -17,6 +17,7 @@ using System; using System.Collections.Generic; using System.Linq; +using QuantConnect.Data.UniverseSelection; using QuantConnect.Securities.Future; using QuantConnect.Util; @@ -25,13 +26,13 @@ namespace QuantConnect.Securities /// /// Represents futures symbols universe used in filtering. /// - public class FutureFilterUniverse : ContractSecurityFilterUniverse + public class FutureFilterUniverse : ContractSecurityFilterUniverse { /// /// Constructs FutureFilterUniverse /// - public FutureFilterUniverse(IEnumerable allSymbols, DateTime localTime) - : base(allSymbols, localTime) + public FutureFilterUniverse(IEnumerable allData, DateTime localTime) + : base(allData, localTime) { } @@ -44,22 +45,17 @@ protected override bool IsStandard(Symbol symbol) return FutureSymbol.IsStandard(symbol); } - /// - /// Gets the symbol from the data - /// - /// The symbol that represents the datum - protected override Symbol GetSymbol(Symbol data) - { - return data; - } - /// /// Creates a new instance of the data type for the given symbol /// /// A data instance for the given symbol, which is just the symbol itself - protected override Symbol CreateDataInstance(Symbol symbol) + protected override FutureUniverse CreateDataInstance(Symbol symbol) { - return symbol; + return new FutureUniverse() + { + Symbol = symbol, + Time = LocalTime + }; } /// @@ -85,7 +81,7 @@ public static class FutureFilterUniverseEx /// Universe to apply the filter too /// Bool function to determine which Symbol are filtered /// with filter applied - public static FutureFilterUniverse Where(this FutureFilterUniverse universe, Func predicate) + public static FutureFilterUniverse Where(this FutureFilterUniverse universe, Func predicate) { universe.Data = universe.Data.Where(predicate).ToList(); return universe; @@ -97,9 +93,9 @@ public static FutureFilterUniverse Where(this FutureFilterUniverse universe, Fun /// Universe to apply the filter too /// Symbol function to determine which Symbols are filtered /// with filter applied - public static FutureFilterUniverse Select(this FutureFilterUniverse universe, Func mapFunc) + public static FutureFilterUniverse Select(this FutureFilterUniverse universe, Func mapFunc) { - universe.Data = universe.Data.Select(mapFunc).ToList(); + universe.AllSymbols = universe.Data.Select(mapFunc).ToList(); return universe; } @@ -109,9 +105,9 @@ public static FutureFilterUniverse Select(this FutureFilterUniverse universe, Fu /// Universe to apply the filter too /// Symbols function to determine which Symbols are filtered /// with filter applied - public static FutureFilterUniverse SelectMany(this FutureFilterUniverse universe, Func> mapFunc) + public static FutureFilterUniverse SelectMany(this FutureFilterUniverse universe, Func> mapFunc) { - universe.Data = universe.Data.SelectMany(mapFunc).ToList(); + universe.AllSymbols = universe.Data.SelectMany(mapFunc).ToList(); return universe; } } diff --git a/Common/Securities/ISymbol.cs b/Common/Securities/IChainUniverseData.cs similarity index 82% rename from Common/Securities/ISymbol.cs rename to Common/Securities/IChainUniverseData.cs index caabf6091314..cba27e3268e3 100644 --- a/Common/Securities/ISymbol.cs +++ b/Common/Securities/IChainUniverseData.cs @@ -14,12 +14,14 @@ * */ +using QuantConnect.Data; + namespace QuantConnect.Securities { /// - /// Base interface intended for universe data to have some of their symbol properties accessible directly. + /// Base interface intended for chain universe data to have some of their symbol properties accessible directly. /// - public interface ISymbol + public interface IChainUniverseData : IBaseData { /// /// Gets the security identifier. diff --git a/Common/Securities/IDerivativeSecurityFilter.cs b/Common/Securities/IDerivativeSecurityFilter.cs index f2ebc7c71af5..fc80a6e5a718 100644 --- a/Common/Securities/IDerivativeSecurityFilter.cs +++ b/Common/Securities/IDerivativeSecurityFilter.cs @@ -20,7 +20,7 @@ namespace QuantConnect.Securities /// Filters a set of derivative symbols using the underlying price data. /// public interface IDerivativeSecurityFilter - where T : ISymbol + where T : IChainUniverseData { /// /// Filters the input set of symbols represented by the universe diff --git a/Common/Securities/IDerivativeSecurityFilterUniverse.cs b/Common/Securities/IDerivativeSecurityFilterUniverse.cs index dad70d602c16..ef9dceab11fc 100644 --- a/Common/Securities/IDerivativeSecurityFilterUniverse.cs +++ b/Common/Securities/IDerivativeSecurityFilterUniverse.cs @@ -22,7 +22,7 @@ namespace QuantConnect.Securities /// Represents derivative symbols universe used in filtering. /// public interface IDerivativeSecurityFilterUniverse : IEnumerable - where T : ISymbol + where T : IChainUniverseData { } } diff --git a/Common/Securities/Option/OptionFilterUniverse.cs b/Common/Securities/Option/OptionFilterUniverse.cs index a5ce1dd7df8b..b3619ed64676 100644 --- a/Common/Securities/Option/OptionFilterUniverse.cs +++ b/Common/Securities/Option/OptionFilterUniverse.cs @@ -17,6 +17,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.CompilerServices; using Python.Runtime; using QuantConnect.Data; using QuantConnect.Data.UniverseSelection; @@ -110,15 +111,6 @@ protected override bool IsStandard(Symbol symbol) } } - /// - /// Gets the symbol from the data - /// - /// The symbol that represents the datum - protected override Symbol GetSymbol(OptionUniverse data) - { - return data.Symbol; - } - /// /// Creates a new instance of the data type for the given symbol /// @@ -820,6 +812,7 @@ public OptionFilterUniverse PutLadder(int minDaysTillExpiry, decimal higherStrik /// Universe with filter applied public OptionFilterUniverse Delta(decimal min, decimal max) { + ValidateSecurityTypeForSupportedFilters(nameof(Delta)); return this.Where(contractData => contractData.Greeks.Delta >= min && contractData.Greeks.Delta <= max); } @@ -843,6 +836,7 @@ public OptionFilterUniverse D(decimal min, decimal max) /// Universe with filter applied public OptionFilterUniverse Gamma(decimal min, decimal max) { + ValidateSecurityTypeForSupportedFilters(nameof(Gamma)); return this.Where(contractData => contractData.Greeks.Gamma >= min && contractData.Greeks.Gamma <= max); } @@ -866,6 +860,7 @@ public OptionFilterUniverse G(decimal min, decimal max) /// Universe with filter applied public OptionFilterUniverse Theta(decimal min, decimal max) { + ValidateSecurityTypeForSupportedFilters(nameof(Theta)); return this.Where(contractData => contractData.Greeks.Theta >= min && contractData.Greeks.Theta <= max); } @@ -889,6 +884,7 @@ public OptionFilterUniverse T(decimal min, decimal max) /// Universe with filter applied public OptionFilterUniverse Vega(decimal min, decimal max) { + ValidateSecurityTypeForSupportedFilters(nameof(Vega)); return this.Where(contractData => contractData.Greeks.Vega >= min && contractData.Greeks.Vega <= max); } @@ -912,6 +908,7 @@ public OptionFilterUniverse V(decimal min, decimal max) /// Universe with filter applied public OptionFilterUniverse Rho(decimal min, decimal max) { + ValidateSecurityTypeForSupportedFilters(nameof(Rho)); return this.Where(contractData => contractData.Greeks.Rho >= min && contractData.Greeks.Rho <= max); } @@ -935,6 +932,7 @@ public OptionFilterUniverse R(decimal min, decimal max) /// Universe with filter applied public OptionFilterUniverse ImpliedVolatility(decimal min, decimal max) { + ValidateSecurityTypeForSupportedFilters(nameof(ImpliedVolatility)); return this.Where(contractData => contractData.ImpliedVolatility >= min && contractData.ImpliedVolatility <= max); } @@ -958,6 +956,7 @@ public OptionFilterUniverse IV(decimal min, decimal max) /// Universe with filter applied public OptionFilterUniverse OpenInterest(long min, long max) { + ValidateSecurityTypeForSupportedFilters(nameof(OpenInterest)); return this.Where(contractData => contractData.OpenInterest >= min && contractData.OpenInterest <= max); } @@ -1057,6 +1056,15 @@ private decimal GetStrike(IEnumerable symbols, decimal strikeFromAtm) .DefaultIfEmpty(decimal.MaxValue) .First(); } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private void ValidateSecurityTypeForSupportedFilters(string filterName) + { + if (_option.Symbol.SecurityType == SecurityType.FutureOption) + { + throw new InvalidOperationException($"{filterName} filter is not supported for future options."); + } + } } /// diff --git a/Common/Securities/SecurityService.cs b/Common/Securities/SecurityService.cs index 72bc4ae8413e..4fb2f4a85f65 100644 --- a/Common/Securities/SecurityService.cs +++ b/Common/Securities/SecurityService.cs @@ -167,7 +167,7 @@ private Security CreateSecurity(Symbol symbol, break; case SecurityType.Future: - security = new Future.Future(symbol, exchangeHours, quoteCash, symbolProperties, _cashBook, _registeredTypes, cache, underlying); + security = new Future.Future(symbol, exchangeHours, quoteCash, symbolProperties, _cashBook, _registeredTypes, cache); break; case SecurityType.Forex: diff --git a/Common/Symbol.cs b/Common/Symbol.cs index 93d0631d8a17..5e70c0f7a649 100644 --- a/Common/Symbol.cs +++ b/Common/Symbol.cs @@ -31,7 +31,7 @@ namespace QuantConnect [JsonConverter(typeof(SymbolJsonConverter))] [ProtoContract(SkipConstructor = true)] [PandasNonExpandable] - public sealed class Symbol : IEquatable, IComparable, ISymbol + public sealed class Symbol : IEquatable, IComparable { private static readonly Lazy _securityDefinitionSymbolResolver = new (() => SecurityDefinitionSymbolResolver.GetInstance()); diff --git a/Common/SymbolRepresentation.cs b/Common/SymbolRepresentation.cs index 673748a30faa..bd9a38a47b6a 100644 --- a/Common/SymbolRepresentation.cs +++ b/Common/SymbolRepresentation.cs @@ -34,7 +34,7 @@ namespace QuantConnect public static class SymbolRepresentation { // Define the regex as a private readonly static field and compile it - private static readonly Regex _optionTickerRegex = new Regex(@"^([A-Z]+)\s*(\d{6})([CP])(\d{8})$", RegexOptions.IgnoreCase | RegexOptions.Compiled); + private static readonly Regex _optionTickerRegex = new Regex(@"^([A-Z0-9]+)\s*(\d{6})([CP])(\d{8})$", RegexOptions.IgnoreCase | RegexOptions.Compiled); /// /// Class contains future ticker properties returned by ParseFutureTicker() @@ -394,6 +394,12 @@ public static Symbol ParseOptionTickerOSI(string ticker, SecurityType securityTy underlyingSid = SecurityIdentifier.GenerateIndex(OptionSymbol.MapToUnderlying(optionTicker, securityType), market); underlyingSymbolValue = underlyingSid.Symbol; } + else if (securityType == SecurityType.FutureOption) + { + var futureTickerInfo = ParseFutureTicker(optionTicker); + underlyingSid = SecurityIdentifier.GenerateFuture(expiry, futureTickerInfo.Underlying, market); + underlyingSymbolValue = underlyingSid.Symbol; + } else { throw new NotImplementedException($"ParseOptionTickerOSI(): {Messages.SymbolRepresentation.SecurityTypeNotImplemented(securityType)}"); diff --git a/Common/Util/LeanData.cs b/Common/Util/LeanData.cs index 21afbf95c1b9..2001840ca291 100644 --- a/Common/Util/LeanData.cs +++ b/Common/Util/LeanData.cs @@ -42,7 +42,7 @@ public static class LeanData private static readonly HashSet _strictDailyEndTimesDataTypes = new() { // the underlying could yield auxiliary data which we don't want to change - typeof(TradeBar), typeof(QuoteBar), typeof(ZipEntryName), typeof(BaseDataCollection), typeof(OpenInterest) + typeof(TradeBar), typeof(QuoteBar), typeof(BaseDataCollection), typeof(OpenInterest) }; /// @@ -644,9 +644,16 @@ public static string GenerateRelativeUniversesDirectory(Symbol symbol) case SecurityType.FutureOption: path = Path.Combine(path, - symbol.Underlying.Value.ToLowerInvariant(), + symbol.Underlying.ID.Symbol.ToLowerInvariant(), symbol.Underlying.ID.Date.ToStringInvariant(DateFormat.EightCharacter)); break; + + case SecurityType.Future: + path = Path.Combine(path, symbol.ID.Symbol.ToLowerInvariant()); + break; + + default: + throw new ArgumentOutOfRangeException($"Unsupported security type {symbol.SecurityType}"); } return path; @@ -1023,7 +1030,7 @@ public static TickType GetCommonTickTypeForCommonDataTypes(Type type, SecurityTy { return TickType.OpenInterest; } - if (type == typeof(ZipEntryName)) + if (type.IsAssignableTo(typeof(BaseChainUniverseData))) { return TickType.Quote; } @@ -1497,17 +1504,8 @@ public static bool SetStrictEndTimes(IBaseData baseData, SecurityExchangeHours e return false; } - var isZipEntryName = dataType == typeof(ZipEntryName); - if (isZipEntryName && baseData.Time.Hour == 0) - { - // zip entry names are emitted point in time for a date, see BaseDataSubscriptionEnumeratorFactory. When setting the strict end times - // we will move it to the previous day daily times, because daily market data on disk end time is midnight next day, so here we add 1 day - baseData.Time += Time.OneDay; - baseData.EndTime += Time.OneDay; - } - var dailyCalendar = GetDailyCalendar(baseData.EndTime, exchange, extendedMarketHours: false); - if (!isZipEntryName && dailyCalendar.End < baseData.Time) + if (dailyCalendar.End < baseData.Time) { // this data point we were given is probably from extended market hours which we don't support for daily backtesting data return false; diff --git a/Data/future/cme/daily/es_trade.zip b/Data/future/cme/daily/es_trade.zip index a5cabc77cddb..08d605ed6321 100644 Binary files a/Data/future/cme/daily/es_trade.zip and b/Data/future/cme/daily/es_trade.zip differ diff --git a/Data/future/cme/universes/dc/20111230.csv b/Data/future/cme/universes/dc/20111230.csv new file mode 100644 index 000000000000..cc7215f1f2da --- /dev/null +++ b/Data/future/cme/universes/dc/20111230.csv @@ -0,0 +1,18 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +DC V4JPUDG8NG1T,DC01H12,17.25,17.35,17.13,17.15,231,4726 +DC V5E8P9SH0U0X,DC01H12,17.5,17.69,17.45,17.56,449,3926 +DC V67S42RJBGU9,DC01J12,17.4,17.44,17.39,17.42,31,2841 +DC V70C2SDFJCHT,DC30K12,17.25,17.3,17.25,17.25,11,2687 +DC V7YSQ26C7R41,DC04M12,17.16,17.34,17.15,17.28,63,1680 +DC V8PDSL1WA4G1,DC31M12,0,0,0,0,0,2292 +DC V9GYB7AMF8XT,DC28Q12,17.35,17.35,17.32,17.32,6,1592 +DC VAFEYH3J3NK1,DC02U12,17.38,17.38,17.38,17.38,1,1555 +DC VB50KWLX39Q9,DC28V12,17.07,17.07,17.06,17.06,3,1324 +DC VC5G4D55X6O1,DC04X12,17.04,17.05,17.04,17.05,10,1279 +DC VCY032R252BL,DC02Z12,17.08,17.08,17.06,17.06,2,1269 +DC VDOL5LMM7FNL,DC29F13,16.75,16.78,16.75,16.775,0,36 +DC VEG5O7VCCK5D,DC26G13,0,0,0,0,0,25 +DC VFEMBHO90YRL,DC02H13,0,0,0,0,0,21 +DC VH4NHDPVUHVL,DC04K13,0,0,0,0,0,5 +DC VHW7ZZYLZMDD,DC02M13,0,0,0,0,0,4 +DC VINSIM7C4QV5,DC30N13,0,0,0,0,0,3 diff --git a/Data/future/cme/universes/dc/20120330.csv b/Data/future/cme/universes/dc/20120330.csv new file mode 100644 index 000000000000..135aed04d5f1 --- /dev/null +++ b/Data/future/cme/universes/dc/20120330.csv @@ -0,0 +1,16 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +DC V67S42RJBGU9,DC01J12,15.78,15.9,15.68,15.87,281,5072 +DC V70C2SDFJCHT,DC30K12,15.69,15.83,15.53,15.75,263,4247 +DC V8PDSL1WA4G1,DC31M12,15.98,16.05,15.79,16,99,3593 +DC V7YSQ26C7R41,DC04M12,16.39,16.51,16.38,16.44,20,2618 +DC V9GYB7AMF8XT,DC28Q12,16.84,16.87,16.7,16.74,14,2590 +DC VAFEYH3J3NK1,DC02U12,16.7,16.8,16.64,16.76,18,2303 +DC VB50KWLX39Q9,DC28V12,16.67,16.67,16.64,16.66,9,2113 +DC VC5G4D55X6O1,DC04X12,16.52,16.54,16.49,16.5,13,1965 +DC VCY032R252BL,DC02Z12,16.45,16.47,16.44,16.44,9,1857 +DC VDOL5LMM7FNL,DC29F13,16.14,16.265,15.875,16.045,0,185 +DC VEG5O7VCCK5D,DC26G13,16.1,16.13,16.1,16.1,4,138 +DC VFEMBHO90YRL,DC02H13,16.065,16.33,16.05,16.325,0,36 +DC VH4NHDPVUHVL,DC04K13,16.00,16.07,15.965,16.065,0,27 +DC VHW7ZZYLZMDD,DC02M13,16.025,16.065,16.00,16.06,0,27 +DC VINSIM7C4QV5,DC30N13,0,0,0,0,0,16 diff --git a/Data/future/cme/universes/dc/20131004.csv b/Data/future/cme/universes/dc/20131004.csv new file mode 100644 index 000000000000..9015b17acd75 --- /dev/null +++ b/Data/future/cme/universes/dc/20131004.csv @@ -0,0 +1,17 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +DC VOLGIWKYQGOX,DC04G14,16.66,16.66,16.6,16.66,24,1457 +DC VNTW0AC8LC75,DC04F14,16.81,16.84,16.72,16.83,76,1630 +DC VYJV8XQEL341,DC03G15,16.415,16.415,16.35,16.38,0, +DC VM3UUEALRT35,DC03X13,17.99,18.06,17.74,17.83,350,4288 +DC VW29KFG1MFI9,DC02X14,17,17.03,17,17.03,12,366 +DC VL5E74HP3EGX,DC29V13,18.14,18.14,18,18.07,207,3951 +DC VTLNC0IUQJ29,DC03Q14,17.13,17.13,17.06,17.06,5,504 +DC VQ4LK52F0POH,DC29J14,16.5,16.5,16.47,16.5,4,1036 +DC VMVFD0JBWXKX,DC31Z13,17.27,17.3,17.05,17.21,165,3253 +DC VXSAQBHOFYM9,DC03F15,16.655,16.655,16.6,16.605,0,1 +DC VR327EVBP4AP,DC03K14,16.54,16.6,16.54,16.54,3,1082 +DC VVAP1T7BHB0H,DC04V14,17.06,17.06,17.05,17.06,23,399 +DC VWTU31ORRK01,DC30Z14,16.99,16.99,16.99,16.99,13,347 +DC VPD11ITOVL6P,DC01H14,16.58,16.61,16.57,16.61,23,1246 +DC VSM78NCRZDA9,DC29N14,17.02,17.02,17.02,17.02,5,473 +DC VRUMQ141U8SH,DC01M14,16.78,16.82,16.7,16.7,8,929 diff --git a/Data/future/cme/universes/es/20130710.csv b/Data/future/cme/universes/es/20130710.csv new file mode 100644 index 000000000000..71b5f574d1a6 --- /dev/null +++ b/Data/future/cme/universes/es/20130710.csv @@ -0,0 +1,11 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES VMKLFZIH2MTD,ES20Z13,1660.25,1665,1651.5,1664.5,727,22316 +ES VP274HSU1AF5,ES21H14,1653.5,1657.75,1650.25,1657.5,31,2006 +ES VRJST036ZY0X,ES20M14,1630,1633.25,1628.25,1628.25,0,217 +ES VU1EHIDJYLMP,ES19U14,1627.375,1645.125,1627.375,1643.125,0, +ES VWJ060NWX98H,ES19Z14,0,0,0,0,0, +ES XCZJLC9NOB29,ES20H20,0,0,0,0,0, +ES XFH59UK0MYO1,ES19M20,0,0,0,0,0, +ES XHYQYCUDLM9T,ES18U20,0,0,0,0,0, +ES XKGCMV4QK9VL,ES18Z20,0,0,0,0,0, +ES XMXYBDF3IXHD,ES19H21,0,0,0,0,0, diff --git a/Data/future/cme/universes/es/20130711.csv b/Data/future/cme/universes/es/20130711.csv new file mode 100644 index 000000000000..ec005cdae61a --- /dev/null +++ b/Data/future/cme/universes/es/20130711.csv @@ -0,0 +1,11 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES VMKLFZIH2MTD,ES20Z13,1663.25,1667.25,1660.25,1660.25,417,22316 +ES VP274HSU1AF5,ES21H14,1656.75,1658.75,1655.75,1658.75,5,2006 +ES VRJST036ZY0X,ES20M14,1649.875,1656.875,1640.25,1647.25,0,217 +ES VU1EHIDJYLMP,ES19U14,1643.5,1643.5,1643.5,1643.5,1, +ES VWJ060NWX98H,ES19Z14,0,0,0,0,0, +ES XCZJLC9NOB29,ES20H20,0,0,0,0,0, +ES XFH59UK0MYO1,ES19M20,0,0,0,0,0, +ES XHYQYCUDLM9T,ES18U20,0,0,0,0,0, +ES XKGCMV4QK9VL,ES18Z20,0,0,0,0,0, +ES XMXYBDF3IXHD,ES19H21,0,0,0,0,0, diff --git a/Data/future/cme/universes/es/20131003.csv b/Data/future/cme/universes/es/20131003.csv new file mode 100644 index 000000000000..6b642f1b9660 --- /dev/null +++ b/Data/future/cme/universes/es/20131003.csv @@ -0,0 +1,11 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES VMKLFZIH2MTD,ES20Z13,1672.5,1686,1667.5,1682.75,1321616,2698745 +ES VP274HSU1AF5,ES21H14,1665.25,1678.75,1661.5,1676.25,3657,6002 +ES VRJST036ZY0X,ES20M14,1659,1660,1656,1658,0,967 +ES VU1EHIDJYLMP,ES19U14,1648.5,1664.75,1647.875,1663.375,0,236 +ES VWJ060NWX98H,ES19Z14,1643.875,1658.125,1643.375,1658.125,0,105 +ES XCZJLC9NOB29,ES20H20,0,0,0,0,0, +ES XFH59UK0MYO1,ES19M20,0,0,0,0,0, +ES XHYQYCUDLM9T,ES18U20,0,0,0,0,0, +ES XKGCMV4QK9VL,ES18Z20,0,0,0,0,0, +ES XMXYBDF3IXHD,ES19H21,0,0,0,0,0, diff --git a/Data/future/cme/universes/es/20131004.csv b/Data/future/cme/universes/es/20131004.csv new file mode 100644 index 000000000000..60d8ba049ea3 --- /dev/null +++ b/Data/future/cme/universes/es/20131004.csv @@ -0,0 +1,6 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES VMKLFZIH2MTD,ES20Z13,1669,1679.5,1666.5,1668,1374818,2692235 +ES VP274HSU1AF5,ES21H14,1662.5,1673,1660,1661.5,3248,6587 +ES VRJST036ZY0X,ES20M14,1657.25,1657.5,1657.25,1657.5,10,968 +ES VU1EHIDJYLMP,ES19U14,1663.375,1664.25,1645.625,1648.125,0,236 +ES VWJ060NWX98H,ES19Z14,1658.125,1658.125,1641.375,1641.875,0,105 diff --git a/Data/future/cme/universes/es/20131007.csv b/Data/future/cme/universes/es/20131007.csv new file mode 100644 index 000000000000..86ca2a8fb2bd --- /dev/null +++ b/Data/future/cme/universes/es/20131007.csv @@ -0,0 +1,6 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES VMKLFZIH2MTD,ES20Z13,1669,1671.5,1646.5,1646.5,2109007,2723644 +ES VP274HSU1AF5,ES21H14,1662.75,1664.75,1640,1640,2652,7400 +ES VRJST036ZY0X,ES20M14,1647,1647.75,1640,1640,206,1167 +ES VU1EHIDJYLMP,ES19U14,1648.125,1669.25,1627.125,1655.375,0,233 +ES VWJ060NWX98H,ES19Z14,1641.875,1647.125,1624.875,1629.5,0,105 diff --git a/Data/future/cme/universes/es/20131008.csv b/Data/future/cme/universes/es/20131008.csv new file mode 100644 index 000000000000..7dc609ae8d3b --- /dev/null +++ b/Data/future/cme/universes/es/20131008.csv @@ -0,0 +1,6 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES VMKLFZIH2MTD,ES20Z13,1652.75,1658.25,1640,1648.75,2198243,2703379 +ES VP274HSU1AF5,ES21H14,1646.25,1651,1633.5,1642,5108,8751 +ES VRJST036ZY0X,ES20M14,1631.5,1633.75,1631.5,1633.75,5,1168 +ES VU1EHIDJYLMP,ES19U14,1655.375,1661.125,1620,1629,0,233 +ES VWJ060NWX98H,ES19Z14,1629.5,1632.875,1614.50,1622.5,0,105 diff --git a/Data/future/cme/universes/es/20131009.csv b/Data/future/cme/universes/es/20131009.csv new file mode 100644 index 000000000000..44c6e25d3257 --- /dev/null +++ b/Data/future/cme/universes/es/20131009.csv @@ -0,0 +1,6 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES VMKLFZIH2MTD,ES20Z13,1667.5,1687.75,1648,1682.5,1905839,2678669 +ES VP274HSU1AF5,ES21H14,1661.25,1680.5,1644.25,1675.75,3700,10160 +ES VRJST036ZY0X,ES20M14,1660,1660,1658,1658.25,103,1074 +ES VU1EHIDJYLMP,ES19U14,1629,1668,1629,1662.875,0,233 +ES VWJ060NWX98H,ES19Z14,1622.5,1660.875,1622.5,1655.875,0,105 diff --git a/Data/future/cme/universes/es/20131010.csv b/Data/future/cme/universes/es/20131010.csv new file mode 100644 index 000000000000..aa4aa5dbe17d --- /dev/null +++ b/Data/future/cme/universes/es/20131010.csv @@ -0,0 +1,6 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES VMKLFZIH2MTD,ES20Z13,1684.25,1700,1673,1699.5,1282403,2678669 +ES VP274HSU1AF5,ES21H14,1677.25,1693.25,1666.75,1692.75,2153,10160 +ES VRJST036ZY0X,ES20M14,1672,1683.25,1672,1683.25,115,1074 +ES VU1EHIDJYLMP,ES19U14,1662.875,1681.5,1662.375,1674.625,0,233 +ES VWJ060NWX98H,ES19Z14,1655.875,1671.00,1655.875,1671.00,0,105 diff --git a/Data/future/cme/universes/es/20131011.csv b/Data/future/cme/universes/es/20131011.csv new file mode 100644 index 000000000000..abc156317ed3 --- /dev/null +++ b/Data/future/cme/universes/es/20131011.csv @@ -0,0 +1,11 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES VMKLFZIH2MTD,ES20Z13,1687,1706.75,1680.75,1705.5,1272562,2675494 +ES VP274HSU1AF5,ES21H14,1680.75,1700,1674.25,1699.75,2364,12028 +ES VRJST036ZY0X,ES20M14,1686.125,1796.25,1672.375,1692.375,0,983 +ES VU1EHIDJYLMP,ES19U14,1674.625,1686.75,1663.75,1684.375,0,233 +ES VWJ060NWX98H,ES19Z14,1671.00,1679.625,1660.0,1679.625,0,105 +ES XCZJLC9NOB29,ES20H20,0,0,0,0,0, +ES XFH59UK0MYO1,ES19M20,0,0,0,0,0, +ES XHYQYCUDLM9T,ES18U20,0,0,0,0,0, +ES XKGCMV4QK9VL,ES18Z20,0,0,0,0,0, +ES XMXYBDF3IXHD,ES19H21,0,0,0,0,0, diff --git a/Data/future/cme/universes/es/20131015.csv b/Data/future/cme/universes/es/20131015.csv new file mode 100644 index 000000000000..7fc97df57c40 --- /dev/null +++ b/Data/future/cme/universes/es/20131015.csv @@ -0,0 +1,11 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES VMKLFZIH2MTD,ES20Z13,1702.25,1717,1691.25,1712.25,1527072,2682298 +ES VP274HSU1AF5,ES21H14,1695.75,1710.25,1685,1705.75,3550,13149 +ES VRJST036ZY0X,ES20M14,1699,1700.75,1696,1700.75,11,1236 +ES VU1EHIDJYLMP,ES19U14,1689,1689,1689,1689,1,234 +ES VWJ060NWX98H,ES19Z14,1673.625,1692.875,1672.125,1692.875,0,105 +ES XCZJLC9NOB29,ES20H20,0,0,0,0,0, +ES XFH59UK0MYO1,ES19M20,0,0,0,0,0, +ES XHYQYCUDLM9T,ES18U20,0,0,0,0,0, +ES XKGCMV4QK9VL,ES18Z20,0,0,0,0,0, +ES XMXYBDF3IXHD,ES19H21,0,0,0,0,0, diff --git a/Data/future/cme/universes/es/20131016.csv b/Data/future/cme/universes/es/20131016.csv new file mode 100644 index 000000000000..d1b43c533e77 --- /dev/null +++ b/Data/future/cme/universes/es/20131016.csv @@ -0,0 +1,11 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES VMKLFZIH2MTD,ES20Z13,1709,1728.75,1706.25,1727.75,1357016,2698990 +ES VP274HSU1AF5,ES21H14,1702.25,1722,1700.25,1720.75,1068,13463 +ES VRJST036ZY0X,ES20M14,1698,1712.25,1698,1712.25,11,1240 +ES VU1EHIDJYLMP,ES19U14,1700,1700,1700,1700,6,240 +ES VWJ060NWX98H,ES19Z14,1692.875,1704.125,1677.00,1696.50,0,105 +ES XCZJLC9NOB29,ES20H20,0,0,0,0,0, +ES XFH59UK0MYO1,ES19M20,0,0,0,0,0, +ES XHYQYCUDLM9T,ES18U20,0,0,0,0,0, +ES XKGCMV4QK9VL,ES18Z20,0,0,0,0,0, +ES XMXYBDF3IXHD,ES19H21,0,0,0,0,0, diff --git a/Data/future/cme/universes/es/20131028.csv b/Data/future/cme/universes/es/20131028.csv new file mode 100644 index 000000000000..3360bee9bef7 --- /dev/null +++ b/Data/future/cme/universes/es/20131028.csv @@ -0,0 +1,11 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES VMKLFZIH2MTD,ES20Z13,1761.5,1768.25,1754.5,1767.75,1032392,2741642 +ES VP274HSU1AF5,ES21H14,1754.75,1761.25,1748.25,1760.75,1431,28318 +ES VRJST036ZY0X,ES20M14,1750.25,1753.75,1750.25,1753.5,7,1349 +ES VU1EHIDJYLMP,ES19U14,1737,1742.75,1737,1742.75,2,239 +ES VWJ060NWX98H,ES19Z14,1732.875,1740.875,1732.625,1740.875,0,105 +ES XCZJLC9NOB29,ES20H20,0,0,0,0,0, +ES XFH59UK0MYO1,ES19M20,0,0,0,0,0, +ES XHYQYCUDLM9T,ES18U20,0,0,0,0,0, +ES XKGCMV4QK9VL,ES18Z20,0,0,0,0,0, +ES XMXYBDF3IXHD,ES19H21,0,0,0,0,0, diff --git a/Data/future/cme/universes/es/20131125.csv b/Data/future/cme/universes/es/20131125.csv new file mode 100644 index 000000000000..de0cfbbbf4bb --- /dev/null +++ b/Data/future/cme/universes/es/20131125.csv @@ -0,0 +1,11 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES VMKLFZIH2MTD,ES20Z13,1802.25,1807,1798.75,1802.75,907025,2780581 +ES VP274HSU1AF5,ES21H14,1796.25,1800.25,1792.25,1796.25,2852,81762 +ES VRJST036ZY0X,ES20M14,1790,1792,1786,1788.75,26,1770 +ES VU1EHIDJYLMP,ES19U14,1781.75,1788,1780.00,1786.5,0,235 +ES VWJ060NWX98H,ES19Z14,1774.25,1774.25,1774.25,1774.25,0,120 +ES XCZJLC9NOB29,ES20H20,0,0,0,0,0, +ES XFH59UK0MYO1,ES19M20,0,0,0,0,0, +ES XHYQYCUDLM9T,ES18U20,0,0,0,0,0, +ES XKGCMV4QK9VL,ES18Z20,0,0,0,0,0, +ES XMXYBDF3IXHD,ES19H21,0,0,0,0,0, diff --git a/Data/future/cme/universes/es/20131217.csv b/Data/future/cme/universes/es/20131217.csv new file mode 100644 index 000000000000..bc23ccdf6d8c --- /dev/null +++ b/Data/future/cme/universes/es/20131217.csv @@ -0,0 +1,6 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES VU1EHIDJYLMP,ES19U14,1765,1792,1765,1792,6,690 +ES VP274HSU1AF5,ES21H14,1777.25,1806.75,1760.75,1803.75,2107664,2580060 +ES VMKLFZIH2MTD,ES20Z13,1783.25,1812.75,1767.25,1810,258842,823841 +ES VWJ060NWX98H,ES19Z14,1752.5,1752.5,1752.5,1752.5,1,129 +ES VRJST036ZY0X,ES20M14,1769.25,1798.75,1754,1797.25,585,2980 diff --git a/Data/future/cme/universes/es/20131219.csv b/Data/future/cme/universes/es/20131219.csv new file mode 100644 index 000000000000..4484429934bf --- /dev/null +++ b/Data/future/cme/universes/es/20131219.csv @@ -0,0 +1,6 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES VU1EHIDJYLMP,ES19U14,1788.75,1790.25,1787.75,1789.75,0,690 +ES VP274HSU1AF5,ES21H14,1804.5,1817.75,1802.5,1816.5,1134383,2658894 +ES VRJST036ZY0X,ES20M14,1798.25,1811,1796,1796,721,3131 +ES VZ0LUIY9VWU9,ES20H15,1779.75,1799.375,1779.75,1798.875,0, +ES VWJ060NWX98H,ES19Z14,1787.25,1793.75,1787.25,1793.75,3,130 diff --git a/Data/future/cme/universes/es/20131226.csv b/Data/future/cme/universes/es/20131226.csv new file mode 100644 index 000000000000..e95877b1c0ac --- /dev/null +++ b/Data/future/cme/universes/es/20131226.csv @@ -0,0 +1,10 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES VP274HSU1AF5,ES21H14,1839.25,1840,1833.25,1836.75,544201,2758851 +ES VRJST036ZY0X,ES20M14,1832.25,1832.75,1828.25,1829.75,305,4063 +ES VU1EHIDJYLMP,ES19U14,1822.75,1822.75,1822.75,1822.75,1,701 +ES VWJ060NWX98H,ES19Z14,1814.00,1819.75,1808.875,1817.125,0,130 +ES XCZJLC9NOB29,ES20H20,0,0,0,0,0, +ES XFH59UK0MYO1,ES19M20,0,0,0,0,0, +ES XHYQYCUDLM9T,ES18U20,0,0,0,0,0, +ES XKGCMV4QK9VL,ES18Z20,0,0,0,0,0, +ES XMXYBDF3IXHD,ES19H21,0,0,0,0,0, diff --git a/Data/future/cme/universes/es/20131227.csv b/Data/future/cme/universes/es/20131227.csv new file mode 100644 index 000000000000..eab05ef5c2ce --- /dev/null +++ b/Data/future/cme/universes/es/20131227.csv @@ -0,0 +1,10 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES VP274HSU1AF5,ES21H14,1836.5,1838.5,1833.5,1835.5,496091,2754443 +ES VRJST036ZY0X,ES20M14,1829.75,1831.5,1827,1827,291,4956 +ES VU1EHIDJYLMP,ES19U14,1824,1824,1821.25,1821.25,26,724 +ES VWJ060NWX98H,ES19Z14,1814.25,1814.25,1814.25,1814.25,1,130 +ES XCZJLC9NOB29,ES20H20,0,0,0,0,0, +ES XFH59UK0MYO1,ES19M20,0,0,0,0,0, +ES XHYQYCUDLM9T,ES18U20,0,0,0,0,0, +ES XKGCMV4QK9VL,ES18Z20,0,0,0,0,0, +ES XMXYBDF3IXHD,ES19H21,0,0,0,0,0, diff --git a/Data/future/cme/universes/es/20140224.csv b/Data/future/cme/universes/es/20140224.csv new file mode 100644 index 000000000000..1f54b04fb57c --- /dev/null +++ b/Data/future/cme/universes/es/20140224.csv @@ -0,0 +1,10 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES VP274HSU1AF5,ES21H14,1845.25,1851,1837.25,1847,1375175,3108523 +ES VRJST036ZY0X,ES20M14,1838.5,1843.75,1830.75,1840,2989,79519 +ES VU1EHIDJYLMP,ES19U14,1829,1836.25,1825,1827,38,2777 +ES VWJ060NWX98H,ES19Z14,1828,1828,1820.5,1824,7,163 +ES XCZJLC9NOB29,ES20H20,0,0,0,0,0, +ES XFH59UK0MYO1,ES19M20,0,0,0,0,0, +ES XHYQYCUDLM9T,ES18U20,0,0,0,0,0, +ES XKGCMV4QK9VL,ES18Z20,0,0,0,0,0, +ES XMXYBDF3IXHD,ES19H21,0,0,0,0,0, diff --git a/Data/future/cme/universes/es/20140225.csv b/Data/future/cme/universes/es/20140225.csv new file mode 100644 index 000000000000..9c0d82e36baf --- /dev/null +++ b/Data/future/cme/universes/es/20140225.csv @@ -0,0 +1,10 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES VP274HSU1AF5,ES21H14,1846.25,1853.25,1838,1842.75,1267294,3111778 +ES VRJST036ZY0X,ES20M14,1839.5,1845.75,1831.25,1835.5,2027,80602 +ES VU1EHIDJYLMP,ES19U14,1828,1836,1826.25,1826.25,24,2791 +ES VWJ060NWX98H,ES19Z14,1828,1828,1820.5,1824,0,164 +ES XCZJLC9NOB29,ES20H20,0,0,0,0,0, +ES XFH59UK0MYO1,ES19M20,0,0,0,0,0, +ES XHYQYCUDLM9T,ES18U20,0,0,0,0,0, +ES XKGCMV4QK9VL,ES18Z20,0,0,0,0,0, +ES XMXYBDF3IXHD,ES19H21,0,0,0,0,0, diff --git a/Data/future/cme/universes/es/20140318.csv b/Data/future/cme/universes/es/20140318.csv new file mode 100644 index 000000000000..062a8c92db34 --- /dev/null +++ b/Data/future/cme/universes/es/20140318.csv @@ -0,0 +1,10 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES VP274HSU1AF5,ES21H14,1871.75,1874.5,1849.5,1857.25,199135,1166011 +ES VRJST036ZY0X,ES20M14,1865,1867.5,1842,1849.75,1402590,2756352 +ES VU1EHIDJYLMP,ES19U14,1856,1860,1836.25,1843.25,536,3582 +ES VWJ060NWX98H,ES19Z14,1851.25,1852.75,1832.25,1840,40,653 +ES XCZJLC9NOB29,ES20H20,0,0,0,0,0, +ES XFH59UK0MYO1,ES19M20,0,0,0,0,0, +ES XHYQYCUDLM9T,ES18U20,0,0,0,0,0, +ES XKGCMV4QK9VL,ES18Z20,0,0,0,0,0, +ES XMXYBDF3IXHD,ES19H21,0,0,0,0,0, diff --git a/Data/future/cme/universes/es/20140320.csv b/Data/future/cme/universes/es/20140320.csv new file mode 100644 index 000000000000..d607d5c03526 --- /dev/null +++ b/Data/future/cme/universes/es/20140320.csv @@ -0,0 +1,9 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES VRJST036ZY0X,ES20M14,1872.5,1876.75,1855.5,1858.75,1460397,2814864 +ES VU1EHIDJYLMP,ES19U14,1865,1869,1848.75,1851,693,3958 +ES VWJ060NWX98H,ES19Z14,1860,1860,1843.25,1843.25,29,660 +ES XCZJLC9NOB29,ES20H20,0,0,0,0,0, +ES XFH59UK0MYO1,ES19M20,0,0,0,0,0, +ES XHYQYCUDLM9T,ES18U20,0,0,0,0,0, +ES XKGCMV4QK9VL,ES18Z20,0,0,0,0,0, +ES XMXYBDF3IXHD,ES19H21,0,0,0,0,0, diff --git a/Data/future/cme/universes/es/20140425.csv b/Data/future/cme/universes/es/20140425.csv new file mode 100644 index 000000000000..a717d72d59cb --- /dev/null +++ b/Data/future/cme/universes/es/20140425.csv @@ -0,0 +1,9 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES VRJST036ZY0X,ES20M14,1865.25,1871.75,1844,1866.25,1847973,2816864 +ES VU1EHIDJYLMP,ES19U14,1857.75,1863.75,1836.75,1858.75,2059,14595 +ES VWJ060NWX98H,ES19Z14,1846,1855.5,1831.5,1831.5,30,2276 +ES XCZJLC9NOB29,ES20H20,0,0,0,0,0, +ES XFH59UK0MYO1,ES19M20,0,0,0,0,0, +ES XHYQYCUDLM9T,ES18U20,0,0,0,0,0, +ES XKGCMV4QK9VL,ES18Z20,0,0,0,0,0, +ES XMXYBDF3IXHD,ES19H21,0,0,0,0,0, diff --git a/Data/future/cme/universes/es/20140606.csv b/Data/future/cme/universes/es/20140606.csv new file mode 100644 index 000000000000..4be07c759a67 --- /dev/null +++ b/Data/future/cme/universes/es/20140606.csv @@ -0,0 +1,9 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES VRJST036ZY0X,ES20M14,1947.5,1954.75,1945.75,1949.25,866912,2967325 +ES VU1EHIDJYLMP,ES19U14,1940.25,1947.25,1938.5,1941.75,15881,197991 +ES VWJ060NWX98H,ES19Z14,1932.25,1938.5,1931,1935.75,155,5918 +ES XCZJLC9NOB29,ES20H20,0,0,0,0,0, +ES XFH59UK0MYO1,ES19M20,0,0,0,0,0, +ES XHYQYCUDLM9T,ES18U20,0,0,0,0,0, +ES XKGCMV4QK9VL,ES18Z20,0,0,0,0,0, +ES XMXYBDF3IXHD,ES19H21,0,0,0,0,0, diff --git a/Data/future/cme/universes/es/20140609.csv b/Data/future/cme/universes/es/20140609.csv new file mode 100644 index 000000000000..00ac1bcc591c --- /dev/null +++ b/Data/future/cme/universes/es/20140609.csv @@ -0,0 +1,9 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES VRJST036ZY0X,ES20M14,1947.5,1951.5,1943,1951.5,770240,2880779 +ES VU1EHIDJYLMP,ES19U14,1940,1944.25,1935.75,1944,27380,328900 +ES VWJ060NWX98H,ES19Z14,1933.5,1936,1928.25,1936,78,6106 +ES XCZJLC9NOB29,ES20H20,0,0,0,0,0, +ES XFH59UK0MYO1,ES19M20,0,0,0,0,0, +ES XHYQYCUDLM9T,ES18U20,0,0,0,0,0, +ES XKGCMV4QK9VL,ES18Z20,0,0,0,0,0, +ES XMXYBDF3IXHD,ES19H21,0,0,0,0,0, diff --git a/Data/future/cme/universes/es/20200102.csv b/Data/future/cme/universes/es/20200102.csv new file mode 100644 index 000000000000..4c8cbf337017 --- /dev/null +++ b/Data/future/cme/universes/es/20200102.csv @@ -0,0 +1,6 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES XCZJLC9NOB29,ES20H20,3221.5,3246.25,3220.75,3235.5,1161694,2740796 +ES XFH59UK0MYO1,ES19M20,3222.5,3245,3222.25,3234.25,385,13647 +ES XHYQYCUDLM9T,ES18U20,3235,3244,3231.75,3234.75,18,182 +ES XKGCMV4QK9VL,ES18Z20,3254.5,3254.5,3220.625,3246.625,0,2225 +ES XMXYBDF3IXHD,ES19H21,3253.5,3256.0,3225.625,3237.375,0,6 diff --git a/Data/future/cme/universes/es/20200103.csv b/Data/future/cme/universes/es/20200103.csv new file mode 100644 index 000000000000..e3fb38a217c5 --- /dev/null +++ b/Data/future/cme/universes/es/20200103.csv @@ -0,0 +1,6 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES XCZJLC9NOB29,ES20H20,3214.5,3249.5,3213.25,3242.75,1049837,2688734 +ES XFH59UK0MYO1,ES19M20,3214.25,3249.25,3213.75,3242.5,309,16866 +ES XHYQYCUDLM9T,ES18U20,3236,3240,3236,3240,3,183 +ES XKGCMV4QK9VL,ES18Z20,3246.625,3255.5,3219.5,3233.375,0,2228 +ES XMXYBDF3IXHD,ES19H21,3237.375,3254.5,3219.875,3243.625,0,6 diff --git a/Data/future/cme/universes/es/20200106.csv b/Data/future/cme/universes/es/20200106.csv new file mode 100644 index 000000000000..befbdea8e597 --- /dev/null +++ b/Data/future/cme/universes/es/20200106.csv @@ -0,0 +1,6 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES XCZJLC9NOB29,ES20H20,3239.5,3244.75,3226,3233,904566,2689622 +ES XFH59UK0MYO1,ES19M20,3240.25,3244.25,3226,3233,378,17542 +ES XHYQYCUDLM9T,ES18U20,3240.25,3240.25,3240.25,3240.25,2,183 +ES XKGCMV4QK9VL,ES18Z20,3242.75,3242.75,3242.75,3242.75,1,2229 +ES XMXYBDF3IXHD,ES19H21,3241.25,3241.25,3241.25,3241.25,1,7 diff --git a/Data/future/cme/universes/es/20200107.csv b/Data/future/cme/universes/es/20200107.csv new file mode 100644 index 000000000000..7ffd1383810f --- /dev/null +++ b/Data/future/cme/universes/es/20200107.csv @@ -0,0 +1,6 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES XCZJLC9NOB29,ES20H20,3239,3267.75,3236,3259.75,1287728,2724061 +ES XFH59UK0MYO1,ES19M20,3239.25,3267.5,3237.5,3260.5,725,19465 +ES XHYQYCUDLM9T,ES18U20,3258.5,3268.75,3258.5,3268.75,9,261 +ES XKGCMV4QK9VL,ES18Z20,3242.75,3242.75,3242.75,3242.75,0,2229 +ES XMXYBDF3IXHD,ES19H21,3241.25,3241.25,3241.25,3241.25,0,7 diff --git a/Data/future/cme/universes/es/20200131.csv b/Data/future/cme/universes/es/20200131.csv new file mode 100644 index 000000000000..0a48fd83a76a --- /dev/null +++ b/Data/future/cme/universes/es/20200131.csv @@ -0,0 +1,6 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES XCZJLC9NOB29,ES20H20,3239.25,3267.25,3237.75,3245,1264053,2629999 +ES XFH59UK0MYO1,ES19M20,3238.5,3267,3238.5,3244.75,824,53906 +ES XHYQYCUDLM9T,ES18U20,3255.25,3260,3243.75,3243.75,109,373 +ES XKGCMV4QK9VL,ES18Z20,3223.875,3287.5,3202.00,3256.5,0,2236 +ES XMXYBDF3IXHD,ES19H21,3226.875,3268.875,3226.875,3255.875,0,9 diff --git a/Data/future/cme/universes/es/20200203.csv b/Data/future/cme/universes/es/20200203.csv new file mode 100644 index 000000000000..2bf84d7bca41 --- /dev/null +++ b/Data/future/cme/universes/es/20200203.csv @@ -0,0 +1,6 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES XCZJLC9NOB29,ES20H20,3286.5,3305.25,3282.25,3300.25,1138902,2639813 +ES XFH59UK0MYO1,ES19M20,3286.25,3305.25,3283,3300.75,1010,55029 +ES XHYQYCUDLM9T,ES18U20,3286,3301.75,3286,3301.75,10,356 +ES XKGCMV4QK9VL,ES18Z20,3256.5,3332.625,3244.5,3299.375,0,2236 +ES XMXYBDF3IXHD,ES19H21,3255.875,3308.75,3255.875,3302.625,0,9 diff --git a/Data/future/cme/universes/es/20200204.csv b/Data/future/cme/universes/es/20200204.csv new file mode 100644 index 000000000000..ee49cac6cdc3 --- /dev/null +++ b/Data/future/cme/universes/es/20200204.csv @@ -0,0 +1,6 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES XCZJLC9NOB29,ES20H20,3328,3338,3311.75,3335.5,1333875,2685462 +ES XFH59UK0MYO1,ES19M20,3328.5,3338.25,3312.75,3336,1167,56578 +ES XHYQYCUDLM9T,ES18U20,3325,3335.75,3314.25,3335.75,8,351 +ES XKGCMV4QK9VL,ES18Z20,3299.375,3357,3277.00,3324.875,0,2236 +ES XMXYBDF3IXHD,ES19H21,3302.625,3336.125,3302.625,3334.125,0,9 diff --git a/Data/future/cme/universes/es/20200205.csv b/Data/future/cme/universes/es/20200205.csv new file mode 100644 index 000000000000..cff899f7bc9d --- /dev/null +++ b/Data/future/cme/universes/es/20200205.csv @@ -0,0 +1,6 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES XCZJLC9NOB29,ES20H20,3344,3348.25,3332.75,3348,971587,2703568 +ES XFH59UK0MYO1,ES19M20,3344,3347.75,3333.5,3347.75,623,56610 +ES XHYQYCUDLM9T,ES18U20,3338.25,3343.5,3338.25,3342,6,351 +ES XKGCMV4QK9VL,ES18Z20,3324.875,3383.375,3305.375,3342.625,0,2236 +ES XMXYBDF3IXHD,ES19H21,3334.125,3352.375,3332.0,3344.375,0,9 diff --git a/Data/future/cme/universes/es/20200206.csv b/Data/future/cme/universes/es/20200206.csv new file mode 100644 index 000000000000..612cc1196d77 --- /dev/null +++ b/Data/future/cme/universes/es/20200206.csv @@ -0,0 +1,6 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES XCZJLC9NOB29,ES20H20,3333,3341.25,3320.75,3323,1167584,2703568 +ES XFH59UK0MYO1,ES19M20,3333.25,3341.25,3321,3323,749,56610 +ES XHYQYCUDLM9T,ES18U20,3325.25,3339.75,3325,3325,3,351 +ES XKGCMV4QK9VL,ES18Z20,3342.625,3371.875,2601.875,2634.75,0,2236 +ES XMXYBDF3IXHD,ES19H21,3344.375,3347.875,3320.375,3328.625,0,9 diff --git a/Data/future/cme/universes/es/20200207.csv b/Data/future/cme/universes/es/20200207.csv new file mode 100644 index 000000000000..cd92fe2b0726 --- /dev/null +++ b/Data/future/cme/universes/es/20200207.csv @@ -0,0 +1,6 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES XCZJLC9NOB29,ES20H20,3316.5,3353.5,3316.25,3352.25,884236,2701377 +ES XFH59UK0MYO1,ES19M20,3316.5,3353.25,3316.5,3351.75,692,61129 +ES XHYQYCUDLM9T,ES18U20,3326.25,3352.25,3326.25,3352.25,6,512 +ES XKGCMV4QK9VL,ES18Z20,2634.75,3394.625,2597.375,3361.625,0,2236 +ES XMXYBDF3IXHD,ES19H21,3328.625,3397.625,3317,3380,0,9 diff --git a/Data/future/cme/universes/es/20200210.csv b/Data/future/cme/universes/es/20200210.csv new file mode 100644 index 000000000000..ab918856b3ab --- /dev/null +++ b/Data/future/cme/universes/es/20200210.csv @@ -0,0 +1,6 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES XCZJLC9NOB29,ES20H20,3366.25,3374.5,3351.75,3359.25,1130697,2714705 +ES XFH59UK0MYO1,ES19M20,3366.25,3374.25,3352,3359,839,61472 +ES XHYQYCUDLM9T,ES18U20,3369.75,3369.75,3354.75,3359,27,709 +ES XKGCMV4QK9VL,ES18Z20,3361.625,3404.75,3319.625,3387.5,0,2236 +ES XMXYBDF3IXHD,ES19H21,3369,3369,3362,3362,4,9 diff --git a/Data/future/cme/universes/es/20200211.csv b/Data/future/cme/universes/es/20200211.csv new file mode 100644 index 000000000000..e16534cac2b8 --- /dev/null +++ b/Data/future/cme/universes/es/20200211.csv @@ -0,0 +1,6 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES XCZJLC9NOB29,ES20H20,3372.5,3381.5,3368.5,3380.5,894802,2732274 +ES XFH59UK0MYO1,ES19M20,3372.75,3382,3369,3381,781,63951 +ES XHYQYCUDLM9T,ES18U20,3375,3375.5,3370.5,3374.5,9,708 +ES XKGCMV4QK9VL,ES18Z20,3387.5,3408,3342.50,3376.375,0,2236 +ES XMXYBDF3IXHD,ES19H21,3369,3369,3362,3362,0,9 diff --git a/Data/future/cme/universes/es/20201006.csv b/Data/future/cme/universes/es/20201006.csv new file mode 100644 index 000000000000..0ad08946b998 --- /dev/null +++ b/Data/future/cme/universes/es/20201006.csv @@ -0,0 +1,3 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES XKGCMV4QK9VL,ES18Z20,3381.25,3416.75,3381,3407.75,1004399,2460030 +ES XMXYBDF3IXHD,ES19H21,3379.75,3407,3376,3396,184,18144 diff --git a/Data/future/comex/map_files/gc.csv b/Data/future/comex/map_files/gc.csv index c395b0b03b2c..a3dd7573c34a 100644 --- a/Data/future/comex/map_files/gc.csv +++ b/Data/future/comex/map_files/gc.csv @@ -66,4 +66,7 @@ 20191203,gc xaou1hjh8xi5,COMEX,2 20191204,gc xblbskm1rtst,COMEX,2 20191226,gc xaou1hjh8xi5,COMEX,0 -20191231,gc xblbskm1rtst,COMEX,1 \ No newline at end of file +20191231,gc xblbskm1rtst,COMEX,1 +20200123,gc xccwb6urwyal,COMEX,3 +20200128,gc xblbskm1rtst,COMEX,0 +20200131,gc xccwb6urwyal,COMEX,1 \ No newline at end of file diff --git a/Data/future/comex/universes/gc/20131004.csv b/Data/future/comex/universes/gc/20131004.csv new file mode 100644 index 000000000000..16d50a50f42f --- /dev/null +++ b/Data/future/comex/universes/gc/20131004.csv @@ -0,0 +1,22 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +GC VL5E74HP3EE5,GC29V13,1319.5,1325.4,1319.5,1323,51,392 +GC VLWYPQQF8IVX,GC26X13,1317.2,1328.7,1317.2,1322,59,152 +GC VMRHKN2NLWV1,GC27Z13,1318.2,1329.5,1316.9,1323.3,55392,222940 +GC VOFJUCDY9XNH,GC26G14,1318.8,1329.6,1318,1323.2,1141,39098 +GC VQ3M41P8XYFX,GC28J14,1319.2,1328,1319,1324.2,779,21473 +GC VRPPHKA7GGWT,GC26M14,1330.2,1330.2,1324.4,1325.2,186,18785 +GC VTER7CYO78V1,GC27Q14,1328.7,1328.7,1327.4,1327.4,22,7345 +GC VV4SD90B0RZ1,GC29V14,1326.2,1326.2,1326.2,1326.2,35,3988 +GC VWSUMYBLOSRH,GC29Z14,1330.7,1331.2,1327.6,1328.5,544,16316 +GC VYDYKDJE4K2L,GC25G15,1318.0,1336.4,1318.0,1330.3,0,1821 +GC W030A67UVC0T,GC28J15,1319.3,1337.5,1319.3,1331.3,0,870 +GC W1P3NOSTDUHP,GC26M15,1333.8,1333.8,1333.8,1333.8,10,9552 +GC W3E5DHHA4MFX,GC27Q15,1322.15,1341.15,1322.15,1334.65,0, +GC W6S8T2U7M6CD,GC29Z15,1326.4,1326.4,1326.4,1326.4,11,13163 +GC WBRG63EXJHJX,GC28M16,1335.8,1335.8,1335.8,1335.8,11,1796 +GC WGRMZ7CTJJX9,GC28Z16,1348.9,1366.35,1348.9,1360.4,0,5237 +GC WLQUC7XJGV4T,GC28M17,1360.8,1381.1,1360.8,1375.0,0,1405 +GC WQQ1P8I9E6CD,GC27Z17,1384.25,1402.85,1384.25,1396.8,0,6641 +GC WVP9292ZBHJX,GC27M18,1416.25,1432.45,1416.25,1426.35,0,167 +GC X0PFVD0VBJX9,GC27Z18,1438.25,1456.8,1438.25,1450.7,0,33 +GC X5NNSA8F63Z1,GC26M19,1451.0,1469.55,1451.0,1463.45,0, diff --git a/Data/future/comex/universes/gc/20131007.csv b/Data/future/comex/universes/gc/20131007.csv new file mode 100644 index 000000000000..6ce6656f2cd0 --- /dev/null +++ b/Data/future/comex/universes/gc/20131007.csv @@ -0,0 +1,22 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +GC VL5E74HP3EE5,GC29V13,1326.3,1330,1321.5,1321.5,40,328 +GC VLWYPQQF8IVX,GC26X13,1323.8,1328.7,1319.3,1319.3,50,149 +GC VMRHKN2NLWV1,GC27Z13,1323.7,1330.8,1318,1319.6,59294,221210 +GC VOFJUCDY9XNH,GC26G14,1325,1330.8,1318.9,1320.3,2680,38782 +GC VQ3M41P8XYFX,GC28J14,1330,1331,1320.5,1321.2,3555,22464 +GC VRPPHKA7GGWT,GC26M14,1329.1,1331.1,1324,1324,128,18910 +GC VTER7CYO78V1,GC27Q14,1332.6,1333.1,1328,1328.2,189,7333 +GC VV4SD90B0RZ1,GC29V14,1326.2,1326.2,1326.2,1326.2,0,3988 +GC VWSUMYBLOSRH,GC29Z14,1334.5,1334.5,1327,1327,92,16243 +GC VYDYKDJE4K2L,GC25G15,1330.3,1337.6,1325.1,1326.5,0,1821 +GC W030A67UVC0T,GC28J15,1331.3,1338.9,1326.25,1327.65,0,870 +GC W1P3NOSTDUHP,GC26M15,1339.1,1339.1,1335.2,1339,78,9570 +GC W3E5DHHA4MFX,GC27Q15,1334.65,1342.0,1329.25,1330.65,0,300 +GC W6S8T2U7M6CD,GC29Z15,1345.5,1345.5,1338.6,1341.8,41,13159 +GC WBRG63EXJHJX,GC28M16,1335.8,1335.8,1335.8,1335.8,0,1796 +GC WGRMZ7CTJJX9,GC28Z16,1360.4,1367.8,1355.5,1356.9,0,5237 +GC WLQUC7XJGV4T,GC28M17,1375.0,1386.7,1370.35,1375.45,0,1405 +GC WQQ1P8I9E6CD,GC27Z17,1396.8,1405.95,1393.35,1394.75,0,6641 +GC WVP9292ZBHJX,GC27M18,1426.35,1433.6,1420.95,1422.35,0,167 +GC X0PFVD0VBJX9,GC27Z18,1450.7,1457.95,1445.3,1446.7,0,33 +GC X5NNSA8F63Z1,GC26M19,1463.45,1470.7,1458.05,1459.45,0, diff --git a/Data/future/comex/universes/gc/20131008.csv b/Data/future/comex/universes/gc/20131008.csv new file mode 100644 index 000000000000..49af84255c5f --- /dev/null +++ b/Data/future/comex/universes/gc/20131008.csv @@ -0,0 +1,22 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +GC VL5E74HP3EE5,GC29V13,1308.4,1311,1295.3,1306,105,327 +GC VLWYPQQF8IVX,GC26X13,1308.2,1314,1294.5,1304.8,183,144 +GC VMRHKN2NLWV1,GC27Z13,1307.5,1314.5,1294.6,1305.7,76250,223324 +GC VOFJUCDY9XNH,GC26G14,1308.7,1315,1295.8,1305.1,1502,38682 +GC VQ3M41P8XYFX,GC28J14,1310.3,1310.3,1297.3,1307.2,1161,22860 +GC VRPPHKA7GGWT,GC26M14,1299.8,1313.6,1299.7,1313.6,197,18821 +GC VTER7CYO78V1,GC27Q14,1301.3,1310.2,1301.3,1310.2,17,7354 +GC VV4SD90B0RZ1,GC29V14,1306.2,1315.9,1305.2,1315.9,207,3989 +GC VWSUMYBLOSRH,GC29Z14,1305,1315.2,1301.8,1313.2,163,16397 +GC VYDYKDJE4K2L,GC25G15,1326.5,1326.5,1301.65,1312.9,0,1821 +GC W030A67UVC0T,GC28J15,1327.65,1327.65,1302.6,1314.1,0,875 +GC W1P3NOSTDUHP,GC26M15,1307.3,1309.6,1306.6,1309.1,6,9571 +GC W3E5DHHA4MFX,GC27Q15,1330.65,1330.65,1303.1,1314.4,0,300 +GC W6S8T2U7M6CD,GC29Z15,1345.5,1345.5,1338.6,1341.8,0,13159 +GC WBRG63EXJHJX,GC28M16,1345.75,1345.75,1320.75,1331.75,0,1796 +GC WGRMZ7CTJJX9,GC28Z16,1356.9,1356.9,1332.05,1343.2,0,5237 +GC WLQUC7XJGV4T,GC28M17,1375.45,1375.45,1344.2,1355.35,0,1405 +GC WQQ1P8I9E6CD,GC27Z17,1394.75,1394.75,1369.9,1380.5,0,6641 +GC WVP9292ZBHJX,GC27M18,1422.35,1422.35,1397.65,1408.8,0,167 +GC X0PFVD0VBJX9,GC27Z18,1446.7,1446.7,1422.0,1433.15,0,33 +GC X5NNSA8F63Z1,GC26M19,1459.45,1459.45,1434.75,1445.9,0, diff --git a/Data/future/comex/universes/gc/20131009.csv b/Data/future/comex/universes/gc/20131009.csv new file mode 100644 index 000000000000..7d24729881d1 --- /dev/null +++ b/Data/future/comex/universes/gc/20131009.csv @@ -0,0 +1,22 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +GC VL5E74HP3EE5,GC29V13,1296.1,1301,1285,1285,27,296 +GC VLWYPQQF8IVX,GC26X13,1296.7,1301.3,1284.7,1286.1,92,161 +GC VMRHKN2NLWV1,GC27Z13,1298.3,1303.6,1281,1287.5,56569,226118 +GC VOFJUCDY9XNH,GC26G14,1298.4,1303.6,1282,1288,1555,39098 +GC VQ3M41P8XYFX,GC28J14,1297.5,1302.9,1286.5,1286.5,935,23837 +GC VRPPHKA7GGWT,GC26M14,1298.7,1303.4,1292.8,1292.8,220,18506 +GC VTER7CYO78V1,GC27Q14,1301.2,1301.2,1301.2,1301.2,5,7382 +GC VV4SD90B0RZ1,GC29V14,1306.2,1315.9,1305.2,1315.9,0,3987 +GC VWSUMYBLOSRH,GC29Z14,1301.9,1302.8,1287.5,1290.6,46,16489 +GC VYDYKDJE4K2L,GC25G15,1312.9,1312.9,1287.35,1293.85,0,1826 +GC W030A67UVC0T,GC28J15,1314.1,1314.1,1288.85,1295.35,0,875 +GC W1P3NOSTDUHP,GC26M15,1309.9,1317.2,1307.8,1317.2,45,9566 +GC W3E5DHHA4MFX,GC27Q15,1314.4,1315.95,1292.35,1298.85,0,300 +GC W6S8T2U7M6CD,GC29Z15,1323.6,1323.7,1323.6,1323.6,143,13153 +GC WBRG63EXJHJX,GC28M16,1333.1,1333.1,1332.9,1332.9,50,1796 +GC WGRMZ7CTJJX9,GC28Z16,1345.5,1345.5,1345.1,1345.5,120,5122 +GC WLQUC7XJGV4T,GC28M17,1355.35,1355.35,1330.45,1336.95,0,1405 +GC WQQ1P8I9E6CD,GC27Z17,1380.5,1380.5,1380.5,1380.5,2,6641 +GC WVP9292ZBHJX,GC27M18,1408.8,1408.8,1384.05,1390.55,0,167 +GC X0PFVD0VBJX9,GC27Z18,1433.15,1433.15,1407.75,1414.25,0,33 +GC X5NNSA8F63Z1,GC26M19,1445.9,1445.9,1420.6,1427.1,0, diff --git a/Data/future/comex/universes/gc/20131015.csv b/Data/future/comex/universes/gc/20131015.csv new file mode 100644 index 000000000000..95419d004fad --- /dev/null +++ b/Data/future/comex/universes/gc/20131015.csv @@ -0,0 +1,24 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +GC VL5E74HP3EE5,GC29V13,1272.1,1281.6,1269.2,1281,59,286 +GC VLWYPQQF8IVX,GC26X13,1278.7,1282.3,1268.9,1279.7,196,248 +GC VMRHKN2NLWV1,GC27Z13,1278.9,1283,1268.6,1281.7,82163,221406 +GC VOFJUCDY9XNH,GC26G14,1279.8,1283.4,1269.7,1282.8,3980,44893 +GC VQ3M41P8XYFX,GC28J14,1276.8,1283.1,1273,1282,1122,25482 +GC VRPPHKA7GGWT,GC26M14,1273.5,1284.9,1273.4,1284.9,163,18927 +GC VTER7CYO78V1,GC27Q14,1274.4,1277,1273,1277,0,7416 +GC VV4SD90B0RZ1,GC29V14,1271.1,1278.2,1271.1,1278.2,0,4015 +GC VWSUMYBLOSRH,GC29Z14,1276.4,1287.8,1276.3,1285.9,177,17094 +GC VYDYKDJE4K2L,GC25G15,1280.1,1290.1,1274.1,1290.1,0,1830 +GC W030A67UVC0T,GC28J15,1289.15,1290.55,1258.25,1289.3,0,875 +GC W1P3NOSTDUHP,GC26M15,1282.2,1291.2,1282.2,1282.2,187,9498 +GC W3E5DHHA4MFX,GC27Q15,1283.9,1283.9,1283.9,1283.9,30,630 +GC W6S8T2U7M6CD,GC29Z15,1288.2,1295.7,1288.1,1295.7,184,13016 +GC WBRG63EXJHJX,GC28M16,1297.4,1307.5,1296.5,1304.2,98,1704 +GC WGRMZ7CTJJX9,GC28Z16,1309.2,1315.5,1309.2,1315.3,70,4982 +GC WLQUC7XJGV4T,GC28M17,1329.9,1330.9,1316.6,1329.9,0,1405 +GC WQQ1P8I9E6CD,GC27Z17,1350.65,1356.25,1337.55,1349.7,0,6616 +GC WVP9292ZBHJX,GC27M18,1373.65,1374.95,1360.65,1373.95,0,162 +GC X0PFVD0VBJX9,GC27Z18,1409.5,1410.8,1396.5,1409.8,0,33 +GC X5NNSA8F63Z1,GC26M19,1422.3,1423.6,1409.3,1422.6,0, +GC XD6FPZTU7L3X,GC27H20,0,0,0,0,0, +GC XE1Y0ZJ8NQ8T,GC28J20,0,0,0,0,0, diff --git a/Data/future/comex/universes/gc/20131016.csv b/Data/future/comex/universes/gc/20131016.csv new file mode 100644 index 000000000000..db0156b6df1d --- /dev/null +++ b/Data/future/comex/universes/gc/20131016.csv @@ -0,0 +1,24 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +GC VL5E74HP3EE5,GC29V13,1314.1,1320.8,1313.9,1319.9,50,234 +GC VLWYPQQF8IVX,GC26X13,1313.9,1322.8,1313.9,1320,118,248 +GC VMRHKN2NLWV1,GC27Z13,1315.7,1324.2,1313.6,1320,63350,225000 +GC VOFJUCDY9XNH,GC26G14,1316.2,1324.7,1314.5,1320,503,44762 +GC VQ3M41P8XYFX,GC28J14,1318.9,1324.5,1318.6,1320.5,201,25471 +GC VRPPHKA7GGWT,GC26M14,1318.1,1325.3,1318.1,1324,89,18962 +GC VTER7CYO78V1,GC27Q14,1322.8,1326.2,1322.8,1324.4,220,7490 +GC VV4SD90B0RZ1,GC29V14,1323,1327.1,1322.1,1322.1,124,4064 +GC VWSUMYBLOSRH,GC29Z14,1319.3,1328.1,1319.3,1324.6,292,17141 +GC VYDYKDJE4K2L,GC25G15,1330.1,1330.1,1325,1325,2,1831 +GC W030A67UVC0T,GC28J15,1326.2,1330.3,1326.1,1330.1,60,935 +GC W1P3NOSTDUHP,GC26M15,1327.8,1331.4,1326.9,1326.9,126,9524 +GC W3E5DHHA4MFX,GC27Q15,1283.9,1283.9,1283.9,1283.9,0,630 +GC W6S8T2U7M6CD,GC29Z15,1334.2,1335.8,1297.2,1334.9,66,13017 +GC WBRG63EXJHJX,GC28M16,1297.4,1307.5,1296.5,1304.2,0,1704 +GC WGRMZ7CTJJX9,GC28Z16,1356.1,1356.1,1317.6,1317.6,50,4982 +GC WLQUC7XJGV4T,GC28M17,1329.9,1370.85,1329.9,1366.75,0,1405 +GC WQQ1P8I9E6CD,GC27Z17,1349.7,1393.25,1349.7,1386.5,0,6616 +GC WVP9292ZBHJX,GC27M18,1373.95,1415.7,1373.95,1400.1,0,162 +GC X0PFVD0VBJX9,GC27Z18,1409.8,1446.55,1409.8,1431.95,0,33 +GC X5NNSA8F63Z1,GC26M19,1422.6,1464.8,1422.6,1460.7,0, +GC XD6FPZTU7L3X,GC27H20,0,0,0,0,0, +GC XE1Y0ZJ8NQ8T,GC28J20,0,0,0,0,0, diff --git a/Data/future/comex/universes/gc/20131028.csv b/Data/future/comex/universes/gc/20131028.csv new file mode 100644 index 000000000000..69994d9d31f3 --- /dev/null +++ b/Data/future/comex/universes/gc/20131028.csv @@ -0,0 +1,23 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +GC VLWYPQQF8IVX,GC26X13,1347.9,1351.7,1343.8,1344.9,39,56 +GC VMRHKN2NLWV1,GC27Z13,1348.6,1352.9,1342.4,1344.8,47850,210712 +GC VOFJUCDY9XNH,GC26G14,1349.1,1353.6,1343.4,1346,3578,55934 +GC VQ3M41P8XYFX,GC28J14,1349.2,1353.5,1344.4,1346.3,232,26572 +GC VRPPHKA7GGWT,GC26M14,1349.6,1353.2,1345.6,1346.8,48,22382 +GC VTER7CYO78V1,GC27Q14,1353.1,1353.1,1346,1347.7,42,7908 +GC VV4SD90B0RZ1,GC29V14,1353.1,1354.1,1348.1,1348.1,12,4344 +GC VWSUMYBLOSRH,GC29Z14,1351.3,1352.9,1349.6,1349.6,200,18194 +GC VYDYKDJE4K2L,GC25G15,1357.85,1358.2,1347.75,1350.05,0,1816 +GC W030A67UVC0T,GC28J15,1358.75,1359.35,1348.7,1351.1,0,1246 +GC W1P3NOSTDUHP,GC26M15,1360.1,1360.5,1350.0,1352.35,0,9546 +GC W3E5DHHA4MFX,GC27Q15,1355.4,1356,1355.4,1356,35,1080 +GC W6S8T2U7M6CD,GC29Z15,1368.2,1368.2,1367.8,1367.8,0,12522 +GC WBRG63EXJHJX,GC28M16,1373.85,1374.9,1364.0,1365.05,0,1624 +GC WGRMZ7CTJJX9,GC28Z16,1377.4,1378.6,1377.4,1378.6,2,4928 +GC WLQUC7XJGV4T,GC28M17,1404.25,1404.75,1385.35,1386.7,0,1405 +GC WQQ1P8I9E6CD,GC27Z17,1409.0,1409.45,1400.85,1403.2,0,6674 +GC WVP9292ZBHJX,GC27M18,1434.6,1435.1,1424.7,1427.0,0,160 +GC X0PFVD0VBJX9,GC27Z18,1478.35,1478.85,1468.45,1470.75,0,58 +GC X5NNSA8F63Z1,GC26M19,1493.0,1493.5,1483.1,1485.4,0, +GC XD6FPZTU7L3X,GC27H20,0,0,0,0,0, +GC XE1Y0ZJ8NQ8T,GC28J20,0,0,0,0,0, diff --git a/Data/future/comex/universes/gc/20131125.csv b/Data/future/comex/universes/gc/20131125.csv new file mode 100644 index 000000000000..22420315b5d3 --- /dev/null +++ b/Data/future/comex/universes/gc/20131125.csv @@ -0,0 +1,22 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +GC VMRHKN2NLWV1,GC27Z13,1241.8,1247.5,1239.2,1242.2,78423,33656 +GC VOFJUCDY9XNH,GC26G14,1241.9,1247.6,1239.2,1242.3,56523,220045 +GC VQ3M41P8XYFX,GC28J14,1244.1,1248.4,1240.3,1243.6,9314,41157 +GC VRPPHKA7GGWT,GC26M14,1244.5,1248.9,1241.3,1244.1,1757,25772 +GC VTER7CYO78V1,GC27Q14,1244.9,1249.7,1243,1245.1,81,9790 +GC VV4SD90B0RZ1,GC29V14,1245.7,1248.3,1244.7,1248.3,86,5175 +GC VWSUMYBLOSRH,GC29Z14,1247,1249,1244.9,1246.8,146,18686 +GC VYDYKDJE4K2L,GC25G15,1255.45,1255.45,1243.15,1246.45,0,1821 +GC W030A67UVC0T,GC28J15,1256.25,1256.25,1244.75,1247.5,0,3826 +GC W1P3NOSTDUHP,GC26M15,1248.5,1248.5,1248.5,1248.5,12,6337 +GC W3E5DHHA4MFX,GC27Q15,1249.8,1249.8,1249.8,1249.8,10,1775 +GC W6S8T2U7M6CD,GC29Z15,1252.2,1253.2,1251.8,1253.2,6,13018 +GC WBRG63EXJHJX,GC28M16,1262.1,1262.1,1262.1,1262.1,0,1174 +GC WGRMZ7CTJJX9,GC28Z16,1267,1267.6,1267,1267.6,2,5925 +GC WLQUC7XJGV4T,GC28M17,1285.7,1285.7,1274.05,1277.25,0,1403 +GC WQQ1P8I9E6CD,GC27Z17,1278.8,1278.8,1278.8,1278.8,0,3814 +GC WVP9292ZBHJX,GC27M18,1322.15,1322.15,1310.45,1313.65,0,610 +GC X0PFVD0VBJX9,GC27Z18,1340.8,1340.8,1329.1,1332.3,0,58 +GC X5NNSA8F63Z1,GC26M19,1363.0,1363.0,1351.35,1354.55,0, +GC XD6FPZTU7L3X,GC27H20,0,0,0,0,0, +GC XE1Y0ZJ8NQ8T,GC28J20,0,0,0,0,0, diff --git a/Data/future/comex/universes/gc/20131217.csv b/Data/future/comex/universes/gc/20131217.csv new file mode 100644 index 000000000000..1f713e7bb7a3 --- /dev/null +++ b/Data/future/comex/universes/gc/20131217.csv @@ -0,0 +1,22 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +GC VMRHKN2NLWV1,GC27Z13,1232,1245.1,1217,1220.3,107,1483 +GC VOFJUCDY9XNH,GC26G14,1233.1,1244,1215.2,1217.6,109052,234178 +GC VQ3M41P8XYFX,GC28J14,1233.5,1244.2,1216.4,1218.2,2929,49176 +GC VRPPHKA7GGWT,GC26M14,1234.3,1242.9,1217.4,1218.9,462,27494 +GC VTER7CYO78V1,GC27Q14,1232.6,1236.7,1218.5,1221.4,51,10573 +GC VV4SD90B0RZ1,GC29V14,1235.3,1237.9,1232.6,1237.9,72,5408 +GC VWSUMYBLOSRH,GC29Z14,1234.4,1241.8,1220,1220,396,19025 +GC VYDYKDJE4K2L,GC25G15,1234.9,1248.6,1220.05,1222.3,0,2317 +GC W030A67UVC0T,GC28J15,1229.2,1229.2,1228.9,1228.9,6,4111 +GC W1P3NOSTDUHP,GC26M15,1235.4,1251.3,1235.4,1237.3,0,4966 +GC W3E5DHHA4MFX,GC27Q15,1237.15,1250.85,1222.3,1224.55,0,1775 +GC W6S8T2U7M6CD,GC29Z15,1243,1243,1229.1,1229.1,8,12364 +GC WBRG63EXJHJX,GC28M16,1248.2,1250.6,1248.2,1250.6,17,1200 +GC WGRMZ7CTJJX9,GC28Z16,1258.4,1258.4,1258.4,1258.4,10,5937 +GC WLQUC7XJGV4T,GC28M17,1267.15,1280.7,1252.15,1254.4,0,1403 +GC WQQ1P8I9E6CD,GC27Z17,1283.4,1283.4,1283.4,1283.4,5,4046 +GC WVP9292ZBHJX,GC27M18,1304.15,1314.1,1285.55,1287.8,0,610 +GC X0PFVD0VBJX9,GC27Z18,1322.15,1337.2,1305.65,1307.9,0,58 +GC X5NNSA8F63Z1,GC26M19,1355.2,1372.1,1343.55,1345.8,0, +GC XD6FPZTU7L3X,GC27H20,0,0,0,0,0, +GC XE1Y0ZJ8NQ8T,GC28J20,0,0,0,0,0, diff --git a/Data/future/comex/universes/gc/20140225.csv b/Data/future/comex/universes/gc/20140225.csv new file mode 100644 index 000000000000..9557ddb74ddb --- /dev/null +++ b/Data/future/comex/universes/gc/20140225.csv @@ -0,0 +1,20 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +GC VQ3M41P8XYFX,GC28J14,1333.2,1335.8,1322.3,1330.6,71874,234717 +GC VRPPHKA7GGWT,GC26M14,1333.3,1336,1322.8,1331.2,2131,54408 +GC VTER7CYO78V1,GC27Q14,1333.4,1336,1323.5,1329.9,248,18889 +GC VV4SD90B0RZ1,GC29V14,1335.7,1335.7,1325.9,1329.4,42,7561 +GC VWSUMYBLOSRH,GC29Z14,1333.4,1335.7,1324.5,1329.9,277,22396 +GC VYDYKDJE4K2L,GC25G15,1342.8,1342.8,1318.8,1332.65,0,3315 +GC W030A67UVC0T,GC28J15,1332.2,1332.2,1332.2,1332.2,5,4456 +GC W1P3NOSTDUHP,GC26M15,1336,1336,1330,1335,37,7780 +GC W3E5DHHA4MFX,GC27Q15,1347.5,1348.8,1344.3,1344.3,0,4605 +GC W6S8T2U7M6CD,GC29Z15,1334.3,1336.7,1334.3,1336.7,55,11740 +GC WBRG63EXJHJX,GC28M16,1358.3,1358.3,1358.3,1358.3,0,3355 +GC WGRMZ7CTJJX9,GC28Z16,1352.2,1352.2,1352.1,1352.2,23,6825 +GC WLQUC7XJGV4T,GC28M17,1381.65,1381.65,1362.5,1370.15,0,1384 +GC WQQ1P8I9E6CD,GC27Z17,1399.6,1400.4,1396.3,1400,0,4630 +GC WVP9292ZBHJX,GC27M18,1420.25,1420.25,1400.65,1408.0,0,860 +GC X0PFVD0VBJX9,GC27Z18,1442.65,1442.65,1422.35,1430.65,0,110 +GC X5NNSA8F63Z1,GC26M19,1467.05,1467.05,1447.8,1455.15,0, +GC XD6FPZTU7L3X,GC27H20,0,0,0,0,0, +GC XE1Y0ZJ8NQ8T,GC28J20,0,0,0,0,0, diff --git a/Data/future/comex/universes/gc/20200102.csv b/Data/future/comex/universes/gc/20200102.csv new file mode 100644 index 000000000000..f27a5fd0392d --- /dev/null +++ b/Data/future/comex/universes/gc/20200102.csv @@ -0,0 +1,3 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +GC XD6FPZTU7L3X,GC27H20,1550.6,1558.3,1550.6,1558,60,29 +GC XE1Y0ZJ8NQ8T,GC28J20,1556.7,1562.2,1553.1,1561.3,1746,134125 diff --git a/Data/future/comex/universes/gc/20200103.csv b/Data/future/comex/universes/gc/20200103.csv new file mode 100644 index 000000000000..729d0adaa24c --- /dev/null +++ b/Data/future/comex/universes/gc/20200103.csv @@ -0,0 +1,3 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +GC XD6FPZTU7L3X,GC27H20,1579,1579.4,1566.8,1571.4,135,158 +GC XE1Y0ZJ8NQ8T,GC28J20,1585,1585,1569.1,1574.1,2397,142219 diff --git a/Data/future/eurex/universes/fesx/20240531.csv b/Data/future/eurex/universes/fesx/20240531.csv new file mode 100644 index 000000000000..2854f3e7ff74 --- /dev/null +++ b/Data/future/eurex/universes/fesx/20240531.csv @@ -0,0 +1,3 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +FESX YJHOAMPYKRS5,FESX21M24,5057.89,5061.92,5057.89,5059.9,2147, +FESX YLZ9Z50BJFDX,FESX20U24,0,0,0,0,0, diff --git a/Data/future/eurex/universes/fesx/20240603.csv b/Data/future/eurex/universes/fesx/20240603.csv new file mode 100644 index 000000000000..9f17d60ba806 --- /dev/null +++ b/Data/future/eurex/universes/fesx/20240603.csv @@ -0,0 +1,3 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +FESX YJHOAMPYKRS5,FESX21M24,5046.79,5047.8,5045.78,5047.8,1016, +FESX YLZ9Z50BJFDX,FESX20U24,5050,5050,5050,5050,0, diff --git a/Data/future/eurex/universes/fesx/20240620.csv b/Data/future/eurex/universes/fesx/20240620.csv new file mode 100644 index 000000000000..a8a44259c061 --- /dev/null +++ b/Data/future/eurex/universes/fesx/20240620.csv @@ -0,0 +1,3 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +FESX YLZ9Z50BJFDX,FESX20U24,4990,4990,4986,4988,1466, +FESX YOGVNNAOI2ZP,FESX20Z24,0,0,0,0,0, diff --git a/Data/future/hkfe/universes/hsi/20131017.csv b/Data/future/hkfe/universes/hsi/20131017.csv new file mode 100644 index 000000000000..400b7a1622bf --- /dev/null +++ b/Data/future/hkfe/universes/hsi/20131017.csv @@ -0,0 +1,4 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +HSI VL6DN7UV65S9,HSI30V13,22964,23338.5,22964,23306.5,0, +HSI VLYXLXGRE1FT,HSI28X13,23193,23339,23166,23300,681, +HSI VMUFWX65U6KP,HSI30Z13,23205,23320,23189,23320,148, diff --git a/Data/future/hkfe/universes/hsi/20131018.csv b/Data/future/hkfe/universes/hsi/20131018.csv new file mode 100644 index 000000000000..50382d3ce7f4 --- /dev/null +++ b/Data/future/hkfe/universes/hsi/20131018.csv @@ -0,0 +1,4 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +HSI VL6DN7UV65S9,HSI30V13,23306.5,23527.5,23306.5,23401.5,0, +HSI VLYXLXGRE1FT,HSI28X13,23310,23533,23310,23409,0, +HSI VMUFWX65U6KP,HSI30Z13,23316,23320,23316,23320,21, diff --git a/Data/future/hkfe/universes/hsi/20131021.csv b/Data/future/hkfe/universes/hsi/20131021.csv new file mode 100644 index 000000000000..bb61ef5eb805 --- /dev/null +++ b/Data/future/hkfe/universes/hsi/20131021.csv @@ -0,0 +1,4 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +HSI VL6DN7UV65S9,HSI30V13,23324,23378,23248,23308,40186, +HSI VLYXLXGRE1FT,HSI28X13,23350,23382,23260,23312,521, +HSI VMUFWX65U6KP,HSI30Z13,23370,23388,23280,23324,85, diff --git a/Data/future/hkfe/universes/hsi/20131022.csv b/Data/future/hkfe/universes/hsi/20131022.csv new file mode 100644 index 000000000000..b4f6002efba5 --- /dev/null +++ b/Data/future/hkfe/universes/hsi/20131022.csv @@ -0,0 +1,4 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +HSI VL6DN7UV65S9,HSI30V13,23401.5,23527,22949,22990,0, +HSI VLYXLXGRE1FT,HSI28X13,23409,23540.5,22956.5,22995.5,0, +HSI VMUFWX65U6KP,HSI30Z13,23322.5,23552,22971,23010,0, diff --git a/Data/future/hkfe/universes/hsi/20131023.csv b/Data/future/hkfe/universes/hsi/20131023.csv new file mode 100644 index 000000000000..a69e59e3e18c --- /dev/null +++ b/Data/future/hkfe/universes/hsi/20131023.csv @@ -0,0 +1,4 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +HSI VL6DN7UV65S9,HSI30V13,22940,22960,22738,22794,75400, +HSI VLYXLXGRE1FT,HSI28X13,22940,22960,22742,22794,2308, +HSI VMUFWX65U6KP,HSI30Z13,22997,23020.5,22983,23010,0, diff --git a/Data/future/hkfe/universes/hsi/20131024.csv b/Data/future/hkfe/universes/hsi/20131024.csv new file mode 100644 index 000000000000..c5ffc8104c11 --- /dev/null +++ b/Data/future/hkfe/universes/hsi/20131024.csv @@ -0,0 +1,4 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +HSI VL6DN7UV65S9,HSI30V13,22990,22990,22611,22659,0, +HSI VLYXLXGRE1FT,HSI28X13,22995.5,22995.5,22613.5,22663.5,0, +HSI VMUFWX65U6KP,HSI30Z13,0,0,0,0,0, diff --git a/Data/future/hkfe/universes/hsi/20131025.csv b/Data/future/hkfe/universes/hsi/20131025.csv new file mode 100644 index 000000000000..ddd2fc236f83 --- /dev/null +++ b/Data/future/hkfe/universes/hsi/20131025.csv @@ -0,0 +1,4 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +HSI VL6DN7UV65S9,HSI30V13,22659,22848.5,22659,22784.5,0, +HSI VLYXLXGRE1FT,HSI28X13,22740,22850,22728,22788,8225, +HSI VMUFWX65U6KP,HSI30Z13,22753,22861,22753,22788,174, diff --git a/Data/future/hkfe/universes/hsi/20131028.csv b/Data/future/hkfe/universes/hsi/20131028.csv new file mode 100644 index 000000000000..c5b7723f727d --- /dev/null +++ b/Data/future/hkfe/universes/hsi/20131028.csv @@ -0,0 +1,4 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +HSI VL6DN7UV65S9,HSI30V13,22724,22998,22720,22867,60860, +HSI VLYXLXGRE1FT,HSI28X13,22663.5,23003,22663.5,22872.5,0, +HSI VMUFWX65U6KP,HSI30Z13,22745,23010,22745,22887,354, diff --git a/Data/future/hkfe/universes/hsi/20131029.csv b/Data/future/hkfe/universes/hsi/20131029.csv new file mode 100644 index 000000000000..09b193441197 --- /dev/null +++ b/Data/future/hkfe/universes/hsi/20131029.csv @@ -0,0 +1,3 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +HSI VLYXLXGRE1FT,HSI28X13,22873.5,22887,22865.5,22872.5,0, +HSI VMUFWX65U6KP,HSI30Z13,22995,23335,22967,23309,561, diff --git a/Data/futureoption/cme/universes/dc/20120401/20111230.csv b/Data/futureoption/cme/universes/dc/20120401/20111230.csv new file mode 100644 index 000000000000..b2505ccf57d6 --- /dev/null +++ b/Data/futureoption/cme/universes/dc/20120401/20111230.csv @@ -0,0 +1,86 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +DC V5E8P9SH0U0X,DC01H12,17.5,17.7,17.45,17.56,450, +DC V5E8P9UYKFES|DC V5E8P9SH0U0X,DC01H12 120401C00015000,2.595,2.725,2.565,2.625,0, +DC V5E8PGSOLJNO|DC V5E8P9SH0U0X,DC01H12 120401C00015250,2.365,2.495,2.335,2.395,0, +DC V5E8PAI4155W|DC V5E8P9SH0U0X,DC01H12 120401C00015500,2.145,2.265,2.115,2.17,0, +DC V5E8PH0YAA4K|DC V5E8P9SH0U0X,DC01H12 120401C00015750,1.925,2.05,1.905,1.955,0, +DC V5E8P9V4IRGK|DC V5E8P9SH0U0X,DC01H12 120401C00016000,1.725,1.885,1.71,1.745,0, +DC V5E8PH97Z0LG|DC V5E8P9SH0U0X,DC01H12 120401C00016250,1.525,1.695,1.515,1.555,0, +DC V5E8PAJRKHNO|DC V5E8P9SH0U0X,DC01H12 120401C00016500,1.345,1.515,1.335,1.365,0, +DC V5E8PHHHNR2C|DC V5E8P9SH0U0X,DC01H12 120401C00016750,1.175,1.34,1.165,1.195,0, +DC V5E8P9VAH3IC|DC V5E8P9SH0U0X,DC01H12 120401C00017000,1.015,1.21,1.005,1.035,0, +DC V5E8PHPRCHJ8|DC V5E8P9SH0U0X,DC01H12 120401C00017250,0.87,1.075,0.865,0.885,0, +DC V5E8PALF3U5G|DC V5E8P9SH0U0X,DC01H12 120401C00017500,0.74,0.94,0.735,0.755,0, +DC V5E8PHY11804|DC V5E8P9SH0U0X,DC01H12 120401C00017750,0.62,0.815,0.615,0.635,0, +DC V5E8P9VGFFK4|DC V5E8P9SH0U0X,DC01H12 120401C00018000,0.41,0.71,0.38,0.415,0, +DC V5E8PI6APYH0|DC V5E8P9SH0U0X,DC01H12 120401C00018250,0.285,0.605,0.205,0.29,2, +DC V5E8PAN2N6N8|DC V5E8P9SH0U0X,DC01H12 120401C00018500,0.29,0.415,0.23,0.23,2, +DC V5E8PIEKEOXW|DC V5E8P9SH0U0X,DC01H12 120401C00018750,0.28,0.44,0.28,0.29,0, +DC V5E8P9VMDRLW|DC V5E8P9SH0U0X,DC01H12 120401C00019000,0.24,0.295,0.175,0.19,4, +DC V5E8PIMU3FES|DC V5E8P9SH0U0X,DC01H12 120401C00019250,0.18,0.32,0.175,0.185,6, +DC V5E8PAOQ6J50|DC V5E8P9SH0U0X,DC01H12 120401C00019500,0.14,0.265,0.14,0.15,0, +DC V5E8PIV3S5VO|DC V5E8P9SH0U0X,DC01H12 120401C00019750,0.11,0.225,0.11,0.11,0, +DC V5E8P9ST87XG|DC V5E8P9SH0U0X,DC01H12 120401C00020000,0.08,0.185,0.07,0.075,0, +DC V5E8PJ3DGWCK|DC V5E8P9SH0U0X,DC01H12 120401C00020250,0.065,0.08,0.065,0.07,0, +DC V5E8PAQDPVMS|DC V5E8P9SH0U0X,DC01H12 120401C00020500,0.11,0.12,0.11,0.11,0, +DC V5E8PJBN5MTG|DC V5E8P9SH0U0X,DC01H12 120401C00020750,0.1,0.1,0.09,0.1,0, +DC V5E8P9VYAFPG|DC V5E8P9SH0U0X,DC01H12 120401C00021000,0.09,0.09,0.09,0.09,0, +DC V5E8PJJWUDAC|DC V5E8P9SH0U0X,DC01H12 120401C00021250,0.08,0.08,0.08,0.08,0, +DC V5E8PAS1984K|DC V5E8P9SH0U0X,DC01H12 120401C00021500,0.07,0.08,0.07,0.07,0, +DC V5E8PJS6J3R8|DC V5E8P9SH0U0X,DC01H12 120401C00021750,0.07,0.07,0.07,0.07,0, +DC V5E8P9W48RR8|DC V5E8P9SH0U0X,DC01H12 120401C00022000,0.07,0.07,0.07,0.07,0, +DC V5E8PK0G7U84|DC V5E8P9SH0U0X,DC01H12 120401C00022250,0.07,0.07,0.06,0.07,0, +DC V5E8PATOSKMC|DC V5E8P9SH0U0X,DC01H12 120401C00022500,0.06,0.06,0.06,0.06,0, +DC 2Z4I8UPT648HW|DC V5E8P9SH0U0X,DC01H12 120401P00009000,0.06,0.06,0.06,0.06,0, +DC 2Z4I8UU0NMJES|DC V5E8P9SH0U0X,DC01H12 120401P00009250,0.06,0.06,0.06,0.06,0, +DC 2Z4I8UQ7E2VL0|DC V5E8P9SH0U0X,DC01H12 120401P00009500,0.06,0.06,0.06,0.06,0, +DC 2Z4I8UU8XB9VO|DC V5E8P9SH0U0X,DC01H12 120401P00009750,0.06,0.06,0.06,0.06,0, +DC 2Z4I8UPRUJP9G|DC V5E8P9SH0U0X,DC01H12 120401P00010000,0.06,0.06,0.06,0.06,0, +DC 2Z4I8UUH700CK|DC V5E8P9SH0U0X,DC01H12 120401P00010250,0.06,0.06,0.06,0.06,0, +DC 2Z4I8UQ91M82S|DC V5E8P9SH0U0X,DC01H12 120401P00010500,0.06,0.06,0.06,0.06,0, +DC 2Z4I8UUPGOQTG|DC V5E8P9SH0U0X,DC01H12 120401P00010750,0.06,0.06,0.06,0.06,0, +DC 2Z4I8UPTI0WLG|DC V5E8P9SH0U0X,DC01H12 120401P00011000,0.06,0.06,0.06,0.06,0, +DC 2Z4I8UUXQDHAC|DC V5E8P9SH0U0X,DC01H12 120401P00011250,0.06,0.06,0.06,0.06,0, +DC 2Z4I8UQAP5KKK|DC V5E8P9SH0U0X,DC01H12 120401P00011500,0.06,0.06,0.06,0.06,0, +DC 2Z4I8UV6027R8|DC V5E8P9SH0U0X,DC01H12 120401P00011750,0.06,0.06,0.06,0.06,0, +DC 2Z4I8UPTNZ8N8|DC V5E8P9SH0U0X,DC01H12 120401P00012000,0.06,0.06,0.06,0.06,0, +DC 2Z4I8UVE9QY84|DC V5E8P9SH0U0X,DC01H12 120401P00012250,0.06,0.06,0.06,0.06,0, +DC 2Z4I8UQCCOX2C|DC V5E8P9SH0U0X,DC01H12 120401P00012500,0.06,0.06,0.06,0.06,0, +DC 2Z4I8UVMJFOP0|DC V5E8P9SH0U0X,DC01H12 120401P00012750,0.06,0.06,0.06,0.06,0, +DC 2Z4I8UPTTXKP0|DC V5E8P9SH0U0X,DC01H12 120401P00013000,0.1,0.1,0.06,0.1,0, +DC 2Z4I8UVUT4F5W|DC V5E8P9SH0U0X,DC01H12 120401P00013250,0.06,0.06,0.06,0.06,0, +DC 2Z4I8UQE089K4|DC V5E8P9SH0U0X,DC01H12 120401P00013500,0.07,0.07,0.06,0.07,0, +DC 2Z4I8UW32T5MS|DC V5E8P9SH0U0X,DC01H12 120401P00013750,0.07,0.07,0.07,0.07,0, +DC 2Z4I8UPTZVWQS|DC V5E8P9SH0U0X,DC01H12 120401P00014000,0.035,0.035,0.035,0.035,0, +DC 2Z4I8UWBCHW3O|DC V5E8P9SH0U0X,DC01H12 120401P00014250,0.055,0.055,0.055,0.055,0, +DC 2Z4I8UQFNRM1W|DC V5E8P9SH0U0X,DC01H12 120401P00014500,0.065,0.075,0.06,0.065,0, +DC 2Z4I8UWJM6MKK|DC V5E8P9SH0U0X,DC01H12 120401P00014750,0.06,0.08,0.055,0.06,0, +DC 2Z4I8UPU5U8SK|DC V5E8P9SH0U0X,DC01H12 120401P00015000,0.07,0.11,0.065,0.07,0, +DC 2Z4I8UWRVVD1G|DC V5E8P9SH0U0X,DC01H12 120401P00015250,0.08,0.145,0.07,0.07,0, +DC 2Z4I8UQHBAYJO|DC V5E8P9SH0U0X,DC01H12 120401P00015500,0.275,0.275,0.125,0.275,7, +DC 2Z4I8UX05K3IC|DC V5E8P9SH0U0X,DC01H12 120401P00015750,0.14,0.23,0.125,0.135,0, +DC 2Z4I8UPUBSKUC|DC V5E8P9SH0U0X,DC01H12 120401P00016000,0.36,0.4,0.17,0.36,9, +DC 2Z4I8UX8F8TZ8|DC V5E8P9SH0U0X,DC01H12 120401P00016250,0.24,0.35,0.22,0.23,0, +DC 2Z4I8UQIYUB1G|DC V5E8P9SH0U0X,DC01H12 120401P00016500,0.30,0.425,0.265,0.295,0, +DC 2Z4I8UXGOXKG4|DC V5E8P9SH0U0X,DC01H12 120401P00016750,0.38,0.505,0.355,0.37,0, +DC 2Z4I8UPUHQWW4|DC V5E8P9SH0U0X,DC01H12 120401P00017000,0.53,0.64,0.44,0.49,5, +DC 2Z4I8UXOYMAX0|DC V5E8P9SH0U0X,DC01H12 120401P00017250,0.575,0.72,0.54,0.565,0, +DC 2Z4I8UQKMDNJ8|DC V5E8P9SH0U0X,DC01H12 120401P00017500,0.695,0.84,0.65,0.68,0, +DC 2Z4I8UXX8B1DW|DC V5E8P9SH0U0X,DC01H12 120401P00017750,0.825,0.98,0.78,0.81,0, +DC 2Z4I8UPUNP8XW|DC V5E8P9SH0U0X,DC01H12 120401P00018000,0.97,1.115,0.91,0.955,0, +DC 2Z4I8UY5HZRUS|DC V5E8P9SH0U0X,DC01H12 120401P00018250,1.13,1.15,0.995,1.11,0, +DC 2Z4I8UQM9X010|DC V5E8P9SH0U0X,DC01H12 120401P00018500,1.305,1.325,1.21,1.28,0, +DC 2Z4I8UYDROIBO|DC V5E8P9SH0U0X,DC01H12 120401P00018750,1.485,1.505,1.385,1.465,0, +DC 2Z4I8UPUTNKZO|DC V5E8P9SH0U0X,DC01H12 120401P00019000,1.675,1.7,1.575,1.655,0, +DC 2Z4I8UYM1D8SK|DC V5E8P9SH0U0X,DC01H12 120401P00019250,1.88,1.905,1.765,1.855,0, +DC 2Z4I8UQNXGCIS|DC V5E8P9SH0U0X,DC01H12 120401P00019500,2.09,2.115,1.975,2.065,0, +DC 2Z4I8UYUB1Z9G|DC V5E8P9SH0U0X,DC01H12 120401P00019750,2.305,2.335,2.185,2.285,0, +DC 2Z4I8UPS0I1B8|DC V5E8P9SH0U0X,DC01H12 120401P00020000,2.535,2.56,2.405,2.505,0, +DC 2Z4I8UZ2KQPQC|DC V5E8P9SH0U0X,DC01H12 120401P00020250,2.765,2.79,2.635,2.735,0, +DC 2Z4I8UQPKZP0K|DC V5E8P9SH0U0X,DC01H12 120401P00020500,2.995,3.025,2.865,2.965,0, +DC 2Z4I8UZAUFG78|DC V5E8P9SH0U0X,DC01H12 120401P00020750,3.235,3.265,3.105,3.205,0, +DC 2Z4I8UPV5K938|DC V5E8P9SH0U0X,DC01H12 120401P00021000,3.475,3.505,3.34,3.445,0, +DC 2Z4I8UZJ446O4|DC V5E8P9SH0U0X,DC01H12 120401P00021250,3.715,3.745,3.585,3.685,0, +DC 2Z4I8UQR8J1IC|DC V5E8P9SH0U0X,DC01H12 120401P00021500,3.965,3.995,3.825,3.935,0, +DC 2Z4I8UZRDSX50|DC V5E8P9SH0U0X,DC01H12 120401P00021750,4.205,4.235,4.075,4.175,0, +DC 2Z4I8UPVBIL50|DC V5E8P9SH0U0X,DC01H12 120401P00022000,4.455,4.485,4.315,4.425,0, diff --git a/Data/futureoption/cme/universes/dc/20120401/20120103.csv b/Data/futureoption/cme/universes/dc/20120401/20120103.csv new file mode 100644 index 000000000000..7a54e3954e18 --- /dev/null +++ b/Data/futureoption/cme/universes/dc/20120401/20120103.csv @@ -0,0 +1,86 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +DC V5E8P9SH0U0X,DC01H12,17.5,17.7,17.45,17.56,0, +DC V5E8P9UYKFES|DC V5E8P9SH0U0X,DC01H12 120401C00015000,2.595,2.725,2.565,2.625,0, +DC V5E8PGSOLJNO|DC V5E8P9SH0U0X,DC01H12 120401C00015250,2.365,2.495,2.335,2.395,0, +DC V5E8PAI4155W|DC V5E8P9SH0U0X,DC01H12 120401C00015500,2.145,2.265,2.115,2.17,0, +DC V5E8PH0YAA4K|DC V5E8P9SH0U0X,DC01H12 120401C00015750,1.925,2.05,1.905,1.955,0, +DC V5E8P9V4IRGK|DC V5E8P9SH0U0X,DC01H12 120401C00016000,1.725,1.885,1.71,1.745,0, +DC V5E8PH97Z0LG|DC V5E8P9SH0U0X,DC01H12 120401C00016250,1.525,1.695,1.515,1.555,0, +DC V5E8PAJRKHNO|DC V5E8P9SH0U0X,DC01H12 120401C00016500,1.345,1.515,1.335,1.365,0, +DC V5E8PHHHNR2C|DC V5E8P9SH0U0X,DC01H12 120401C00016750,1.175,1.34,1.165,1.195,0, +DC V5E8P9VAH3IC|DC V5E8P9SH0U0X,DC01H12 120401C00017000,1.015,1.21,1.005,1.035,0, +DC V5E8PHPRCHJ8|DC V5E8P9SH0U0X,DC01H12 120401C00017250,0.88,1.075,0.875,0.895,0, +DC V5E8PALF3U5G|DC V5E8P9SH0U0X,DC01H12 120401C00017500,0.75,0.95,0.745,0.765,0, +DC V5E8PHY11804|DC V5E8P9SH0U0X,DC01H12 120401C00017750,0.63,0.825,0.625,0.645,0, +DC V5E8P9VGFFK4|DC V5E8P9SH0U0X,DC01H12 120401C00018000,0.42,0.72,0.39,0.425,0, +DC V5E8PI6APYH0|DC V5E8P9SH0U0X,DC01H12 120401C00018250,0.285,0.605,0.205,0.29,0, +DC V5E8PAN2N6N8|DC V5E8P9SH0U0X,DC01H12 120401C00018500,0.29,0.415,0.23,0.23,0, +DC V5E8PIEKEOXW|DC V5E8P9SH0U0X,DC01H12 120401C00018750,0.28,0.44,0.28,0.29,0, +DC V5E8P9VMDRLW|DC V5E8P9SH0U0X,DC01H12 120401C00019000,0.24,0.295,0.175,0.19,0, +DC V5E8PIMU3FES|DC V5E8P9SH0U0X,DC01H12 120401C00019250,0.18,0.32,0.175,0.185,0, +DC V5E8PAOQ6J50|DC V5E8P9SH0U0X,DC01H12 120401C00019500,0.14,0.265,0.14,0.15,0, +DC V5E8PIV3S5VO|DC V5E8P9SH0U0X,DC01H12 120401C00019750,0.11,0.225,0.11,0.11,0, +DC V5E8P9ST87XG|DC V5E8P9SH0U0X,DC01H12 120401C00020000,0.08,0.185,0.07,0.075,0, +DC V5E8PJ3DGWCK|DC V5E8P9SH0U0X,DC01H12 120401C00020250,0.065,0.08,0.065,0.07,0, +DC V5E8PAQDPVMS|DC V5E8P9SH0U0X,DC01H12 120401C00020500,0.11,0.12,0.11,0.11,0, +DC V5E8PJBN5MTG|DC V5E8P9SH0U0X,DC01H12 120401C00020750,0.1,0.1,0.09,0.1,0, +DC V5E8P9VYAFPG|DC V5E8P9SH0U0X,DC01H12 120401C00021000,0.09,0.09,0.09,0.09,0, +DC V5E8PJJWUDAC|DC V5E8P9SH0U0X,DC01H12 120401C00021250,0.08,0.08,0.08,0.08,0, +DC V5E8PAS1984K|DC V5E8P9SH0U0X,DC01H12 120401C00021500,0.07,0.08,0.07,0.07,0, +DC V5E8PJS6J3R8|DC V5E8P9SH0U0X,DC01H12 120401C00021750,0.07,0.07,0.07,0.07,0, +DC V5E8P9W48RR8|DC V5E8P9SH0U0X,DC01H12 120401C00022000,0.07,0.07,0.07,0.07,0, +DC V5E8PK0G7U84|DC V5E8P9SH0U0X,DC01H12 120401C00022250,0.07,0.07,0.06,0.07,0, +DC V5E8PATOSKMC|DC V5E8P9SH0U0X,DC01H12 120401C00022500,0.06,0.06,0.06,0.06,0, +DC 2Z4I8UPT648HW|DC V5E8P9SH0U0X,DC01H12 120401P00009000,0.06,0.06,0.06,0.06,0, +DC 2Z4I8UU0NMJES|DC V5E8P9SH0U0X,DC01H12 120401P00009250,0.06,0.06,0.06,0.06,0, +DC 2Z4I8UQ7E2VL0|DC V5E8P9SH0U0X,DC01H12 120401P00009500,0.06,0.06,0.06,0.06,0, +DC 2Z4I8UU8XB9VO|DC V5E8P9SH0U0X,DC01H12 120401P00009750,0.06,0.06,0.06,0.06,0, +DC 2Z4I8UPRUJP9G|DC V5E8P9SH0U0X,DC01H12 120401P00010000,0.06,0.06,0.06,0.06,0, +DC 2Z4I8UUH700CK|DC V5E8P9SH0U0X,DC01H12 120401P00010250,0.06,0.06,0.06,0.06,0, +DC 2Z4I8UQ91M82S|DC V5E8P9SH0U0X,DC01H12 120401P00010500,0.06,0.06,0.06,0.06,0, +DC 2Z4I8UUPGOQTG|DC V5E8P9SH0U0X,DC01H12 120401P00010750,0.06,0.06,0.06,0.06,0, +DC 2Z4I8UPTI0WLG|DC V5E8P9SH0U0X,DC01H12 120401P00011000,0.06,0.06,0.06,0.06,0, +DC 2Z4I8UUXQDHAC|DC V5E8P9SH0U0X,DC01H12 120401P00011250,0.06,0.06,0.06,0.06,0, +DC 2Z4I8UQAP5KKK|DC V5E8P9SH0U0X,DC01H12 120401P00011500,0.06,0.06,0.06,0.06,0, +DC 2Z4I8UV6027R8|DC V5E8P9SH0U0X,DC01H12 120401P00011750,0.06,0.06,0.06,0.06,0, +DC 2Z4I8UPTNZ8N8|DC V5E8P9SH0U0X,DC01H12 120401P00012000,0.06,0.06,0.06,0.06,0, +DC 2Z4I8UVE9QY84|DC V5E8P9SH0U0X,DC01H12 120401P00012250,0.06,0.06,0.06,0.06,0, +DC 2Z4I8UQCCOX2C|DC V5E8P9SH0U0X,DC01H12 120401P00012500,0.06,0.06,0.06,0.06,0, +DC 2Z4I8UVMJFOP0|DC V5E8P9SH0U0X,DC01H12 120401P00012750,0.06,0.06,0.06,0.06,0, +DC 2Z4I8UPTTXKP0|DC V5E8P9SH0U0X,DC01H12 120401P00013000,0.1,0.1,0.06,0.1,0, +DC 2Z4I8UVUT4F5W|DC V5E8P9SH0U0X,DC01H12 120401P00013250,0.06,0.06,0.06,0.06,0, +DC 2Z4I8UQE089K4|DC V5E8P9SH0U0X,DC01H12 120401P00013500,0.07,0.07,0.06,0.07,0, +DC 2Z4I8UW32T5MS|DC V5E8P9SH0U0X,DC01H12 120401P00013750,0.07,0.07,0.07,0.07,0, +DC 2Z4I8UPTZVWQS|DC V5E8P9SH0U0X,DC01H12 120401P00014000,0.035,0.035,0.035,0.035,0, +DC 2Z4I8UWBCHW3O|DC V5E8P9SH0U0X,DC01H12 120401P00014250,0.055,0.055,0.055,0.055,0, +DC 2Z4I8UQFNRM1W|DC V5E8P9SH0U0X,DC01H12 120401P00014500,0.065,0.075,0.06,0.065,0, +DC 2Z4I8UWJM6MKK|DC V5E8P9SH0U0X,DC01H12 120401P00014750,0.06,0.08,0.055,0.06,0, +DC 2Z4I8UPU5U8SK|DC V5E8P9SH0U0X,DC01H12 120401P00015000,0.07,0.11,0.065,0.07,0, +DC 2Z4I8UWRVVD1G|DC V5E8P9SH0U0X,DC01H12 120401P00015250,0.08,0.145,0.07,0.07,0, +DC 2Z4I8UQHBAYJO|DC V5E8P9SH0U0X,DC01H12 120401P00015500,0.275,0.275,0.125,0.275,0, +DC 2Z4I8UX05K3IC|DC V5E8P9SH0U0X,DC01H12 120401P00015750,0.14,0.23,0.125,0.135,0, +DC 2Z4I8UPUBSKUC|DC V5E8P9SH0U0X,DC01H12 120401P00016000,0.36,0.4,0.17,0.36,0, +DC 2Z4I8UX8F8TZ8|DC V5E8P9SH0U0X,DC01H12 120401P00016250,0.24,0.35,0.22,0.23,0, +DC 2Z4I8UQIYUB1G|DC V5E8P9SH0U0X,DC01H12 120401P00016500,0.30,0.425,0.265,0.295,0, +DC 2Z4I8UXGOXKG4|DC V5E8P9SH0U0X,DC01H12 120401P00016750,0.38,0.505,0.355,0.37,0, +DC 2Z4I8UPUHQWW4|DC V5E8P9SH0U0X,DC01H12 120401P00017000,0.53,0.64,0.44,0.49,0, +DC 2Z4I8UXOYMAX0|DC V5E8P9SH0U0X,DC01H12 120401P00017250,0.585,0.73,0.55,0.575,0, +DC 2Z4I8UQKMDNJ8|DC V5E8P9SH0U0X,DC01H12 120401P00017500,0.705,0.85,0.66,0.69,0, +DC 2Z4I8UXX8B1DW|DC V5E8P9SH0U0X,DC01H12 120401P00017750,0.835,0.99,0.79,0.82,0, +DC 2Z4I8UPUNP8XW|DC V5E8P9SH0U0X,DC01H12 120401P00018000,0.98,1.125,0.92,0.965,0, +DC 2Z4I8UY5HZRUS|DC V5E8P9SH0U0X,DC01H12 120401P00018250,1.13,1.15,0.995,1.11,0, +DC 2Z4I8UQM9X010|DC V5E8P9SH0U0X,DC01H12 120401P00018500,1.305,1.325,1.21,1.28,0, +DC 2Z4I8UYDROIBO|DC V5E8P9SH0U0X,DC01H12 120401P00018750,1.485,1.505,1.385,1.465,0, +DC 2Z4I8UPUTNKZO|DC V5E8P9SH0U0X,DC01H12 120401P00019000,1.675,1.7,1.575,1.655,0, +DC 2Z4I8UYM1D8SK|DC V5E8P9SH0U0X,DC01H12 120401P00019250,1.88,1.905,1.765,1.855,0, +DC 2Z4I8UQNXGCIS|DC V5E8P9SH0U0X,DC01H12 120401P00019500,2.09,2.115,1.975,2.065,0, +DC 2Z4I8UYUB1Z9G|DC V5E8P9SH0U0X,DC01H12 120401P00019750,2.305,2.335,2.185,2.285,0, +DC 2Z4I8UPS0I1B8|DC V5E8P9SH0U0X,DC01H12 120401P00020000,2.535,2.56,2.405,2.505,0, +DC 2Z4I8UZ2KQPQC|DC V5E8P9SH0U0X,DC01H12 120401P00020250,2.765,2.79,2.635,2.735,0, +DC 2Z4I8UQPKZP0K|DC V5E8P9SH0U0X,DC01H12 120401P00020500,2.995,3.025,2.865,2.965,0, +DC 2Z4I8UZAUFG78|DC V5E8P9SH0U0X,DC01H12 120401P00020750,3.235,3.265,3.105,3.205,0, +DC 2Z4I8UPV5K938|DC V5E8P9SH0U0X,DC01H12 120401P00021000,3.475,3.505,3.34,3.445,0, +DC 2Z4I8UZJ446O4|DC V5E8P9SH0U0X,DC01H12 120401P00021250,3.715,3.745,3.585,3.685,0, +DC 2Z4I8UQR8J1IC|DC V5E8P9SH0U0X,DC01H12 120401P00021500,3.965,3.995,3.825,3.935,0, +DC 2Z4I8UZRDSX50|DC V5E8P9SH0U0X,DC01H12 120401P00021750,4.205,4.235,4.075,4.175,0, +DC 2Z4I8UPVBIL50|DC V5E8P9SH0U0X,DC01H12 120401P00022000,4.455,4.485,4.315,4.425,0, diff --git a/Data/futureoption/cme/universes/es/20200320/20200102.csv b/Data/futureoption/cme/universes/es/20200320/20200102.csv new file mode 100644 index 000000000000..d9dcfcda97e9 --- /dev/null +++ b/Data/futureoption/cme/universes/es/20200320/20200102.csv @@ -0,0 +1,106 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES XCZJLC9NOB29,ES20H20,3221.5,3246.25,3220.75,3235.5,1161694, +ES XCZJLCA5YBC4|ES XCZJLC9NOB29,ES20H20 200320C03000000,0,0,0,0,0, +ES XCZJLDNG1RQC|ES XCZJLC9NOB29,ES20H20 200320C03010000,0,0,0,0,0, +ES XCZJLDNM03S4|ES XCZJLC9NOB29,ES20H20 200320C03020000,0,0,0,0,0, +ES XCZJLQ5XZD38|ES XCZJLC9NOB29,ES20H20 200320C03025000,0,0,0,0,0, +ES XCZJLDNRYFTW|ES XCZJLC9NOB29,ES20H20 200320C03030000,0,0,0,0,0, +ES XCZJLDNXWRVO|ES XCZJLC9NOB29,ES20H20 200320C03040000,0,0,0,0,0, +ES XCZJLDO3V3XG|ES XCZJLC9NOB29,ES20H20 200320C03050000,0,0,0,0,0, +ES XCZJLDO9TFZ8|ES XCZJLC9NOB29,ES20H20 200320C03060000,0,0,0,0,0, +ES XCZJLDOFRS10|ES XCZJLC9NOB29,ES20H20 200320C03070000,0,0,0,0,0, +ES XCZJLQE7O3K4|ES XCZJLC9NOB29,ES20H20 200320C03075000,0,0,0,0,0, +ES XCZJLDOLQ42S|ES XCZJLC9NOB29,ES20H20 200320C03080000,0,0,0,0,0, +ES XCZJLDOROG4K|ES XCZJLC9NOB29,ES20H20 200320C03090000,0,0,0,0,0, +ES XCZJLCESLJK4|ES XCZJLC9NOB29,ES20H20 200320C03100000,0,0,0,0,0, +ES XCZJLDP3L484|ES XCZJLC9NOB29,ES20H20 200320C03110000,0,0,0,0,0, +ES XCZJLDP9JG9W|ES XCZJLC9NOB29,ES20H20 200320C03120000,0,0,0,0,0, +ES XCZJLQMHCU10|ES XCZJLC9NOB29,ES20H20 200320C03125000,0,0,0,0,0, +ES XCZJLDPFHSBO|ES XCZJLC9NOB29,ES20H20 200320C03130000,0,0,0,0,0, +ES XCZJLDPLG4DG|ES XCZJLC9NOB29,ES20H20 200320C03140000,0,0,0,0,0, +ES XCZJLDPREGF8|ES XCZJLC9NOB29,ES20H20 200320C03150000,0,0,0,0,0, +ES XCZJLDPXCSH0|ES XCZJLC9NOB29,ES20H20 200320C03160000,0,0,0,0,0, +ES XCZJLDQ3B4IS|ES XCZJLC9NOB29,ES20H20 200320C03170000,0,0,0,0,0, +ES XCZJLQUR1KHW|ES XCZJLC9NOB29,ES20H20 200320C03175000,0,0,0,0,0, +ES XCZJLDQ99GKK|ES XCZJLC9NOB29,ES20H20 200320C03180000,0,0,0,0,0, +ES XCZJLDQF7SMC|ES XCZJLC9NOB29,ES20H20 200320C03190000,0,0,0,0,0, +ES XCZJLCEYJVLW|ES XCZJLC9NOB29,ES20H20 200320C03200000,0,0,0,0,0, +ES XCZJLDQR4GPW|ES XCZJLC9NOB29,ES20H20 200320C03210000,0,0,0,0,0, +ES XCZJLDQX2SRO|ES XCZJLC9NOB29,ES20H20 200320C03220000,0,0,0,0,0, +ES XCZJLDR314TG|ES XCZJLC9NOB29,ES20H20 200320C03230000,0,0,0,0,0, +ES XCZJLDR8ZGV8|ES XCZJLC9NOB29,ES20H20 200320C03240000,0,0,0,0,0, +ES XCZJLDREXSX0|ES XCZJLC9NOB29,ES20H20 200320C03250000,0,0,0,0,0, +ES XCZJLCFAGJPG|ES XCZJLC9NOB29,ES20H20 200320C03400000,0,0,0,0,0, +ES XCZJLDU275PG|ES XCZJLC9NOB29,ES20H20 200320C03410000,0,0,0,0,0, +ES XCZJLDU85HR8|ES XCZJLC9NOB29,ES20H20 200320C03420000,0,0,0,0,0, +ES XCZJLDUE3TT0|ES XCZJLC9NOB29,ES20H20 200320C03430000,0,0,0,0,0, +ES XCZJLDUK25US|ES XCZJLC9NOB29,ES20H20 200320C03440000,0,0,0,0,0, +ES XCZJLDUQ0HWK|ES XCZJLC9NOB29,ES20H20 200320C03450000,0,0,0,0,0, +ES XCZJLDUVYTYC|ES XCZJLC9NOB29,ES20H20 200320C03460000,0,0,0,0,0, +ES XCZJLDV1X604|ES XCZJLC9NOB29,ES20H20 200320C03470000,0,0,0,0,0, +ES XCZJLDV7VI1W|ES XCZJLC9NOB29,ES20H20 200320C03480000,0,0,0,0,0, +ES XCZJLDVDTU3O|ES XCZJLC9NOB29,ES20H20 200320C03490000,0,0,0,0,0, +ES XCZJLCFGEVR8|ES XCZJLC9NOB29,ES20H20 200320C03500000,0,0,0,0,0, +ES XCZJLDVPQI78|ES XCZJLC9NOB29,ES20H20 200320C03510000,0,0,0,0,0, +ES XCZJLDVVOU90|ES XCZJLC9NOB29,ES20H20 200320C03520000,0,0,0,0,0, +ES XCZJLDW1N6AS|ES XCZJLC9NOB29,ES20H20 200320C03530000,0,0,0,0,0, +ES XCZJLDW7LICK|ES XCZJLC9NOB29,ES20H20 200320C03540000,0,0,0,0,0, +ES XCZJLDWDJUEC|ES XCZJLC9NOB29,ES20H20 200320C03550000,0,0,0,0,0, +ES XCZJLDWJI6G4|ES XCZJLC9NOB29,ES20H20 200320C03560000,0,0,0,0,0, +ES XCZJLDWPGIHW|ES XCZJLC9NOB29,ES20H20 200320C03570000,0,0,0,0,0, +ES XCZJLDWVEUJO|ES XCZJLC9NOB29,ES20H20 200320C03580000,0,0,0,0,0, +ES XCZJLCFMD7T0|ES XCZJLC9NOB29,ES20H20 200320C03600000,0,0,0,0,0, +ES XCZJLDY136W4|ES XCZJLC9NOB29,ES20H20 200320C03650000,0,0,0,0,0, +ES XCZJLCFSBJUS|ES XCZJLC9NOB29,ES20H20 200320C03700000,0,0,0,0,0, +ES XCZJLDZOMJDW|ES XCZJLC9NOB29,ES20H20 200320C03750000,0,0,0,0,0, +ES XCZJLCFY9VWK|ES XCZJLC9NOB29,ES20H20 200320C03800000,0,0,0,0,0, +ES XCZJLE1C5VVO|ES XCZJLC9NOB29,ES20H20 200320C03850000,0,0,0,0,0, +ES XCZJLCG487YC|ES XCZJLC9NOB29,ES20H20 200320C03900000,0,0,0,0,0, +ES XCZJLUJ21C04|ES XCZJLC9NOB29,ES20H20 200320C03975000,0,0,0,0,0, +ES XCZJLCABWNDW|ES XCZJLC9NOB29,ES20H20 200320C04000000,0,0,0,0,0, +ES XCZJLCGG4W1W|ES XCZJLC9NOB29,ES20H20 200320C04100000,0,0,0,0,0, +ES XCZJLCGM383O|ES XCZJLC9NOB29,ES20H20 200320C04200000,0,0,0,0,0, +ES 31C3JQS9D84PW|ES XCZJLC9NOB29,ES20H20 200320P03000000,0,0,0,0,0, +ES 31C3JQTMNBL44|ES XCZJLC9NOB29,ES20H20 200320P03010000,0,0,0,0,0, +ES 31C3JQTMT9X5W|ES XCZJLC9NOB29,ES20H20 200320P03020000,0,0,0,0,0, +ES 31C3JR65596H0|ES XCZJLC9NOB29,ES20H20 200320P03025000,0,0,0,0,0, +ES 31C3JQTMZ897O|ES XCZJLC9NOB29,ES20H20 200320P03030000,0,0,0,0,0, +ES 31C3JQTN56L9G|ES XCZJLC9NOB29,ES20H20 200320P03040000,0,0,0,0,0, +ES 31C3JQTNB4XB8|ES XCZJLC9NOB29,ES20H20 200320P03050000,0,0,0,0,0, +ES 31C3JQTNH39D0|ES XCZJLC9NOB29,ES20H20 200320P03060000,0,0,0,0,0, +ES 31C3JQTNN1LES|ES XCZJLC9NOB29,ES20H20 200320P03070000,0,0,0,0,0, +ES 31C3JR6DEXWXW|ES XCZJLC9NOB29,ES20H20 200320P03075000,0,0,0,0,0, +ES 31C3JQTNSZXGK|ES XCZJLC9NOB29,ES20H20 200320P03080000,0,0,0,0,0, +ES 31C3JQTNYY9IC|ES XCZJLC9NOB29,ES20H20 200320P03090000,0,0,0,0,0, +ES 31C3JQSDZVCXW|ES XCZJLC9NOB29,ES20H20 200320P03100000,0,0,0,0,0, +ES 31C3JQTOAUXLW|ES XCZJLC9NOB29,ES20H20 200320P03110000,0,0,0,0,0, +ES 31C3JQTOGT9NO|ES XCZJLC9NOB29,ES20H20 200320P03120000,0,0,0,0,0, +ES 31C3JR6LOMNES|ES XCZJLC9NOB29,ES20H20 200320P03125000,0,0,0,0,0, +ES 31C3JQTOMRLPG|ES XCZJLC9NOB29,ES20H20 200320P03130000,0,0,0,0,0, +ES 31C3JQTOSPXR8|ES XCZJLC9NOB29,ES20H20 200320P03140000,0,0,0,0,0, +ES 31C3JQTOYO9T0|ES XCZJLC9NOB29,ES20H20 200320P03150000,0,0,0,0,0, +ES 31C3JQTP4MLUS|ES XCZJLC9NOB29,ES20H20 200320P03160000,0,0,0,0,0, +ES 31C3JQTPAKXWK|ES XCZJLC9NOB29,ES20H20 200320P03170000,0,0,0,0,0, +ES 31C3JR6TYBDVO|ES XCZJLC9NOB29,ES20H20 200320P03175000,0,0,0,0,0, +ES 31C3JQTPGJ9YC|ES XCZJLC9NOB29,ES20H20 200320P03180000,0,0,0,0,0, +ES 31C3JQTPMHM04|ES XCZJLC9NOB29,ES20H20 200320P03190000,0,0,0,0,0, +ES 31C3JQSE5TOZO|ES XCZJLC9NOB29,ES20H20 200320P03200000,0,0,0,0,0, +ES 31C3JQTPYEA3O|ES XCZJLC9NOB29,ES20H20 200320P03210000,0,0,0,0,0, +ES 31C3JQTQ4CM5G|ES XCZJLC9NOB29,ES20H20 200320P03220000,0,0,0,0,0, +ES 31C3JQTQAAY78|ES XCZJLC9NOB29,ES20H20 200320P03230000,0,0,0,0,0, +ES 31C3JQTQG9A90|ES XCZJLC9NOB29,ES20H20 200320P03240000,0,0,0,0,0, +ES 31C3JQTQM7MAS|ES XCZJLC9NOB29,ES20H20 200320P03250000,0,0,0,0,0, +ES 31C3JQTQS5YCK|ES XCZJLC9NOB29,ES20H20 200320P03260000,0,0,0,0,0, +ES 31C3JQTQY4AEC|ES XCZJLC9NOB29,ES20H20 200320P03270000,0,0,0,0,0, +ES 31C3JQTR42MG4|ES XCZJLC9NOB29,ES20H20 200320P03280000,0,0,0,0,0, +ES 31C3JQTRA0YHW|ES XCZJLC9NOB29,ES20H20 200320P03290000,0,0,0,0,0, +ES 31C3JQSEBS11G|ES XCZJLC9NOB29,ES20H20 200320P03300000,0,0,0,0,0, +ES 31C3JQTRLXMLG|ES XCZJLC9NOB29,ES20H20 200320P03310000,0,0,0,0,0, +ES 31C3JQTRRVYN8|ES XCZJLC9NOB29,ES20H20 200320P03320000,0,0,0,0,0, +ES 31C3JQTRXUAP0|ES XCZJLC9NOB29,ES20H20 200320P03330000,0,0,0,0,0, +ES 31C3JQTS3SMQS|ES XCZJLC9NOB29,ES20H20 200320P03340000,0,0,0,0,0, +ES 31C3JQTS9QYSK|ES XCZJLC9NOB29,ES20H20 200320P03350000,0,0,0,0,0, +ES 31C3JQTSFPAUC|ES XCZJLC9NOB29,ES20H20 200320P03360000,0,0,0,0,0, +ES 31C3JQTSLNMW4|ES XCZJLC9NOB29,ES20H20 200320P03370000,0,0,0,0,0, +ES 31C3JQTSRLYXW|ES XCZJLC9NOB29,ES20H20 200320P03380000,0,0,0,0,0, +ES 31C3JQTSXKAZO|ES XCZJLC9NOB29,ES20H20 200320P03390000,0,0,0,0,0, diff --git a/Data/futureoption/cme/universes/es/20200320/20200103.csv b/Data/futureoption/cme/universes/es/20200320/20200103.csv new file mode 100644 index 000000000000..f3aa2ff420b0 --- /dev/null +++ b/Data/futureoption/cme/universes/es/20200320/20200103.csv @@ -0,0 +1,106 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES XCZJLC9NOB29,ES20H20,3220.25,3224,3216.25,3223.75,0, +ES XCZJLCA5YBC4|ES XCZJLC9NOB29,ES20H20 200320C03000000,249.50,256.125,243.125,251.875,0, +ES XCZJLDNG1RQC|ES XCZJLC9NOB29,ES20H20 200320C03010000,240.875,247.625,234.5,243.25,0, +ES XCZJLDNM03S4|ES XCZJLC9NOB29,ES20H20 200320C03020000,232.25,239.125,225.875,234.75,0, +ES XCZJLQ5XZD38|ES XCZJLC9NOB29,ES20H20 200320C03025000,228,234.875,221.75,230.5,0, +ES XCZJLDNRYFTW|ES XCZJLC9NOB29,ES20H20 200320C03030000,223.875,230.75,217.5,226.625,0, +ES XCZJLDNXWRVO|ES XCZJLC9NOB29,ES20H20 200320C03040000,215.375,222,209.0,217.625,0, +ES XCZJLDO3V3XG|ES XCZJLC9NOB29,ES20H20 200320C03050000,207.125,214.00,200.875,209.625,0, +ES XCZJLDO9TFZ8|ES XCZJLC9NOB29,ES20H20 200320C03060000,198.875,205.75,192.625,201.375,0, +ES XCZJLDOFRS10|ES XCZJLC9NOB29,ES20H20 200320C03070000,190.75,197.50,184.375,193.25,0, +ES XCZJLQE7O3K4|ES XCZJLC9NOB29,ES20H20 200320C03075000,186.625,193.125,180.25,188.75,0, +ES XCZJLDOLQ42S|ES XCZJLC9NOB29,ES20H20 200320C03080000,182.625,189.125,176.25,184.875,0, +ES XCZJLDOROG4K|ES XCZJLC9NOB29,ES20H20 200320C03090000,174.50,181.125,168.25,176.75,0, +ES XCZJLCESLJK4|ES XCZJLC9NOB29,ES20H20 200320C03100000,166.625,173,160.25,168.625,0, +ES XCZJLDP3L484|ES XCZJLC9NOB29,ES20H20 200320C03110000,158.75,165.25,152.5,160.875,0, +ES XCZJLDP9JG9W|ES XCZJLC9NOB29,ES20H20 200320C03120000,150.875,157.50,144.75,153.50,0, +ES XCZJLQMHCU10|ES XCZJLC9NOB29,ES20H20 200320C03125000,147.00,153.5,141.625,149.125,0, +ES XCZJLDPFHSBO|ES XCZJLC9NOB29,ES20H20 200320C03130000,143.25,149.875,137.50,145.75,0, +ES XCZJLDPLG4DG|ES XCZJLC9NOB29,ES20H20 200320C03140000,135.625,142.125,129.25,137.875,0, +ES XCZJLDPREGF8|ES XCZJLC9NOB29,ES20H20 200320C03150000,128.125,134.625,122.625,130.375,0, +ES XCZJLDPXCSH0|ES XCZJLC9NOB29,ES20H20 200320C03160000,120.75,127.375,114.375,123.125,0, +ES XCZJLDQ3B4IS|ES XCZJLC9NOB29,ES20H20 200320C03170000,113.625,119.875,107.625,115.375,0, +ES XCZJLQUR1KHW|ES XCZJLC9NOB29,ES20H20 200320C03175000,110.0,116.375,104,112.125,0, +ES XCZJLDQ99GKK|ES XCZJLC9NOB29,ES20H20 200320C03180000,106.5,112.625,100.375,108.375,0, +ES XCZJLDQF7SMC|ES XCZJLC9NOB29,ES20H20 200320C03190000,99.375,105.875,93.625,101.25,0, +ES XCZJLCEYJVLW|ES XCZJLC9NOB29,ES20H20 200320C03200000,92.625,107,66.375,94.375,0, +ES XCZJLDQR4GPW|ES XCZJLC9NOB29,ES20H20 200320C03210000,85.875,92.00,80.125,87.625,0, +ES XCZJLDQX2SRO|ES XCZJLC9NOB29,ES20H20 200320C03220000,79.5,85.50,73.125,81.25,0, +ES XCZJLDR314TG|ES XCZJLC9NOB29,ES20H20 200320C03230000,73.25,79.75,48.375,74.75,0, +ES XCZJLDR8ZGV8|ES XCZJLC9NOB29,ES20H20 200320C03240000,67.25,73.5,59.375,68.625,0, +ES XCZJLDREXSX0|ES XCZJLC9NOB29,ES20H20 200320C03250000,61.25,73.625,55.00,62.875,0, +ES XCZJLCFAGJPG|ES XCZJLC9NOB29,ES20H20 200320C03400000,10.875,12.25,4.95,8.625,0, +ES XCZJLDU275PG|ES XCZJLC9NOB29,ES20H20 200320C03410000,7.50,12.50,4.025,7.5,0, +ES XCZJLDU85HR8|ES XCZJLC9NOB29,ES20H20 200320C03420000,6.525,11.375,3.20,6.25,0, +ES XCZJLDUE3TT0|ES XCZJLC9NOB29,ES20H20 200320C03430000,7.75,7.875,5.25,5.50,0, +ES XCZJLDUK25US|ES XCZJLC9NOB29,ES20H20 200320C03440000,6.175,7.225,3.475,4.675,0, +ES XCZJLDUQ0HWK|ES XCZJLC9NOB29,ES20H20 200320C03450000,4.20,4.775,2.975,4.0,0, +ES XCZJLDUVYTYC|ES XCZJLC9NOB29,ES20H20 200320C03460000,3.575,4.275,2.425,3.475,0, +ES XCZJLDV1X604|ES XCZJLC9NOB29,ES20H20 200320C03470000,3.125,3.725,2,3.0,0, +ES XCZJLDV7VI1W|ES XCZJLC9NOB29,ES20H20 200320C03480000,2.725,3.35,1.65,2.575,0, +ES XCZJLDVDTU3O|ES XCZJLC9NOB29,ES20H20 200320C03490000,2.40,3.05,1.3,2.275,0, +ES XCZJLCFGEVR8|ES XCZJLC9NOB29,ES20H20 200320C03500000,8.125,8.2,1.90,2.00,0, +ES XCZJLDVPQI78|ES XCZJLC9NOB29,ES20H20 200320C03510000,2.30,2.45,1.2,1.725,0, +ES XCZJLDVVOU90|ES XCZJLC9NOB29,ES20H20 200320C03520000,2.10,2.25,1.0,1.525,0, +ES XCZJLDW1N6AS|ES XCZJLC9NOB29,ES20H20 200320C03530000,1.95,2.1,0.825,1.35,0, +ES XCZJLDW7LICK|ES XCZJLC9NOB29,ES20H20 200320C03540000,1.80,1.95,0.675,1.20,0, +ES XCZJLDWDJUEC|ES XCZJLC9NOB29,ES20H20 200320C03550000,1.55,1.75,0.875,1.05,0, +ES XCZJLDWJI6G4|ES XCZJLC9NOB29,ES20H20 200320C03560000,1.525,1.725,0.75,0.95,0, +ES XCZJLDWPGIHW|ES XCZJLC9NOB29,ES20H20 200320C03570000,1.5,1.6,0.725,0.85,0, +ES XCZJLDWVEUJO|ES XCZJLC9NOB29,ES20H20 200320C03580000,1.4,1.525,0.625,0.75,0, +ES XCZJLCFMD7T0|ES XCZJLC9NOB29,ES20H20 200320C03600000,0.9,0.925,0.6,0.625,0, +ES XCZJLDY136W4|ES XCZJLC9NOB29,ES20H20 200320C03650000,0.55,1.15,0.25,0.35,0, +ES XCZJLCFSBJUS|ES XCZJLC9NOB29,ES20H20 200320C03700000,0.475,1.025,0.175,0.225,0, +ES XCZJLDZOMJDW|ES XCZJLC9NOB29,ES20H20 200320C03750000,0.8,1.85,0.25,0.3,0, +ES XCZJLCFY9VWK|ES XCZJLC9NOB29,ES20H20 200320C03800000,0.75,1.8,0.2,0.3,0, +ES XCZJLE1C5VVO|ES XCZJLC9NOB29,ES20H20 200320C03850000,1.8,1.8,0.25,0.25,0, +ES XCZJLCG487YC|ES XCZJLC9NOB29,ES20H20 200320C03900000,0.7,1.75,0.2,0.25,0, +ES XCZJLUJ21C04|ES XCZJLC9NOB29,ES20H20 200320C03975000,0.15,0.15,0.15,0.15,0, +ES XCZJLCABWNDW|ES XCZJLC9NOB29,ES20H20 200320C04000000,0.15,0.15,0.15,0.15,0, +ES XCZJLCGG4W1W|ES XCZJLC9NOB29,ES20H20 200320C04100000,0.7,1.75,0.15,0.2,0, +ES XCZJLCGM383O|ES XCZJLC9NOB29,ES20H20 200320C04200000,1.75,1.75,0.2,0.2,0, +ES 31C3JQS9D84PW|ES XCZJLC9NOB29,ES20H20 200320P03000000,32,37.625,24.875,29.5,0, +ES 31C3JQTMNBL44|ES XCZJLC9NOB29,ES20H20 200320P03010000,31.75,37.625,26.125,30.875,0, +ES 31C3JQTMT9X5W|ES XCZJLC9NOB29,ES20H20 200320P03020000,33.25,38.75,27.5,32.25,0, +ES 31C3JR65596H0|ES XCZJLC9NOB29,ES20H20 200320P03025000,33.875,39.875,28.25,33.0,0, +ES 31C3JQTMZ897O|ES XCZJLC9NOB29,ES20H20 200320P03030000,34.625,40.375,28.875,33.75,0, +ES 31C3JQTN56L9G|ES XCZJLC9NOB29,ES20H20 200320P03040000,66.375,68.0,30.375,35.25,0, +ES 31C3JQTNB4XB8|ES XCZJLC9NOB29,ES20H20 200320P03050000,37.75,43.625,32.125,36.875,0, +ES 31C3JQTNH39D0|ES XCZJLC9NOB29,ES20H20 200320P03060000,39.50,45.5,33.625,38.375,0, +ES 31C3JQTNN1LES|ES XCZJLC9NOB29,ES20H20 200320P03070000,41.25,47.00,35.625,40.125,0, +ES 31C3JR6DEXWXW|ES XCZJLC9NOB29,ES20H20 200320P03075000,42.00,48.375,36.625,41.125,0, +ES 31C3JQTNSZXGK|ES XCZJLC9NOB29,ES20H20 200320P03080000,43.00,49.00,37.25,41.875,0, +ES 31C3JQTNYY9IC|ES XCZJLC9NOB29,ES20H20 200320P03090000,44.875,50.875,39.375,43.875,0, +ES 31C3JQSDZVCXW|ES XCZJLC9NOB29,ES20H20 200320P03100000,51.75,58.125,40.625,45.75,0, +ES 31C3JQTOAUXLW|ES XCZJLC9NOB29,ES20H20 200320P03110000,71.875,73.75,43.50,47.875,0, +ES 31C3JQTOGT9NO|ES XCZJLC9NOB29,ES20H20 200320P03120000,51.0,57.25,45.50,50.0,0, +ES 31C3JR6LOMNES|ES XCZJLC9NOB29,ES20H20 200320P03125000,52.125,58.375,46.5,51.125,0, +ES 31C3JQTOMRLPG|ES XCZJLC9NOB29,ES20H20 200320P03130000,53.25,59.375,47.875,52.25,0, +ES 31C3JQTOSPXR8|ES XCZJLC9NOB29,ES20H20 200320P03140000,55.625,61.875,50.25,54.375,0, +ES 31C3JQTOYO9T0|ES XCZJLC9NOB29,ES20H20 200320P03150000,58.875,64.50,52.625,57.0,0, +ES 31C3JQTP4MLUS|ES XCZJLC9NOB29,ES20H20 200320P03160000,60.625,66.875,55.25,59.375,0, +ES 31C3JQTPAKXWK|ES XCZJLC9NOB29,ES20H20 200320P03170000,66.75,68.875,57.875,62.00,0, +ES 31C3JR6TYBDVO|ES XCZJLC9NOB29,ES20H20 200320P03175000,64.75,71.125,59.375,63.625,0, +ES 31C3JQTPGJ9YC|ES XCZJLC9NOB29,ES20H20 200320P03180000,96,98.25,57.25,65.25,0, +ES 31C3JQTPMHM04|ES XCZJLC9NOB29,ES20H20 200320P03190000,83,85.25,63.625,67.75,0, +ES 31C3JQSE5TOZO|ES XCZJLC9NOB29,ES20H20 200320P03200000,75.375,78.5,66.50,70.75,0, +ES 31C3JQTPYEA3O|ES XCZJLC9NOB29,ES20H20 200320P03210000,75.75,82,70.125,74.00,0, +ES 31C3JQTQ4CM5G|ES XCZJLC9NOB29,ES20H20 200320P03220000,80,83.125,73.625,77.625,0, +ES 31C3JQTQAAY78|ES XCZJLC9NOB29,ES20H20 200320P03230000,83.375,89.25,61.625,81.125,0, +ES 31C3JQTQG9A90|ES XCZJLC9NOB29,ES20H20 200320P03240000,87.25,92.375,81.375,86.375,0, +ES 31C3JQTQM7MAS|ES XCZJLC9NOB29,ES20H20 200320P03250000,91.50,98.375,84.75,89.25,0, +ES 31C3JQTQS5YCK|ES XCZJLC9NOB29,ES20H20 200320P03260000,95.75,101.50,89.25,93.50,0, +ES 31C3JQTQY4AEC|ES XCZJLC9NOB29,ES20H20 200320P03270000,100.375,107,94.25,98.375,0, +ES 31C3JQTR42MG4|ES XCZJLC9NOB29,ES20H20 200320P03280000,105.125,111.875,99.00,103.125,0, +ES 31C3JQTRA0YHW|ES XCZJLC9NOB29,ES20H20 200320P03290000,110.375,117.125,104.125,108.375,0, +ES 31C3JQSEBS11G|ES XCZJLC9NOB29,ES20H20 200320P03300000,115.875,122.375,109.625,113.875,0, +ES 31C3JQTRLXMLG|ES XCZJLC9NOB29,ES20H20 200320P03310000,121.625,128.125,115.25,119.125,0, +ES 31C3JQTRRVYN8|ES XCZJLC9NOB29,ES20H20 200320P03320000,127.625,134.50,121.25,125.5,0, +ES 31C3JQTRXUAP0|ES XCZJLC9NOB29,ES20H20 200320P03330000,134.0,140.75,127.875,131.875,0, +ES 31C3JQTS3SMQS|ES XCZJLC9NOB29,ES20H20 200320P03340000,140.875,147.625,134.375,138.5,0, +ES 31C3JQTS9QYSK|ES XCZJLC9NOB29,ES20H20 200320P03350000,148,154.625,141.25,145.25,0, +ES 31C3JQTSFPAUC|ES XCZJLC9NOB29,ES20H20 200320P03360000,155.375,162.125,148.75,153.0,0, +ES 31C3JQTSLNMW4|ES XCZJLC9NOB29,ES20H20 200320P03370000,163.25,174.00,152.00,160.625,0, +ES 31C3JQTSRLYXW|ES XCZJLC9NOB29,ES20H20 200320P03380000,171.25,182.00,160.00,169.25,0, +ES 31C3JQTSXKAZO|ES XCZJLC9NOB29,ES20H20 200320P03390000,179.625,190.50,167.75,176.375,0, diff --git a/Data/futureoption/cme/universes/es/20200320/20200106.csv b/Data/futureoption/cme/universes/es/20200320/20200106.csv new file mode 100644 index 000000000000..331a2fd72f08 --- /dev/null +++ b/Data/futureoption/cme/universes/es/20200320/20200106.csv @@ -0,0 +1,106 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES XCZJLC9NOB29,ES20H20,3239.5,3244.75,3226,3233,904566, +ES XCZJLCA5YBC4|ES XCZJLC9NOB29,ES20H20 200320C03000000,266.875,266.875,188.25,266.625,0, +ES XCZJLDNG1RQC|ES XCZJLC9NOB29,ES20H20 200320C03010000,258.125,258.125,257.625,257.875,0, +ES XCZJLDNM03S4|ES XCZJLC9NOB29,ES20H20 200320C03020000,249.125,249.125,248.875,249,0, +ES XCZJLQ5XZD38|ES XCZJLC9NOB29,ES20H20 200320C03025000,244.625,244.625,244.625,244.625,0, +ES XCZJLDNRYFTW|ES XCZJLC9NOB29,ES20H20 200320C03030000,135.75,240.375,135.625,240.25,0, +ES XCZJLDNXWRVO|ES XCZJLC9NOB29,ES20H20 200320C03040000,232,232,231.625,231.75,0, +ES XCZJLDO3V3XG|ES XCZJLC9NOB29,ES20H20 200320C03050000,223.5,223.5,119.5,223.25,0, +ES XCZJLDO9TFZ8|ES XCZJLC9NOB29,ES20H20 200320C03060000,215,215,214.5,214.75,0, +ES XCZJLDOFRS10|ES XCZJLC9NOB29,ES20H20 200320C03070000,206.25,206.25,206.125,206.125,0, +ES XCZJLQE7O3K4|ES XCZJLC9NOB29,ES20H20 200320C03075000,202,202,201.875,201.875,0, +ES XCZJLDOLQ42S|ES XCZJLC9NOB29,ES20H20 200320C03080000,197.875,197.875,197.75,197.875,0, +ES XCZJLDOROG4K|ES XCZJLC9NOB29,ES20H20 200320C03090000,189.625,189.625,189.375,189.625,0, +ES XCZJLCESLJK4|ES XCZJLC9NOB29,ES20H20 200320C03100000,181.625,181.625,116,181.375,0, +ES XCZJLDP3L484|ES XCZJLC9NOB29,ES20H20 200320C03110000,173.125,173.125,173.125,173.125,0, +ES XCZJLDP9JG9W|ES XCZJLC9NOB29,ES20H20 200320C03120000,165.125,165.125,165.125,165.125,0, +ES XCZJLQMHCU10|ES XCZJLC9NOB29,ES20H20 200320C03125000,161.125,161.125,161.125,161.125,0, +ES XCZJLDPFHSBO|ES XCZJLC9NOB29,ES20H20 200320C03130000,157.125,157.125,157.125,157.125,0, +ES XCZJLDPLG4DG|ES XCZJLC9NOB29,ES20H20 200320C03140000,149.50,149.75,149.0,149.25,0, +ES XCZJLDPREGF8|ES XCZJLC9NOB29,ES20H20 200320C03150000,141.75,142.0,71.375,141.50,0, +ES XCZJLDPXCSH0|ES XCZJLC9NOB29,ES20H20 200320C03160000,134.25,134.25,79.5,133.875,0, +ES XCZJLDQ3B4IS|ES XCZJLC9NOB29,ES20H20 200320C03170000,126.50,126.75,126.0,126.25,0, +ES XCZJLQUR1KHW|ES XCZJLC9NOB29,ES20H20 200320C03175000,122.75,123.0,122.25,122.50,0, +ES XCZJLDQ99GKK|ES XCZJLC9NOB29,ES20H20 200320C03180000,119.25,119.375,118.625,118.875,0, +ES XCZJLDQF7SMC|ES XCZJLC9NOB29,ES20H20 200320C03190000,111.625,111.875,111.25,111.50,0, +ES XCZJLCEYJVLW|ES XCZJLC9NOB29,ES20H20 200320C03200000,104.75,112.125,93.375,104.375,0, +ES XCZJLDQR4GPW|ES XCZJLC9NOB29,ES20H20 200320C03210000,97.50,106.125,67.0,97.375,0, +ES XCZJLDQX2SRO|ES XCZJLC9NOB29,ES20H20 200320C03220000,90.625,90.75,79.00,90.375,0, +ES XCZJLDR314TG|ES XCZJLC9NOB29,ES20H20 200320C03230000,83.75,84.0,83.5,83.75,0, +ES XCZJLDR8ZGV8|ES XCZJLC9NOB29,ES20H20 200320C03240000,77.25,77.5,77.0,77.125,0, +ES XCZJLDREXSX0|ES XCZJLC9NOB29,ES20H20 200320C03250000,71.0,71.125,70.75,70.875,0, +ES XCZJLCFAGJPG|ES XCZJLC9NOB29,ES20H20 200320C03400000,10.25,10.25,10.25,10.25,0, +ES XCZJLDU275PG|ES XCZJLC9NOB29,ES20H20 200320C03410000,8.75,8.75,8.75,8.75,0, +ES XCZJLDU85HR8|ES XCZJLC9NOB29,ES20H20 200320C03420000,7.50,7.50,7.50,7.50,0, +ES XCZJLDUE3TT0|ES XCZJLC9NOB29,ES20H20 200320C03430000,6.25,6.25,6.25,6.25,0, +ES XCZJLDUK25US|ES XCZJLC9NOB29,ES20H20 200320C03440000,5.375,5.375,5.375,5.375,0, +ES XCZJLDUQ0HWK|ES XCZJLC9NOB29,ES20H20 200320C03450000,4.60,4.625,4.575,4.60,0, +ES XCZJLDUVYTYC|ES XCZJLC9NOB29,ES20H20 200320C03460000,3.925,3.975,3.925,3.975,0, +ES XCZJLDV1X604|ES XCZJLC9NOB29,ES20H20 200320C03470000,3.3,3.3,3.3,3.3,0, +ES XCZJLDV7VI1W|ES XCZJLC9NOB29,ES20H20 200320C03480000,2.925,2.925,2.925,2.925,0, +ES XCZJLDVDTU3O|ES XCZJLC9NOB29,ES20H20 200320C03490000,2.55,2.55,2.55,2.55,0, +ES XCZJLCFGEVR8|ES XCZJLC9NOB29,ES20H20 200320C03500000,2.1,2.1,2.1,2.1,0, +ES XCZJLDVPQI78|ES XCZJLC9NOB29,ES20H20 200320C03510000,1.85,1.85,1.85,1.85,0, +ES XCZJLDVVOU90|ES XCZJLC9NOB29,ES20H20 200320C03520000,0,0,0,0,0, +ES XCZJLDW1N6AS|ES XCZJLC9NOB29,ES20H20 200320C03530000,1.6,1.6,1.6,1.6,0, +ES XCZJLDW7LICK|ES XCZJLC9NOB29,ES20H20 200320C03540000,1.2,1.2,1.2,1.2,0, +ES XCZJLDWDJUEC|ES XCZJLC9NOB29,ES20H20 200320C03550000,1.05,1.05,1.05,1.05,0, +ES XCZJLDWJI6G4|ES XCZJLC9NOB29,ES20H20 200320C03560000,0,0,0,0,0, +ES XCZJLDWPGIHW|ES XCZJLC9NOB29,ES20H20 200320C03570000,0,0,0,0,0, +ES XCZJLDWVEUJO|ES XCZJLC9NOB29,ES20H20 200320C03580000,0.8,0.8,0.8,0.8,0, +ES XCZJLCFMD7T0|ES XCZJLC9NOB29,ES20H20 200320C03600000,0,0,0,0,0, +ES XCZJLDY136W4|ES XCZJLC9NOB29,ES20H20 200320C03650000,0,0,0,0,0, +ES XCZJLCFSBJUS|ES XCZJLC9NOB29,ES20H20 200320C03700000,0,0,0,0,0, +ES XCZJLDZOMJDW|ES XCZJLC9NOB29,ES20H20 200320C03750000,0,0,0,0,0, +ES XCZJLCFY9VWK|ES XCZJLC9NOB29,ES20H20 200320C03800000,0,0,0,0,0, +ES XCZJLE1C5VVO|ES XCZJLC9NOB29,ES20H20 200320C03850000,0,0,0,0,0, +ES XCZJLCG487YC|ES XCZJLC9NOB29,ES20H20 200320C03900000,0,0,0,0,0, +ES XCZJLUJ21C04|ES XCZJLC9NOB29,ES20H20 200320C03975000,0,0,0,0,0, +ES XCZJLCABWNDW|ES XCZJLC9NOB29,ES20H20 200320C04000000,0,0,0,0,0, +ES XCZJLCGG4W1W|ES XCZJLC9NOB29,ES20H20 200320C04100000,0,0,0,0,0, +ES XCZJLCGM383O|ES XCZJLC9NOB29,ES20H20 200320C04200000,0,0,0,0,0, +ES 31C3JQS9D84PW|ES XCZJLC9NOB29,ES20H20 200320P03000000,24.625,24.75,24.50,24.75,0, +ES 31C3JQTMNBL44|ES XCZJLC9NOB29,ES20H20 200320P03010000,25.75,25.875,25.75,25.875,0, +ES 31C3JQTMT9X5W|ES XCZJLC9NOB29,ES20H20 200320P03020000,27.00,27.125,27.00,27.125,0, +ES 31C3JR65596H0|ES XCZJLC9NOB29,ES20H20 200320P03025000,27.625,27.75,27.625,27.75,0, +ES 31C3JQTMZ897O|ES XCZJLC9NOB29,ES20H20 200320P03030000,28.25,28.375,28.25,28.375,0, +ES 31C3JQTN56L9G|ES XCZJLC9NOB29,ES20H20 200320P03040000,29.625,29.75,29.625,29.75,0, +ES 31C3JQTNB4XB8|ES XCZJLC9NOB29,ES20H20 200320P03050000,31.125,31.125,31.00,31.125,0, +ES 31C3JQTNH39D0|ES XCZJLC9NOB29,ES20H20 200320P03060000,32.50,32.625,32.50,32.625,0, +ES 31C3JQTNN1LES|ES XCZJLC9NOB29,ES20H20 200320P03070000,34.00,34.125,34.00,34.125,0, +ES 31C3JR6DEXWXW|ES XCZJLC9NOB29,ES20H20 200320P03075000,34.875,35.00,34.75,35.00,0, +ES 31C3JQTNSZXGK|ES XCZJLC9NOB29,ES20H20 200320P03080000,35.625,35.75,35.625,35.75,0, +ES 31C3JQTNYY9IC|ES XCZJLC9NOB29,ES20H20 200320P03090000,37.375,37.50,37.25,37.50,0, +ES 31C3JQSDZVCXW|ES XCZJLC9NOB29,ES20H20 200320P03100000,39.125,39.25,39.00,39.25,0, +ES 31C3JQTOAUXLW|ES XCZJLC9NOB29,ES20H20 200320P03110000,40.875,41.00,40.875,41.00,0, +ES 31C3JQTOGT9NO|ES XCZJLC9NOB29,ES20H20 200320P03120000,42.75,43.00,42.75,42.875,0, +ES 31C3JR6LOMNES|ES XCZJLC9NOB29,ES20H20 200320P03125000,43.75,43.875,43.75,43.875,0, +ES 31C3JQTOMRLPG|ES XCZJLC9NOB29,ES20H20 200320P03130000,44.75,45.00,44.75,44.875,0, +ES 31C3JQTOSPXR8|ES XCZJLC9NOB29,ES20H20 200320P03140000,46.875,47.00,46.875,47.00,0, +ES 31C3JQTOYO9T0|ES XCZJLC9NOB29,ES20H20 200320P03150000,49.125,49.375,49.0,49.25,0, +ES 31C3JQTP4MLUS|ES XCZJLC9NOB29,ES20H20 200320P03160000,51.375,51.625,51.25,51.50,0, +ES 31C3JQTPAKXWK|ES XCZJLC9NOB29,ES20H20 200320P03170000,53.875,54.125,53.625,53.875,0, +ES 31C3JR6TYBDVO|ES XCZJLC9NOB29,ES20H20 200320P03175000,55.125,55.375,54.875,55.125,0, +ES 31C3JQTPGJ9YC|ES XCZJLC9NOB29,ES20H20 200320P03180000,56.25,56.625,56.25,56.50,0, +ES 31C3JQTPMHM04|ES XCZJLC9NOB29,ES20H20 200320P03190000,58.875,59.25,58.875,59.125,0, +ES 31C3JQSE5TOZO|ES XCZJLC9NOB29,ES20H20 200320P03200000,61.75,62.0,61.625,61.875,0, +ES 31C3JQTPYEA3O|ES XCZJLC9NOB29,ES20H20 200320P03210000,64.75,65.0,64.5,64.875,0, +ES 31C3JQTQ4CM5G|ES XCZJLC9NOB29,ES20H20 200320P03220000,67.875,68.0,67.75,67.875,0, +ES 31C3JQTQAAY78|ES XCZJLC9NOB29,ES20H20 200320P03230000,71.0,71.375,70.875,71.125,0, +ES 31C3JQTQG9A90|ES XCZJLC9NOB29,ES20H20 200320P03240000,74.375,74.75,74.375,74.625,0, +ES 31C3JQTQM7MAS|ES XCZJLC9NOB29,ES20H20 200320P03250000,78.125,78.5,78.0,78.375,0, +ES 31C3JQTQS5YCK|ES XCZJLC9NOB29,ES20H20 200320P03260000,81.875,82.375,81.875,82.125,0, +ES 31C3JQTQY4AEC|ES XCZJLC9NOB29,ES20H20 200320P03270000,86.0,86.5,86.0,86.25,0, +ES 31C3JQTR42MG4|ES XCZJLC9NOB29,ES20H20 200320P03280000,90.50,90.875,90.25,90.625,0, +ES 31C3JQTRA0YHW|ES XCZJLC9NOB29,ES20H20 200320P03290000,95.25,95.5,94.875,95.25,0, +ES 31C3JQSEBS11G|ES XCZJLC9NOB29,ES20H20 200320P03300000,99.75,100.375,99.75,100.125,0, +ES 31C3JQTRLXMLG|ES XCZJLC9NOB29,ES20H20 200320P03310000,105.375,105.625,104.875,105.375,0, +ES 31C3JQTRRVYN8|ES XCZJLC9NOB29,ES20H20 200320P03320000,110.875,111.25,110.5,110.875,0, +ES 31C3JQTRXUAP0|ES XCZJLC9NOB29,ES20H20 200320P03330000,116.75,117.25,116.125,116.75,0, +ES 31C3JQTS3SMQS|ES XCZJLC9NOB29,ES20H20 200320P03340000,123,123.125,123,123,0, +ES 31C3JQTS9QYSK|ES XCZJLC9NOB29,ES20H20 200320P03350000,129.625,129.625,129.625,129.625,0, +ES 31C3JQTSFPAUC|ES XCZJLC9NOB29,ES20H20 200320P03360000,136.50,136.625,136.50,136.625,0, +ES 31C3JQTSLNMW4|ES XCZJLC9NOB29,ES20H20 200320P03370000,143.625,143.75,143.625,143.75,0, +ES 31C3JQTSRLYXW|ES XCZJLC9NOB29,ES20H20 200320P03380000,151.125,151.375,151.125,151.375,0, +ES 31C3JQTSXKAZO|ES XCZJLC9NOB29,ES20H20 200320P03390000,159.0,159.25,159.0,159.25,0, diff --git a/Data/futureoption/cme/universes/es/20200320/20200107.csv b/Data/futureoption/cme/universes/es/20200320/20200107.csv new file mode 100644 index 000000000000..eb91ea59c432 --- /dev/null +++ b/Data/futureoption/cme/universes/es/20200320/20200107.csv @@ -0,0 +1,106 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES XCZJLC9NOB29,ES20H20,3239,3267.75,3236,3259.75,1287728, +ES XCZJLCA5YBC4|ES XCZJLC9NOB29,ES20H20 200320C03000000,0,0,0,0,0, +ES XCZJLDNG1RQC|ES XCZJLC9NOB29,ES20H20 200320C03010000,0,0,0,0,0, +ES XCZJLDNM03S4|ES XCZJLC9NOB29,ES20H20 200320C03020000,0,0,0,0,0, +ES XCZJLQ5XZD38|ES XCZJLC9NOB29,ES20H20 200320C03025000,0,0,0,0,0, +ES XCZJLDNRYFTW|ES XCZJLC9NOB29,ES20H20 200320C03030000,0,0,0,0,0, +ES XCZJLDNXWRVO|ES XCZJLC9NOB29,ES20H20 200320C03040000,0,0,0,0,0, +ES XCZJLDO3V3XG|ES XCZJLC9NOB29,ES20H20 200320C03050000,0,0,0,0,0, +ES XCZJLDO9TFZ8|ES XCZJLC9NOB29,ES20H20 200320C03060000,0,0,0,0,0, +ES XCZJLDOFRS10|ES XCZJLC9NOB29,ES20H20 200320C03070000,0,0,0,0,0, +ES XCZJLQE7O3K4|ES XCZJLC9NOB29,ES20H20 200320C03075000,0,0,0,0,0, +ES XCZJLDOLQ42S|ES XCZJLC9NOB29,ES20H20 200320C03080000,0,0,0,0,0, +ES XCZJLDOROG4K|ES XCZJLC9NOB29,ES20H20 200320C03090000,0,0,0,0,0, +ES XCZJLCESLJK4|ES XCZJLC9NOB29,ES20H20 200320C03100000,0,0,0,0,0, +ES XCZJLDP3L484|ES XCZJLC9NOB29,ES20H20 200320C03110000,0,0,0,0,0, +ES XCZJLDP9JG9W|ES XCZJLC9NOB29,ES20H20 200320C03120000,0,0,0,0,0, +ES XCZJLQMHCU10|ES XCZJLC9NOB29,ES20H20 200320C03125000,0,0,0,0,0, +ES XCZJLDPFHSBO|ES XCZJLC9NOB29,ES20H20 200320C03130000,0,0,0,0,0, +ES XCZJLDPLG4DG|ES XCZJLC9NOB29,ES20H20 200320C03140000,0,0,0,0,0, +ES XCZJLDPREGF8|ES XCZJLC9NOB29,ES20H20 200320C03150000,0,0,0,0,0, +ES XCZJLDPXCSH0|ES XCZJLC9NOB29,ES20H20 200320C03160000,0,0,0,0,0, +ES XCZJLDQ3B4IS|ES XCZJLC9NOB29,ES20H20 200320C03170000,0,0,0,0,0, +ES XCZJLQUR1KHW|ES XCZJLC9NOB29,ES20H20 200320C03175000,0,0,0,0,0, +ES XCZJLDQ99GKK|ES XCZJLC9NOB29,ES20H20 200320C03180000,0,0,0,0,0, +ES XCZJLDQF7SMC|ES XCZJLC9NOB29,ES20H20 200320C03190000,0,0,0,0,0, +ES XCZJLCEYJVLW|ES XCZJLC9NOB29,ES20H20 200320C03200000,0,0,0,0,0, +ES XCZJLDQR4GPW|ES XCZJLC9NOB29,ES20H20 200320C03210000,0,0,0,0,0, +ES XCZJLDQX2SRO|ES XCZJLC9NOB29,ES20H20 200320C03220000,0,0,0,0,0, +ES XCZJLDR314TG|ES XCZJLC9NOB29,ES20H20 200320C03230000,0,0,0,0,0, +ES XCZJLDR8ZGV8|ES XCZJLC9NOB29,ES20H20 200320C03240000,0,0,0,0,0, +ES XCZJLDREXSX0|ES XCZJLC9NOB29,ES20H20 200320C03250000,0,0,0,0,0, +ES XCZJLCFAGJPG|ES XCZJLC9NOB29,ES20H20 200320C03400000,0,0,0,0,0, +ES XCZJLDU275PG|ES XCZJLC9NOB29,ES20H20 200320C03410000,0,0,0,0,0, +ES XCZJLDU85HR8|ES XCZJLC9NOB29,ES20H20 200320C03420000,0,0,0,0,0, +ES XCZJLDUE3TT0|ES XCZJLC9NOB29,ES20H20 200320C03430000,0,0,0,0,0, +ES XCZJLDUK25US|ES XCZJLC9NOB29,ES20H20 200320C03440000,0,0,0,0,0, +ES XCZJLDUQ0HWK|ES XCZJLC9NOB29,ES20H20 200320C03450000,0,0,0,0,0, +ES XCZJLDUVYTYC|ES XCZJLC9NOB29,ES20H20 200320C03460000,0,0,0,0,0, +ES XCZJLDV1X604|ES XCZJLC9NOB29,ES20H20 200320C03470000,0,0,0,0,0, +ES XCZJLDV7VI1W|ES XCZJLC9NOB29,ES20H20 200320C03480000,0,0,0,0,0, +ES XCZJLDVDTU3O|ES XCZJLC9NOB29,ES20H20 200320C03490000,0,0,0,0,0, +ES XCZJLCFGEVR8|ES XCZJLC9NOB29,ES20H20 200320C03500000,0,0,0,0,0, +ES XCZJLDVPQI78|ES XCZJLC9NOB29,ES20H20 200320C03510000,0,0,0,0,0, +ES XCZJLDVVOU90|ES XCZJLC9NOB29,ES20H20 200320C03520000,0,0,0,0,0, +ES XCZJLDW1N6AS|ES XCZJLC9NOB29,ES20H20 200320C03530000,0,0,0,0,0, +ES XCZJLDW7LICK|ES XCZJLC9NOB29,ES20H20 200320C03540000,0,0,0,0,0, +ES XCZJLDWDJUEC|ES XCZJLC9NOB29,ES20H20 200320C03550000,0,0,0,0,0, +ES XCZJLDWJI6G4|ES XCZJLC9NOB29,ES20H20 200320C03560000,0,0,0,0,0, +ES XCZJLDWPGIHW|ES XCZJLC9NOB29,ES20H20 200320C03570000,0,0,0,0,0, +ES XCZJLDWVEUJO|ES XCZJLC9NOB29,ES20H20 200320C03580000,0,0,0,0,0, +ES XCZJLCFMD7T0|ES XCZJLC9NOB29,ES20H20 200320C03600000,0,0,0,0,0, +ES XCZJLDY136W4|ES XCZJLC9NOB29,ES20H20 200320C03650000,0,0,0,0,0, +ES XCZJLCFSBJUS|ES XCZJLC9NOB29,ES20H20 200320C03700000,0,0,0,0,0, +ES XCZJLDZOMJDW|ES XCZJLC9NOB29,ES20H20 200320C03750000,0,0,0,0,0, +ES XCZJLCFY9VWK|ES XCZJLC9NOB29,ES20H20 200320C03800000,0,0,0,0,0, +ES XCZJLE1C5VVO|ES XCZJLC9NOB29,ES20H20 200320C03850000,0,0,0,0,0, +ES XCZJLCG487YC|ES XCZJLC9NOB29,ES20H20 200320C03900000,0,0,0,0,0, +ES XCZJLUJ21C04|ES XCZJLC9NOB29,ES20H20 200320C03975000,0,0,0,0,0, +ES XCZJLCABWNDW|ES XCZJLC9NOB29,ES20H20 200320C04000000,0,0,0,0,0, +ES XCZJLCGG4W1W|ES XCZJLC9NOB29,ES20H20 200320C04100000,0,0,0,0,0, +ES XCZJLCGM383O|ES XCZJLC9NOB29,ES20H20 200320C04200000,0,0,0,0,0, +ES 31C3JQS9D84PW|ES XCZJLC9NOB29,ES20H20 200320P03000000,0,0,0,0,0, +ES 31C3JQTMNBL44|ES XCZJLC9NOB29,ES20H20 200320P03010000,0,0,0,0,0, +ES 31C3JQTMT9X5W|ES XCZJLC9NOB29,ES20H20 200320P03020000,0,0,0,0,0, +ES 31C3JR65596H0|ES XCZJLC9NOB29,ES20H20 200320P03025000,0,0,0,0,0, +ES 31C3JQTMZ897O|ES XCZJLC9NOB29,ES20H20 200320P03030000,0,0,0,0,0, +ES 31C3JQTN56L9G|ES XCZJLC9NOB29,ES20H20 200320P03040000,0,0,0,0,0, +ES 31C3JQTNB4XB8|ES XCZJLC9NOB29,ES20H20 200320P03050000,0,0,0,0,0, +ES 31C3JQTNH39D0|ES XCZJLC9NOB29,ES20H20 200320P03060000,0,0,0,0,0, +ES 31C3JQTNN1LES|ES XCZJLC9NOB29,ES20H20 200320P03070000,0,0,0,0,0, +ES 31C3JR6DEXWXW|ES XCZJLC9NOB29,ES20H20 200320P03075000,0,0,0,0,0, +ES 31C3JQTNSZXGK|ES XCZJLC9NOB29,ES20H20 200320P03080000,0,0,0,0,0, +ES 31C3JQTNYY9IC|ES XCZJLC9NOB29,ES20H20 200320P03090000,0,0,0,0,0, +ES 31C3JQSDZVCXW|ES XCZJLC9NOB29,ES20H20 200320P03100000,0,0,0,0,0, +ES 31C3JQTOAUXLW|ES XCZJLC9NOB29,ES20H20 200320P03110000,0,0,0,0,0, +ES 31C3JQTOGT9NO|ES XCZJLC9NOB29,ES20H20 200320P03120000,0,0,0,0,0, +ES 31C3JR6LOMNES|ES XCZJLC9NOB29,ES20H20 200320P03125000,0,0,0,0,0, +ES 31C3JQTOMRLPG|ES XCZJLC9NOB29,ES20H20 200320P03130000,0,0,0,0,0, +ES 31C3JQTOSPXR8|ES XCZJLC9NOB29,ES20H20 200320P03140000,0,0,0,0,0, +ES 31C3JQTOYO9T0|ES XCZJLC9NOB29,ES20H20 200320P03150000,0,0,0,0,0, +ES 31C3JQTP4MLUS|ES XCZJLC9NOB29,ES20H20 200320P03160000,0,0,0,0,0, +ES 31C3JQTPAKXWK|ES XCZJLC9NOB29,ES20H20 200320P03170000,0,0,0,0,0, +ES 31C3JR6TYBDVO|ES XCZJLC9NOB29,ES20H20 200320P03175000,0,0,0,0,0, +ES 31C3JQTPGJ9YC|ES XCZJLC9NOB29,ES20H20 200320P03180000,0,0,0,0,0, +ES 31C3JQTPMHM04|ES XCZJLC9NOB29,ES20H20 200320P03190000,0,0,0,0,0, +ES 31C3JQSE5TOZO|ES XCZJLC9NOB29,ES20H20 200320P03200000,0,0,0,0,0, +ES 31C3JQTPYEA3O|ES XCZJLC9NOB29,ES20H20 200320P03210000,0,0,0,0,0, +ES 31C3JQTQ4CM5G|ES XCZJLC9NOB29,ES20H20 200320P03220000,0,0,0,0,0, +ES 31C3JQTQAAY78|ES XCZJLC9NOB29,ES20H20 200320P03230000,0,0,0,0,0, +ES 31C3JQTQG9A90|ES XCZJLC9NOB29,ES20H20 200320P03240000,0,0,0,0,0, +ES 31C3JQTQM7MAS|ES XCZJLC9NOB29,ES20H20 200320P03250000,0,0,0,0,0, +ES 31C3JQTQS5YCK|ES XCZJLC9NOB29,ES20H20 200320P03260000,0,0,0,0,0, +ES 31C3JQTQY4AEC|ES XCZJLC9NOB29,ES20H20 200320P03270000,0,0,0,0,0, +ES 31C3JQTR42MG4|ES XCZJLC9NOB29,ES20H20 200320P03280000,0,0,0,0,0, +ES 31C3JQTRA0YHW|ES XCZJLC9NOB29,ES20H20 200320P03290000,0,0,0,0,0, +ES 31C3JQSEBS11G|ES XCZJLC9NOB29,ES20H20 200320P03300000,0,0,0,0,0, +ES 31C3JQTRLXMLG|ES XCZJLC9NOB29,ES20H20 200320P03310000,0,0,0,0,0, +ES 31C3JQTRRVYN8|ES XCZJLC9NOB29,ES20H20 200320P03320000,0,0,0,0,0, +ES 31C3JQTRXUAP0|ES XCZJLC9NOB29,ES20H20 200320P03330000,0,0,0,0,0, +ES 31C3JQTS3SMQS|ES XCZJLC9NOB29,ES20H20 200320P03340000,0,0,0,0,0, +ES 31C3JQTS9QYSK|ES XCZJLC9NOB29,ES20H20 200320P03350000,0,0,0,0,0, +ES 31C3JQTSFPAUC|ES XCZJLC9NOB29,ES20H20 200320P03360000,0,0,0,0,0, +ES 31C3JQTSLNMW4|ES XCZJLC9NOB29,ES20H20 200320P03370000,0,0,0,0,0, +ES 31C3JQTSRLYXW|ES XCZJLC9NOB29,ES20H20 200320P03380000,0,0,0,0,0, +ES 31C3JQTSXKAZO|ES XCZJLC9NOB29,ES20H20 200320P03390000,0,0,0,0,0, diff --git a/Data/futureoption/cme/universes/es/20200320/20200108.csv b/Data/futureoption/cme/universes/es/20200320/20200108.csv new file mode 100644 index 000000000000..da99f10cac9b --- /dev/null +++ b/Data/futureoption/cme/universes/es/20200320/20200108.csv @@ -0,0 +1,106 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES XCZJLC9NOB29,ES20H20,3271,3276.75,3264.25,3275.25,956432, +ES XCZJLCA5YBC4|ES XCZJLC9NOB29,ES20H20 200320C03000000,0,0,0,0,0, +ES XCZJLDNG1RQC|ES XCZJLC9NOB29,ES20H20 200320C03010000,0,0,0,0,0, +ES XCZJLDNM03S4|ES XCZJLC9NOB29,ES20H20 200320C03020000,0,0,0,0,0, +ES XCZJLQ5XZD38|ES XCZJLC9NOB29,ES20H20 200320C03025000,0,0,0,0,0, +ES XCZJLDNRYFTW|ES XCZJLC9NOB29,ES20H20 200320C03030000,0,0,0,0,0, +ES XCZJLDNXWRVO|ES XCZJLC9NOB29,ES20H20 200320C03040000,0,0,0,0,0, +ES XCZJLDO3V3XG|ES XCZJLC9NOB29,ES20H20 200320C03050000,0,0,0,0,0, +ES XCZJLDO9TFZ8|ES XCZJLC9NOB29,ES20H20 200320C03060000,0,0,0,0,0, +ES XCZJLDOFRS10|ES XCZJLC9NOB29,ES20H20 200320C03070000,0,0,0,0,0, +ES XCZJLQE7O3K4|ES XCZJLC9NOB29,ES20H20 200320C03075000,0,0,0,0,0, +ES XCZJLDOLQ42S|ES XCZJLC9NOB29,ES20H20 200320C03080000,0,0,0,0,0, +ES XCZJLDOROG4K|ES XCZJLC9NOB29,ES20H20 200320C03090000,0,0,0,0,0, +ES XCZJLCESLJK4|ES XCZJLC9NOB29,ES20H20 200320C03100000,0,0,0,0,0, +ES XCZJLDP3L484|ES XCZJLC9NOB29,ES20H20 200320C03110000,0,0,0,0,0, +ES XCZJLDP9JG9W|ES XCZJLC9NOB29,ES20H20 200320C03120000,0,0,0,0,0, +ES XCZJLQMHCU10|ES XCZJLC9NOB29,ES20H20 200320C03125000,0,0,0,0,0, +ES XCZJLDPFHSBO|ES XCZJLC9NOB29,ES20H20 200320C03130000,0,0,0,0,0, +ES XCZJLDPLG4DG|ES XCZJLC9NOB29,ES20H20 200320C03140000,0,0,0,0,0, +ES XCZJLDPREGF8|ES XCZJLC9NOB29,ES20H20 200320C03150000,0,0,0,0,0, +ES XCZJLDPXCSH0|ES XCZJLC9NOB29,ES20H20 200320C03160000,0,0,0,0,0, +ES XCZJLDQ3B4IS|ES XCZJLC9NOB29,ES20H20 200320C03170000,0,0,0,0,0, +ES XCZJLQUR1KHW|ES XCZJLC9NOB29,ES20H20 200320C03175000,0,0,0,0,0, +ES XCZJLDQ99GKK|ES XCZJLC9NOB29,ES20H20 200320C03180000,0,0,0,0,0, +ES XCZJLDQF7SMC|ES XCZJLC9NOB29,ES20H20 200320C03190000,0,0,0,0,0, +ES XCZJLCEYJVLW|ES XCZJLC9NOB29,ES20H20 200320C03200000,0,0,0,0,0, +ES XCZJLDQR4GPW|ES XCZJLC9NOB29,ES20H20 200320C03210000,0,0,0,0,0, +ES XCZJLDQX2SRO|ES XCZJLC9NOB29,ES20H20 200320C03220000,0,0,0,0,0, +ES XCZJLDR314TG|ES XCZJLC9NOB29,ES20H20 200320C03230000,0,0,0,0,0, +ES XCZJLDR8ZGV8|ES XCZJLC9NOB29,ES20H20 200320C03240000,0,0,0,0,0, +ES XCZJLDREXSX0|ES XCZJLC9NOB29,ES20H20 200320C03250000,0,0,0,0,0, +ES XCZJLCFAGJPG|ES XCZJLC9NOB29,ES20H20 200320C03400000,0,0,0,0,0, +ES XCZJLDU275PG|ES XCZJLC9NOB29,ES20H20 200320C03410000,0,0,0,0,0, +ES XCZJLDU85HR8|ES XCZJLC9NOB29,ES20H20 200320C03420000,0,0,0,0,0, +ES XCZJLDUE3TT0|ES XCZJLC9NOB29,ES20H20 200320C03430000,0,0,0,0,0, +ES XCZJLDUK25US|ES XCZJLC9NOB29,ES20H20 200320C03440000,0,0,0,0,0, +ES XCZJLDUQ0HWK|ES XCZJLC9NOB29,ES20H20 200320C03450000,0,0,0,0,0, +ES XCZJLDUVYTYC|ES XCZJLC9NOB29,ES20H20 200320C03460000,0,0,0,0,0, +ES XCZJLDV1X604|ES XCZJLC9NOB29,ES20H20 200320C03470000,0,0,0,0,0, +ES XCZJLDV7VI1W|ES XCZJLC9NOB29,ES20H20 200320C03480000,0,0,0,0,0, +ES XCZJLDVDTU3O|ES XCZJLC9NOB29,ES20H20 200320C03490000,0,0,0,0,0, +ES XCZJLCFGEVR8|ES XCZJLC9NOB29,ES20H20 200320C03500000,0,0,0,0,0, +ES XCZJLDVPQI78|ES XCZJLC9NOB29,ES20H20 200320C03510000,0,0,0,0,0, +ES XCZJLDVVOU90|ES XCZJLC9NOB29,ES20H20 200320C03520000,0,0,0,0,0, +ES XCZJLDW1N6AS|ES XCZJLC9NOB29,ES20H20 200320C03530000,0,0,0,0,0, +ES XCZJLDW7LICK|ES XCZJLC9NOB29,ES20H20 200320C03540000,0,0,0,0,0, +ES XCZJLDWDJUEC|ES XCZJLC9NOB29,ES20H20 200320C03550000,0,0,0,0,0, +ES XCZJLDWJI6G4|ES XCZJLC9NOB29,ES20H20 200320C03560000,0,0,0,0,0, +ES XCZJLDWPGIHW|ES XCZJLC9NOB29,ES20H20 200320C03570000,0,0,0,0,0, +ES XCZJLDWVEUJO|ES XCZJLC9NOB29,ES20H20 200320C03580000,0,0,0,0,0, +ES XCZJLCFMD7T0|ES XCZJLC9NOB29,ES20H20 200320C03600000,0,0,0,0,0, +ES XCZJLDY136W4|ES XCZJLC9NOB29,ES20H20 200320C03650000,0,0,0,0,0, +ES XCZJLCFSBJUS|ES XCZJLC9NOB29,ES20H20 200320C03700000,0,0,0,0,0, +ES XCZJLDZOMJDW|ES XCZJLC9NOB29,ES20H20 200320C03750000,0,0,0,0,0, +ES XCZJLCFY9VWK|ES XCZJLC9NOB29,ES20H20 200320C03800000,0,0,0,0,0, +ES XCZJLE1C5VVO|ES XCZJLC9NOB29,ES20H20 200320C03850000,0,0,0,0,0, +ES XCZJLCG487YC|ES XCZJLC9NOB29,ES20H20 200320C03900000,0,0,0,0,0, +ES XCZJLUJ21C04|ES XCZJLC9NOB29,ES20H20 200320C03975000,0,0,0,0,0, +ES XCZJLCABWNDW|ES XCZJLC9NOB29,ES20H20 200320C04000000,0,0,0,0,0, +ES XCZJLCGG4W1W|ES XCZJLC9NOB29,ES20H20 200320C04100000,0,0,0,0,0, +ES XCZJLCGM383O|ES XCZJLC9NOB29,ES20H20 200320C04200000,0,0,0,0,0, +ES 31C3JQS9D84PW|ES XCZJLC9NOB29,ES20H20 200320P03000000,0,0,0,0,0, +ES 31C3JQTMNBL44|ES XCZJLC9NOB29,ES20H20 200320P03010000,0,0,0,0,0, +ES 31C3JQTMT9X5W|ES XCZJLC9NOB29,ES20H20 200320P03020000,0,0,0,0,0, +ES 31C3JR65596H0|ES XCZJLC9NOB29,ES20H20 200320P03025000,0,0,0,0,0, +ES 31C3JQTMZ897O|ES XCZJLC9NOB29,ES20H20 200320P03030000,0,0,0,0,0, +ES 31C3JQTN56L9G|ES XCZJLC9NOB29,ES20H20 200320P03040000,0,0,0,0,0, +ES 31C3JQTNB4XB8|ES XCZJLC9NOB29,ES20H20 200320P03050000,0,0,0,0,0, +ES 31C3JQTNH39D0|ES XCZJLC9NOB29,ES20H20 200320P03060000,0,0,0,0,0, +ES 31C3JQTNN1LES|ES XCZJLC9NOB29,ES20H20 200320P03070000,0,0,0,0,0, +ES 31C3JR6DEXWXW|ES XCZJLC9NOB29,ES20H20 200320P03075000,0,0,0,0,0, +ES 31C3JQTNSZXGK|ES XCZJLC9NOB29,ES20H20 200320P03080000,0,0,0,0,0, +ES 31C3JQTNYY9IC|ES XCZJLC9NOB29,ES20H20 200320P03090000,0,0,0,0,0, +ES 31C3JQSDZVCXW|ES XCZJLC9NOB29,ES20H20 200320P03100000,0,0,0,0,0, +ES 31C3JQTOAUXLW|ES XCZJLC9NOB29,ES20H20 200320P03110000,0,0,0,0,0, +ES 31C3JQTOGT9NO|ES XCZJLC9NOB29,ES20H20 200320P03120000,0,0,0,0,0, +ES 31C3JR6LOMNES|ES XCZJLC9NOB29,ES20H20 200320P03125000,0,0,0,0,0, +ES 31C3JQTOMRLPG|ES XCZJLC9NOB29,ES20H20 200320P03130000,0,0,0,0,0, +ES 31C3JQTOSPXR8|ES XCZJLC9NOB29,ES20H20 200320P03140000,0,0,0,0,0, +ES 31C3JQTOYO9T0|ES XCZJLC9NOB29,ES20H20 200320P03150000,0,0,0,0,0, +ES 31C3JQTP4MLUS|ES XCZJLC9NOB29,ES20H20 200320P03160000,0,0,0,0,0, +ES 31C3JQTPAKXWK|ES XCZJLC9NOB29,ES20H20 200320P03170000,0,0,0,0,0, +ES 31C3JR6TYBDVO|ES XCZJLC9NOB29,ES20H20 200320P03175000,0,0,0,0,0, +ES 31C3JQTPGJ9YC|ES XCZJLC9NOB29,ES20H20 200320P03180000,0,0,0,0,0, +ES 31C3JQTPMHM04|ES XCZJLC9NOB29,ES20H20 200320P03190000,0,0,0,0,0, +ES 31C3JQSE5TOZO|ES XCZJLC9NOB29,ES20H20 200320P03200000,0,0,0,0,0, +ES 31C3JQTPYEA3O|ES XCZJLC9NOB29,ES20H20 200320P03210000,0,0,0,0,0, +ES 31C3JQTQ4CM5G|ES XCZJLC9NOB29,ES20H20 200320P03220000,0,0,0,0,0, +ES 31C3JQTQAAY78|ES XCZJLC9NOB29,ES20H20 200320P03230000,0,0,0,0,0, +ES 31C3JQTQG9A90|ES XCZJLC9NOB29,ES20H20 200320P03240000,0,0,0,0,0, +ES 31C3JQTQM7MAS|ES XCZJLC9NOB29,ES20H20 200320P03250000,0,0,0,0,0, +ES 31C3JQTQS5YCK|ES XCZJLC9NOB29,ES20H20 200320P03260000,0,0,0,0,0, +ES 31C3JQTQY4AEC|ES XCZJLC9NOB29,ES20H20 200320P03270000,0,0,0,0,0, +ES 31C3JQTR42MG4|ES XCZJLC9NOB29,ES20H20 200320P03280000,0,0,0,0,0, +ES 31C3JQTRA0YHW|ES XCZJLC9NOB29,ES20H20 200320P03290000,0,0,0,0,0, +ES 31C3JQSEBS11G|ES XCZJLC9NOB29,ES20H20 200320P03300000,0,0,0,0,0, +ES 31C3JQTRLXMLG|ES XCZJLC9NOB29,ES20H20 200320P03310000,0,0,0,0,0, +ES 31C3JQTRRVYN8|ES XCZJLC9NOB29,ES20H20 200320P03320000,0,0,0,0,0, +ES 31C3JQTRXUAP0|ES XCZJLC9NOB29,ES20H20 200320P03330000,0,0,0,0,0, +ES 31C3JQTS3SMQS|ES XCZJLC9NOB29,ES20H20 200320P03340000,0,0,0,0,0, +ES 31C3JQTS9QYSK|ES XCZJLC9NOB29,ES20H20 200320P03350000,0,0,0,0,0, +ES 31C3JQTSFPAUC|ES XCZJLC9NOB29,ES20H20 200320P03360000,0,0,0,0,0, +ES 31C3JQTSLNMW4|ES XCZJLC9NOB29,ES20H20 200320P03370000,0,0,0,0,0, +ES 31C3JQTSRLYXW|ES XCZJLC9NOB29,ES20H20 200320P03380000,0,0,0,0,0, +ES 31C3JQTSXKAZO|ES XCZJLC9NOB29,ES20H20 200320P03390000,0,0,0,0,0, diff --git a/Data/futureoption/cme/universes/es/20200619/20200102.csv b/Data/futureoption/cme/universes/es/20200619/20200102.csv new file mode 100644 index 000000000000..afe9a5a4e1bc --- /dev/null +++ b/Data/futureoption/cme/universes/es/20200619/20200102.csv @@ -0,0 +1,109 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES XFH59UK0MYO1,ES19M20,3222.5,3245,3222.25,3234.25,385, +ES XFH59VWTAF1G|ES XFH59UK0MYO1,ES19M20 200619C02950000,0,0,0,0,0, +ES XFH59VWZ8R38|ES XFH59UK0MYO1,ES19M20 200619C02960000,0,0,0,0,0, +ES XFH59VX57350|ES XFH59UK0MYO1,ES19M20 200619C02970000,0,0,0,0,0, +ES XFH59VXB5F6S|ES XFH59UK0MYO1,ES19M20 200619C02980000,0,0,0,0,0, +ES XFH59VXH3R8K|ES XFH59UK0MYO1,ES19M20 200619C02990000,0,0,0,0,0, +ES XFH59UKIWYXW|ES XFH59UK0MYO1,ES19M20 200619C03000000,0,0,0,0,0, +ES XFH59VXT0FC4|ES XFH59UK0MYO1,ES19M20 200619C03010000,0,0,0,0,0, +ES XFH59VXYYRDW|ES XFH59UK0MYO1,ES19M20 200619C03020000,0,0,0,0,0, +ES XFH59VY4X3FO|ES XFH59UK0MYO1,ES19M20 200619C03030000,0,0,0,0,0, +ES XFH59VYAVFHG|ES XFH59UK0MYO1,ES19M20 200619C03040000,0,0,0,0,0, +ES XFH59VYGTRJ8|ES XFH59UK0MYO1,ES19M20 200619C03050000,0,0,0,0,0, +ES XFH59VYMS3L0|ES XFH59UK0MYO1,ES19M20 200619C03060000,0,0,0,0,0, +ES XFH59VYSQFMS|ES XFH59UK0MYO1,ES19M20 200619C03070000,0,0,0,0,0, +ES XFH59VYYOROK|ES XFH59UK0MYO1,ES19M20 200619C03080000,0,0,0,0,0, +ES XFH59VZ4N3QC|ES XFH59UK0MYO1,ES19M20 200619C03090000,0,0,0,0,0, +ES XFH59UP5K75W|ES XFH59UK0MYO1,ES19M20 200619C03100000,0,0,0,0,0, +ES XFH59VZGJRTW|ES XFH59UK0MYO1,ES19M20 200619C03110000,0,0,0,0,0, +ES XFH59VZMI3VO|ES XFH59UK0MYO1,ES19M20 200619C03120000,0,0,0,0,0, +ES XFH59VZSGFXG|ES XFH59UK0MYO1,ES19M20 200619C03130000,0,0,0,0,0, +ES XFH59VZYERZ8|ES XFH59UK0MYO1,ES19M20 200619C03140000,0,0,0,0,0, +ES XFH59W04D410|ES XFH59UK0MYO1,ES19M20 200619C03150000,0,0,0,0,0, +ES XFH59W0ABG2S|ES XFH59UK0MYO1,ES19M20 200619C03160000,0,0,0,0,0, +ES XFH59W0G9S4K|ES XFH59UK0MYO1,ES19M20 200619C03170000,0,0,0,0,0, +ES XFH59W0M846C|ES XFH59UK0MYO1,ES19M20 200619C03180000,0,0,0,0,0, +ES XFH59W0S6G84|ES XFH59UK0MYO1,ES19M20 200619C03190000,0,0,0,0,0, +ES XFH59UPBIJ7O|ES XFH59UK0MYO1,ES19M20 200619C03200000,0,0,0,0,0, +ES XFH59W1434BO|ES XFH59UK0MYO1,ES19M20 200619C03210000,0,0,0,0,0, +ES XFH59W1A1GDG|ES XFH59UK0MYO1,ES19M20 200619C03220000,0,0,0,0,0, +ES XFH59W1FZSF8|ES XFH59UK0MYO1,ES19M20 200619C03230000,0,0,0,0,0, +ES XFH59W1LY4H0|ES XFH59UK0MYO1,ES19M20 200619C03240000,0,0,0,0,0, +ES XFH59W1RWGIS|ES XFH59UK0MYO1,ES19M20 200619C03250000,0,0,0,0,0, +ES XFH59W1XUSKK|ES XFH59UK0MYO1,ES19M20 200619C03260000,0,0,0,0,0, +ES XFH59W23T4MC|ES XFH59UK0MYO1,ES19M20 200619C03270000,0,0,0,0,0, +ES XFH59W29RGO4|ES XFH59UK0MYO1,ES19M20 200619C03280000,0,0,0,0,0, +ES XFH59W2FPSPW|ES XFH59UK0MYO1,ES19M20 200619C03290000,0,0,0,0,0, +ES XFH59UPHGV9G|ES XFH59UK0MYO1,ES19M20 200619C03300000,0,0,0,0,0, +ES XFH59W2RMGTG|ES XFH59UK0MYO1,ES19M20 200619C03310000,0,0,0,0,0, +ES XFH59W2XKSV8|ES XFH59UK0MYO1,ES19M20 200619C03320000,0,0,0,0,0, +ES XFH59W33J4X0|ES XFH59UK0MYO1,ES19M20 200619C03330000,0,0,0,0,0, +ES XFH59W39HGYS|ES XFH59UK0MYO1,ES19M20 200619C03340000,0,0,0,0,0, +ES XFH59W3FFT0K|ES XFH59UK0MYO1,ES19M20 200619C03350000,0,0,0,0,0, +ES XFH59W3LE52C|ES XFH59UK0MYO1,ES19M20 200619C03360000,0,0,0,0,0, +ES XFH59W3RCH44|ES XFH59UK0MYO1,ES19M20 200619C03370000,0,0,0,0,0, +ES XFH59W3XAT5W|ES XFH59UK0MYO1,ES19M20 200619C03380000,0,0,0,0,0, +ES XFH59W43957O|ES XFH59UK0MYO1,ES19M20 200619C03390000,0,0,0,0,0, +ES XFH59UPNF7B8|ES XFH59UK0MYO1,ES19M20 200619C03400000,0,0,0,0,0, +ES XFH59W4F5TB8|ES XFH59UK0MYO1,ES19M20 200619C03410000,0,0,0,0,0, +ES XFH59W4L45D0|ES XFH59UK0MYO1,ES19M20 200619C03420000,0,0,0,0,0, +ES XFH59W4R2HES|ES XFH59UK0MYO1,ES19M20 200619C03430000,0,0,0,0,0, +ES XFH59W4X0TGK|ES XFH59UK0MYO1,ES19M20 200619C03440000,0,0,0,0,0, +ES XFH59W52Z5IC|ES XFH59UK0MYO1,ES19M20 200619C03450000,0,0,0,0,0, +ES XFH59W58XHK4|ES XFH59UK0MYO1,ES19M20 200619C03460000,0,0,0,0,0, +ES XFH59W5EVTLW|ES XFH59UK0MYO1,ES19M20 200619C03470000,0,0,0,0,0, +ES XFH59W5KU5NO|ES XFH59UK0MYO1,ES19M20 200619C03480000,0,0,0,0,0, +ES XFH59W5QSHPG|ES XFH59UK0MYO1,ES19M20 200619C03490000,0,0,0,0,0, +ES XFH59UPTDJD0|ES XFH59UK0MYO1,ES19M20 200619C03500000,0,0,0,0,0, +ES 31EL5FAO0XCG4|ES XFH59UK0MYO1,ES19M20 200619P02900000,0,0,0,0,0, +ES 31EL5FBVCQW84|ES XFH59UK0MYO1,ES19M20 200619P02910000,0,0,0,0,0, +ES 31EL5FBVIP89W|ES XFH59UK0MYO1,ES19M20 200619P02920000,0,0,0,0,0, +ES 31EL5FBVONKBO|ES XFH59UK0MYO1,ES19M20 200619P02930000,0,0,0,0,0, +ES 31EL5FBVULWDG|ES XFH59UK0MYO1,ES19M20 200619P02940000,0,0,0,0,0, +ES 31EL5FBW0K8F8|ES XFH59UK0MYO1,ES19M20 200619P02950000,0,0,0,0,0, +ES 31EL5FBW6IKH0|ES XFH59UK0MYO1,ES19M20 200619P02960000,0,0,0,0,0, +ES 31EL5FBWCGWIS|ES XFH59UK0MYO1,ES19M20 200619P02970000,0,0,0,0,0, +ES 31EL5FBWIF8KK|ES XFH59UK0MYO1,ES19M20 200619P02980000,0,0,0,0,0, +ES 31EL5FBWODKMC|ES XFH59UK0MYO1,ES19M20 200619P02990000,0,0,0,0,0, +ES 31EL5FAJQ6SBO|ES XFH59UK0MYO1,ES19M20 200619P03000000,0,0,0,0,0, +ES 31EL5FBX0A8PW|ES XFH59UK0MYO1,ES19M20 200619P03010000,0,0,0,0,0, +ES 31EL5FBX68KRO|ES XFH59UK0MYO1,ES19M20 200619P03020000,0,0,0,0,0, +ES 31EL5FBXC6WTG|ES XFH59UK0MYO1,ES19M20 200619P03030000,0,0,0,0,0, +ES 31EL5FBXI58V8|ES XFH59UK0MYO1,ES19M20 200619P03040000,0,0,0,0,0, +ES 31EL5FBXO3KX0|ES XFH59UK0MYO1,ES19M20 200619P03050000,0,0,0,0,0, +ES 31EL5FBXU1WYS|ES XFH59UK0MYO1,ES19M20 200619P03060000,0,0,0,0,0, +ES 31EL5FBY0090K|ES XFH59UK0MYO1,ES19M20 200619P03070000,0,0,0,0,0, +ES 31EL5FBY5YL2C|ES XFH59UK0MYO1,ES19M20 200619P03080000,0,0,0,0,0, +ES 31EL5FBYBWX44|ES XFH59UK0MYO1,ES19M20 200619P03090000,0,0,0,0,0, +ES 31EL5FAOCU0JO|ES XFH59UK0MYO1,ES19M20 200619P03100000,0,0,0,0,0, +ES 31EL5FBYNTL7O|ES XFH59UK0MYO1,ES19M20 200619P03110000,0,0,0,0,0, +ES 31EL5FBYTRX9G|ES XFH59UK0MYO1,ES19M20 200619P03120000,0,0,0,0,0, +ES 31EL5FBYZQ9B8|ES XFH59UK0MYO1,ES19M20 200619P03130000,0,0,0,0,0, +ES 31EL5FBZ5OLD0|ES XFH59UK0MYO1,ES19M20 200619P03140000,0,0,0,0,0, +ES 31EL5FBZBMXES|ES XFH59UK0MYO1,ES19M20 200619P03150000,0,0,0,0,0, +ES 31EL5FBZHL9GK|ES XFH59UK0MYO1,ES19M20 200619P03160000,0,0,0,0,0, +ES 31EL5FBZNJLIC|ES XFH59UK0MYO1,ES19M20 200619P03170000,0,0,0,0,0, +ES 31EL5FBZTHXK4|ES XFH59UK0MYO1,ES19M20 200619P03180000,0,0,0,0,0, +ES 31EL5FBZZG9LW|ES XFH59UK0MYO1,ES19M20 200619P03190000,0,0,0,0,0, +ES 31EL5FAOISCLG|ES XFH59UK0MYO1,ES19M20 200619P03200000,0,0,0,0,0, +ES 31EL5FC0BCXPG|ES XFH59UK0MYO1,ES19M20 200619P03210000,0,0,0,0,0, +ES 31EL5FC0HB9R8|ES XFH59UK0MYO1,ES19M20 200619P03220000,0,0,0,0,0, +ES 31EL5FC0N9LT0|ES XFH59UK0MYO1,ES19M20 200619P03230000,0,0,0,0,0, +ES 31EL5FC0T7XUS|ES XFH59UK0MYO1,ES19M20 200619P03240000,0,0,0,0,0, +ES 31EL5FC0Z69WK|ES XFH59UK0MYO1,ES19M20 200619P03250000,0,0,0,0,0, +ES 31EL5FC154LYC|ES XFH59UK0MYO1,ES19M20 200619P03260000,0,0,0,0,0, +ES 31EL5FC1B2Y04|ES XFH59UK0MYO1,ES19M20 200619P03270000,0,0,0,0,0, +ES 31EL5FC1H1A1W|ES XFH59UK0MYO1,ES19M20 200619P03280000,0,0,0,0,0, +ES 31EL5FC1MZM3O|ES XFH59UK0MYO1,ES19M20 200619P03290000,0,0,0,0,0, +ES 31EL5FAOOQON8|ES XFH59UK0MYO1,ES19M20 200619P03300000,0,0,0,0,0, +ES 31EL5FC1YWA78|ES XFH59UK0MYO1,ES19M20 200619P03310000,0,0,0,0,0, +ES 31EL5FC24UM90|ES XFH59UK0MYO1,ES19M20 200619P03320000,0,0,0,0,0, +ES 31EL5FC2ASYAS|ES XFH59UK0MYO1,ES19M20 200619P03330000,0,0,0,0,0, +ES 31EL5FC2GRACK|ES XFH59UK0MYO1,ES19M20 200619P03340000,0,0,0,0,0, +ES 31EL5FC2MPMEC|ES XFH59UK0MYO1,ES19M20 200619P03350000,0,0,0,0,0, +ES 31EL5FC2SNYG4|ES XFH59UK0MYO1,ES19M20 200619P03360000,0,0,0,0,0, +ES 31EL5FC2YMAHW|ES XFH59UK0MYO1,ES19M20 200619P03370000,0,0,0,0,0, +ES 31EL5FC34KMJO|ES XFH59UK0MYO1,ES19M20 200619P03380000,0,0,0,0,0, +ES 31EL5FC3AIYLG|ES XFH59UK0MYO1,ES19M20 200619P03390000,0,0,0,0,0, +ES 31EL5FAOUP0P0|ES XFH59UK0MYO1,ES19M20 200619P03400000,0,0,0,0,0, diff --git a/Data/futureoption/cme/universes/es/20200619/20200103.csv b/Data/futureoption/cme/universes/es/20200619/20200103.csv new file mode 100644 index 000000000000..dda7795ae44a --- /dev/null +++ b/Data/futureoption/cme/universes/es/20200619/20200103.csv @@ -0,0 +1,109 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES XFH59UK0MYO1,ES19M20,3222,3222.75,3216.25,3222.25,0, +ES XFH59VWTAF1G|ES XFH59UK0MYO1,ES19M20 200619C02950000,326,332.875,319.75,328.875,0, +ES XFH59VWZ8R38|ES XFH59UK0MYO1,ES19M20 200619C02960000,317.875,324.50,311.625,320.25,0, +ES XFH59VX57350|ES XFH59UK0MYO1,ES19M20 200619C02970000,309.75,316.25,303.375,312.0,0, +ES XFH59VXB5F6S|ES XFH59UK0MYO1,ES19M20 200619C02980000,301.50,308.125,295.375,303.875,0, +ES XFH59VXH3R8K|ES XFH59UK0MYO1,ES19M20 200619C02990000,293.50,299.875,287.125,295.75,0, +ES XFH59UKIWYXW|ES XFH59UK0MYO1,ES19M20 200619C03000000,285.375,292.125,279.125,288.125,0, +ES XFH59VXT0FC4|ES XFH59UK0MYO1,ES19M20 200619C03010000,277.5,284.125,271.125,280.0,0, +ES XFH59VXYYRDW|ES XFH59UK0MYO1,ES19M20 200619C03020000,269.5,276.125,263.125,272.25,0, +ES XFH59VY4X3FO|ES XFH59UK0MYO1,ES19M20 200619C03030000,261.625,268.00,255.375,263.875,0, +ES XFH59VYAVFHG|ES XFH59UK0MYO1,ES19M20 200619C03040000,253.75,260.375,248.25,256.25,0, +ES XFH59VYGTRJ8|ES XFH59UK0MYO1,ES19M20 200619C03050000,246.125,252.625,240.5,248.5,0, +ES XFH59VYMS3L0|ES XFH59UK0MYO1,ES19M20 200619C03060000,238.375,244.875,232.00,241.00,0, +ES XFH59VYSQFMS|ES XFH59UK0MYO1,ES19M20 200619C03070000,230.75,237.125,224.375,233.125,0, +ES XFH59VYYOROK|ES XFH59UK0MYO1,ES19M20 200619C03080000,223.125,229.375,216.875,225.125,0, +ES XFH59VZ4N3QC|ES XFH59UK0MYO1,ES19M20 200619C03090000,215.625,221.875,210.125,217.875,0, +ES XFH59UP5K75W|ES XFH59UK0MYO1,ES19M20 200619C03100000,208.00,214.375,201.75,210.375,0, +ES XFH59VZGJRTW|ES XFH59UK0MYO1,ES19M20 200619C03110000,200.625,207.25,195.125,202.875,0, +ES XFH59VZMI3VO|ES XFH59UK0MYO1,ES19M20 200619C03120000,193.25,199.875,186.875,195.625,0, +ES XFH59VZSGFXG|ES XFH59UK0MYO1,ES19M20 200619C03130000,186.125,192.625,179.75,188.375,0, +ES XFH59VZYERZ8|ES XFH59UK0MYO1,ES19M20 200619C03140000,178.875,185.125,173.125,180.625,0, +ES XFH59W04D410|ES XFH59UK0MYO1,ES19M20 200619C03150000,171.75,178.25,166.125,174.00,0, +ES XFH59W0ABG2S|ES XFH59UK0MYO1,ES19M20 200619C03160000,164.625,170.75,158.375,165.625,0, +ES XFH59W0G9S4K|ES XFH59UK0MYO1,ES19M20 200619C03170000,157.75,164.375,152.25,160.00,0, +ES XFH59W0M846C|ES XFH59UK0MYO1,ES19M20 200619C03180000,150.875,157.00,145.375,152.875,0, +ES XFH59W0S6G84|ES XFH59UK0MYO1,ES19M20 200619C03190000,144.125,150.25,138.625,145.00,0, +ES XFH59UPBIJ7O|ES XFH59UK0MYO1,ES19M20 200619C03200000,137.50,143.50,132.00,139.375,0, +ES XFH59W1434BO|ES XFH59UK0MYO1,ES19M20 200619C03210000,130.875,137.00,125.375,133.00,0, +ES XFH59W1A1GDG|ES XFH59UK0MYO1,ES19M20 200619C03220000,124.5,130.625,118.50,126.50,0, +ES XFH59W1FZSF8|ES XFH59UK0MYO1,ES19M20 200619C03230000,118.25,124.25,112.625,120.125,0, +ES XFH59W1LY4H0|ES XFH59UK0MYO1,ES19M20 200619C03240000,112.25,118.00,106.25,113.875,0, +ES XFH59W1RWGIS|ES XFH59UK0MYO1,ES19M20 200619C03250000,69.5,122.625,52.5,107.875,0, +ES XFH59W1XUSKK|ES XFH59UK0MYO1,ES19M20 200619C03260000,100.375,106.125,94.625,101.875,0, +ES XFH59W23T4MC|ES XFH59UK0MYO1,ES19M20 200619C03270000,94.625,100.25,88.875,96,0, +ES XFH59W29RGO4|ES XFH59UK0MYO1,ES19M20 200619C03280000,89.125,94.875,83.125,90.375,0, +ES XFH59W2FPSPW|ES XFH59UK0MYO1,ES19M20 200619C03290000,83.625,89.125,77.875,85,0, +ES XFH59UPHGV9G|ES XFH59UK0MYO1,ES19M20 200619C03300000,78.375,84.125,72.5,79.5,0, +ES XFH59W2RMGTG|ES XFH59UK0MYO1,ES19M20 200619C03310000,73.25,78.75,67.375,74.5,0, +ES XFH59W2XKSV8|ES XFH59UK0MYO1,ES19M20 200619C03320000,68.50,73.875,62.125,69.5,0, +ES XFH59W33J4X0|ES XFH59UK0MYO1,ES19M20 200619C03330000,63.75,69.125,57.50,64.625,0, +ES XFH59W39HGYS|ES XFH59UK0MYO1,ES19M20 200619C03340000,59.25,64.625,53.00,60,0, +ES XFH59W3FFT0K|ES XFH59UK0MYO1,ES19M20 200619C03350000,55.0,60.25,48.875,55.75,0, +ES XFH59W3LE52C|ES XFH59UK0MYO1,ES19M20 200619C03360000,50.875,56.125,45.0,51.5,0, +ES XFH59W3RCH44|ES XFH59UK0MYO1,ES19M20 200619C03370000,47.00,52.125,41.25,47.50,0, +ES XFH59W3XAT5W|ES XFH59UK0MYO1,ES19M20 200619C03380000,43.25,48.375,37.125,43.875,0, +ES XFH59W43957O|ES XFH59UK0MYO1,ES19M20 200619C03390000,39.875,44.875,33.875,40.375,0, +ES XFH59UPNF7B8|ES XFH59UK0MYO1,ES19M20 200619C03400000,30.5,41.75,25.125,37.00,0, +ES XFH59W4F5TB8|ES XFH59UK0MYO1,ES19M20 200619C03410000,33.625,38.50,27.625,33.875,0, +ES XFH59W4L45D0|ES XFH59UK0MYO1,ES19M20 200619C03420000,30.75,35.625,24.50,31.00,0, +ES XFH59W4R2HES|ES XFH59UK0MYO1,ES19M20 200619C03430000,28.125,32.75,21.875,28.25,0, +ES XFH59W4X0TGK|ES XFH59UK0MYO1,ES19M20 200619C03440000,25.625,30.375,19.50,25.75,0, +ES XFH59W52Z5IC|ES XFH59UK0MYO1,ES19M20 200619C03450000,23.50,28.125,17.25,23.50,0, +ES XFH59W58XHK4|ES XFH59UK0MYO1,ES19M20 200619C03460000,21.375,26.00,15.25,21.375,0, +ES XFH59W5EVTLW|ES XFH59UK0MYO1,ES19M20 200619C03470000,19.375,24.00,13.5,19.375,0, +ES XFH59W5KU5NO|ES XFH59UK0MYO1,ES19M20 200619C03480000,17.625,22.375,11.75,17.625,0, +ES XFH59W5QSHPG|ES XFH59UK0MYO1,ES19M20 200619C03490000,16.125,20.875,10.20,16.125,0, +ES XFH59UPTDJD0|ES XFH59UK0MYO1,ES19M20 200619C03500000,14.625,19.375,8.925,14.625,0, +ES 31EL5FAO0XCG4|ES XFH59UK0MYO1,ES19M20 200619P02900000,60,70.5,40.25,49.875,0, +ES 31EL5FBVCQW84|ES XFH59UK0MYO1,ES19M20 200619P02910000,52.125,57.875,46.875,51.375,0, +ES 31EL5FBVIP89W|ES XFH59UK0MYO1,ES19M20 200619P02920000,53.75,59.875,48.375,53,0, +ES 31EL5FBVONKBO|ES XFH59UK0MYO1,ES19M20 200619P02930000,55.25,61.00,49.875,54.625,0, +ES 31EL5FBVULWDG|ES XFH59UK0MYO1,ES19M20 200619P02940000,57.0,62.625,51.375,56.125,0, +ES 31EL5FBW0K8F8|ES XFH59UK0MYO1,ES19M20 200619P02950000,58.625,64.375,53.25,57.875,0, +ES 31EL5FBW6IKH0|ES XFH59UK0MYO1,ES19M20 200619P02960000,60.25,66.125,54.875,59.5,0, +ES 31EL5FBWCGWIS|ES XFH59UK0MYO1,ES19M20 200619P02970000,62.00,68.125,56.625,61.125,0, +ES 31EL5FBWIF8KK|ES XFH59UK0MYO1,ES19M20 200619P02980000,63.75,69.625,58.5,63,0, +ES 31EL5FBWODKMC|ES XFH59UK0MYO1,ES19M20 200619P02990000,65.625,71.50,60.25,64.75,0, +ES 31EL5FAJQ6SBO|ES XFH59UK0MYO1,ES19M20 200619P03000000,68.75,70.5,61.875,66.625,0, +ES 31EL5FBX0A8PW|ES XFH59UK0MYO1,ES19M20 200619P03010000,69.375,75.25,64,68.5,0, +ES 31EL5FBX68KRO|ES XFH59UK0MYO1,ES19M20 200619P03020000,71.25,77.375,66,70.5,0, +ES 31EL5FBXC6WTG|ES XFH59UK0MYO1,ES19M20 200619P03030000,73.25,79.625,68,72.5,0, +ES 31EL5FBXI58V8|ES XFH59UK0MYO1,ES19M20 200619P03040000,75.375,81.50,70.125,74.375,0, +ES 31EL5FBXO3KX0|ES XFH59UK0MYO1,ES19M20 200619P03050000,137.375,139.25,72.375,76.5,0, +ES 31EL5FBXU1WYS|ES XFH59UK0MYO1,ES19M20 200619P03060000,79.625,85.75,74.5,78.625,0, +ES 31EL5FBY0090K|ES XFH59UK0MYO1,ES19M20 200619P03070000,81.875,88.5,76.50,80.875,0, +ES 31EL5FBY5YL2C|ES XFH59UK0MYO1,ES19M20 200619P03080000,84.25,90.375,79.125,83.25,0, +ES 31EL5FBYBWX44|ES XFH59UK0MYO1,ES19M20 200619P03090000,86.50,92.875,81.375,85.5,0, +ES 31EL5FAOCU0JO|ES XFH59UK0MYO1,ES19M20 200619P03100000,88.875,95.375,83.875,88,0, +ES 31EL5FBYNTL7O|ES XFH59UK0MYO1,ES19M20 200619P03110000,91.375,97.875,86.25,90.25,0, +ES 31EL5FBYTRX9G|ES XFH59UK0MYO1,ES19M20 200619P03120000,93.875,100.50,88.875,93,0, +ES 31EL5FBYZQ9B8|ES XFH59UK0MYO1,ES19M20 200619P03130000,96.625,103.00,91.625,95.625,0, +ES 31EL5FBZ5OLD0|ES XFH59UK0MYO1,ES19M20 200619P03140000,99.375,106.125,94.375,98.375,0, +ES 31EL5FBZBMXES|ES XFH59UK0MYO1,ES19M20 200619P03150000,102.25,108.625,97.125,101.125,0, +ES 31EL5FBZHL9GK|ES XFH59UK0MYO1,ES19M20 200619P03160000,105.0,112.25,100.125,103.875,0, +ES 31EL5FBZNJLIC|ES XFH59UK0MYO1,ES19M20 200619P03170000,108.0,114.50,103.125,106.875,0, +ES 31EL5FBZTHXK4|ES XFH59UK0MYO1,ES19M20 200619P03180000,111.125,117.50,106.125,109.875,0, +ES 31EL5FBZZG9LW|ES XFH59UK0MYO1,ES19M20 200619P03190000,114.25,120.875,108.875,113.00,0, +ES 31EL5FAOISCLG|ES XFH59UK0MYO1,ES19M20 200619P03200000,157.125,159.375,112.50,116.125,0, +ES 31EL5FC0BCXPG|ES XFH59UK0MYO1,ES19M20 200619P03210000,121.0,127.50,115.875,119.50,0, +ES 31EL5FC0HB9R8|ES XFH59UK0MYO1,ES19M20 200619P03220000,124.5,131.00,119.25,122.875,0, +ES 31EL5FC0N9LT0|ES XFH59UK0MYO1,ES19M20 200619P03230000,128.125,134.50,123.00,126.50,0, +ES 31EL5FC0T7XUS|ES XFH59UK0MYO1,ES19M20 200619P03240000,132.75,138.875,126.75,130.50,0, +ES 31EL5FC0Z69WK|ES XFH59UK0MYO1,ES19M20 200619P03250000,136.625,142.375,130.375,134.50,0, +ES 31EL5FC154LYC|ES XFH59UK0MYO1,ES19M20 200619P03260000,140.625,146.5,134.75,138.25,0, +ES 31EL5FC1B2Y04|ES XFH59UK0MYO1,ES19M20 200619P03270000,144.875,150.375,138.875,143.75,0, +ES 31EL5FC1H1A1W|ES XFH59UK0MYO1,ES19M20 200619P03280000,149.125,155.50,143.25,148.375,0, +ES 31EL5FC1MZM3O|ES XFH59UK0MYO1,ES19M20 200619P03290000,153.625,160.00,147.75,152.75,0, +ES 31EL5FAOOQON8|ES XFH59UK0MYO1,ES19M20 200619P03300000,158.25,164.75,152.00,156.00,0, +ES 31EL5FC1YWA78|ES XFH59UK0MYO1,ES19M20 200619P03310000,163.125,169.50,156.75,161.0,0, +ES 31EL5FC24UM90|ES XFH59UK0MYO1,ES19M20 200619P03320000,168.125,174.625,161.75,166.0,0, +ES 31EL5FC2ASYAS|ES XFH59UK0MYO1,ES19M20 200619P03330000,173.5,179.75,167.125,171.375,0, +ES 31EL5FC2GRACK|ES XFH59UK0MYO1,ES19M20 200619P03340000,178.875,185.375,172.375,176.625,0, +ES 31EL5FC2MPMEC|ES XFH59UK0MYO1,ES19M20 200619P03350000,184.375,191.00,178.125,182.375,0, +ES 31EL5FC2SNYG4|ES XFH59UK0MYO1,ES19M20 200619P03360000,190.25,196.75,183.875,188.125,0, +ES 31EL5FC2YMAHW|ES XFH59UK0MYO1,ES19M20 200619P03370000,196.25,202.625,189.875,194.125,0, +ES 31EL5FC34KMJO|ES XFH59UK0MYO1,ES19M20 200619P03380000,202.5,209.00,196.00,200.25,0, +ES 31EL5FC3AIYLG|ES XFH59UK0MYO1,ES19M20 200619P03390000,208.875,215.50,202.375,206.75,0, +ES 31EL5FAOUP0P0|ES XFH59UK0MYO1,ES19M20 200619P03400000,215.625,222.125,209.00,213.25,0, diff --git a/Data/futureoption/cme/universes/es/20200619/20200106.csv b/Data/futureoption/cme/universes/es/20200619/20200106.csv new file mode 100644 index 000000000000..0b38ec17851a --- /dev/null +++ b/Data/futureoption/cme/universes/es/20200619/20200106.csv @@ -0,0 +1,109 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES XFH59UK0MYO1,ES19M20,3240.25,3244.25,3226,3233,378, +ES XFH59VWTAF1G|ES XFH59UK0MYO1,ES19M20 200619C02950000,342.625,342.625,342.375,342.5,0, +ES XFH59VWZ8R38|ES XFH59UK0MYO1,ES19M20 200619C02960000,334.25,334.25,334.125,334.125,0, +ES XFH59VX57350|ES XFH59UK0MYO1,ES19M20 200619C02970000,325.875,325.875,325.75,325.75,0, +ES XFH59VXB5F6S|ES XFH59UK0MYO1,ES19M20 200619C02980000,317.625,317.625,317.5,317.5,0, +ES XFH59VXH3R8K|ES XFH59UK0MYO1,ES19M20 200619C02990000,309.375,309.375,309.25,309.25,0, +ES XFH59UKIWYXW|ES XFH59UK0MYO1,ES19M20 200619C03000000,158.625,301.125,158.5,301,0, +ES XFH59VXT0FC4|ES XFH59UK0MYO1,ES19M20 200619C03010000,293.25,293.25,292.75,293,0, +ES XFH59VXYYRDW|ES XFH59UK0MYO1,ES19M20 200619C03020000,284.75,284.75,284.75,284.75,0, +ES XFH59VY4X3FO|ES XFH59UK0MYO1,ES19M20 200619C03030000,276.75,276.75,276.625,276.625,0, +ES XFH59VYAVFHG|ES XFH59UK0MYO1,ES19M20 200619C03040000,268.75,268.75,268.625,268.625,0, +ES XFH59VYGTRJ8|ES XFH59UK0MYO1,ES19M20 200619C03050000,260.75,260.75,260.625,260.625,0, +ES XFH59VYMS3L0|ES XFH59UK0MYO1,ES19M20 200619C03060000,252.875,252.875,252.75,252.875,0, +ES XFH59VYSQFMS|ES XFH59UK0MYO1,ES19M20 200619C03070000,245.5,245.5,244.875,245.25,0, +ES XFH59VYYOROK|ES XFH59UK0MYO1,ES19M20 200619C03080000,237.375,237.75,237.125,237.5,0, +ES XFH59VZ4N3QC|ES XFH59UK0MYO1,ES19M20 200619C03090000,229.625,230.0,229.375,229.75,0, +ES XFH59UP5K75W|ES XFH59UK0MYO1,ES19M20 200619C03100000,221.875,222.375,161.25,222.0,0, +ES XFH59VZGJRTW|ES XFH59UK0MYO1,ES19M20 200619C03110000,214.375,214.75,214.125,214.5,0, +ES XFH59VZMI3VO|ES XFH59UK0MYO1,ES19M20 200619C03120000,206.75,207.0,206.625,207.0,0, +ES XFH59VZSGFXG|ES XFH59UK0MYO1,ES19M20 200619C03130000,199.25,199.625,199.125,199.5,0, +ES XFH59VZYERZ8|ES XFH59UK0MYO1,ES19M20 200619C03140000,192.25,192.25,191.75,192.0,0, +ES XFH59W04D410|ES XFH59UK0MYO1,ES19M20 200619C03150000,184.50,184.875,184.375,184.75,0, +ES XFH59W0ABG2S|ES XFH59UK0MYO1,ES19M20 200619C03160000,177.25,177.5,177.125,177.5,0, +ES XFH59W0G9S4K|ES XFH59UK0MYO1,ES19M20 200619C03170000,170.25,170.5,170.00,170.25,0, +ES XFH59W0M846C|ES XFH59UK0MYO1,ES19M20 200619C03180000,163.00,163.25,162.875,163.125,0, +ES XFH59W0S6G84|ES XFH59UK0MYO1,ES19M20 200619C03190000,156.00,156.25,156.00,156.125,0, +ES XFH59UPBIJ7O|ES XFH59UK0MYO1,ES19M20 200619C03200000,149.25,149.5,79.875,149.25,0, +ES XFH59W1434BO|ES XFH59UK0MYO1,ES19M20 200619C03210000,142.375,142.625,142.25,142.5,0, +ES XFH59W1A1GDG|ES XFH59UK0MYO1,ES19M20 200619C03220000,135.75,136.0,135.50,135.75,0, +ES XFH59W1FZSF8|ES XFH59UK0MYO1,ES19M20 200619C03230000,129.00,129.375,128.875,129.25,0, +ES XFH59W1LY4H0|ES XFH59UK0MYO1,ES19M20 200619C03240000,122.75,122.875,122.50,122.75,0, +ES XFH59W1RWGIS|ES XFH59UK0MYO1,ES19M20 200619C03250000,116.375,127,115.875,116.25,0, +ES XFH59W1XUSKK|ES XFH59UK0MYO1,ES19M20 200619C03260000,110.125,116.75,109.875,110.125,0, +ES XFH59W23T4MC|ES XFH59UK0MYO1,ES19M20 200619C03270000,104.125,104.25,103.875,104.0,0, +ES XFH59W29RGO4|ES XFH59UK0MYO1,ES19M20 200619C03280000,98.125,98.25,97.75,98.125,0, +ES XFH59W2FPSPW|ES XFH59UK0MYO1,ES19M20 200619C03290000,92.375,92.5,92.00,92.375,0, +ES XFH59UPHGV9G|ES XFH59UK0MYO1,ES19M20 200619C03300000,86.875,87.0,86.375,86.75,0, +ES XFH59W2RMGTG|ES XFH59UK0MYO1,ES19M20 200619C03310000,81.375,81.5,81.00,81.375,0, +ES XFH59W2XKSV8|ES XFH59UK0MYO1,ES19M20 200619C03320000,76.125,76.25,75.625,76.125,0, +ES XFH59W33J4X0|ES XFH59UK0MYO1,ES19M20 200619C03330000,71.0,71.25,70.50,71.125,0, +ES XFH59W39HGYS|ES XFH59UK0MYO1,ES19M20 200619C03340000,66.125,66.375,65.75,66.125,0, +ES XFH59W3FFT0K|ES XFH59UK0MYO1,ES19M20 200619C03350000,61.5,61.625,61.25,61.375,0, +ES XFH59W3LE52C|ES XFH59UK0MYO1,ES19M20 200619C03360000,57.0,57.125,56.75,57.0,0, +ES XFH59W3RCH44|ES XFH59UK0MYO1,ES19M20 200619C03370000,52.75,52.875,52.25,52.625,0, +ES XFH59W3XAT5W|ES XFH59UK0MYO1,ES19M20 200619C03380000,48.5,48.625,48.5,48.625,0, +ES XFH59W43957O|ES XFH59UK0MYO1,ES19M20 200619C03390000,44.75,44.875,44.625,44.75,0, +ES XFH59UPNF7B8|ES XFH59UK0MYO1,ES19M20 200619C03400000,41.125,41.125,40.875,41.125,0, +ES XFH59W4F5TB8|ES XFH59UK0MYO1,ES19M20 200619C03410000,37.625,37.75,37.375,37.625,0, +ES XFH59W4L45D0|ES XFH59UK0MYO1,ES19M20 200619C03420000,34.25,34.625,34.25,34.375,0, +ES XFH59W4R2HES|ES XFH59UK0MYO1,ES19M20 200619C03430000,31.50,31.625,31.25,31.375,0, +ES XFH59W4X0TGK|ES XFH59UK0MYO1,ES19M20 200619C03440000,28.5,28.75,28.5,28.625,0, +ES XFH59W52Z5IC|ES XFH59UK0MYO1,ES19M20 200619C03450000,26.0,26.25,25.875,26.00,0, +ES XFH59W58XHK4|ES XFH59UK0MYO1,ES19M20 200619C03460000,23.625,23.75,23.5,23.625,0, +ES XFH59W5EVTLW|ES XFH59UK0MYO1,ES19M20 200619C03470000,21.5,21.625,21.375,21.50,0, +ES XFH59W5KU5NO|ES XFH59UK0MYO1,ES19M20 200619C03480000,19.5,19.625,19.375,19.50,0, +ES XFH59W5QSHPG|ES XFH59UK0MYO1,ES19M20 200619C03490000,17.625,17.875,17.625,17.75,0, +ES XFH59UPTDJD0|ES XFH59UK0MYO1,ES19M20 200619C03500000,16.125,16.25,15.875,16.00,0, +ES 31EL5FAO0XCG4|ES XFH59UK0MYO1,ES19M20 200619P02900000,45.0,45.125,45.0,45.125,0, +ES 31EL5FBVCQW84|ES XFH59UK0MYO1,ES19M20 200619P02910000,46.375,46.5,46.125,46.375,0, +ES 31EL5FBVIP89W|ES XFH59UK0MYO1,ES19M20 200619P02920000,47.875,48.0,47.75,47.875,0, +ES 31EL5FBVONKBO|ES XFH59UK0MYO1,ES19M20 200619P02930000,49.25,49.375,49.25,49.25,0, +ES 31EL5FBVULWDG|ES XFH59UK0MYO1,ES19M20 200619P02940000,50.75,50.875,50.75,50.875,0, +ES 31EL5FBW0K8F8|ES XFH59UK0MYO1,ES19M20 200619P02950000,52.25,52.375,52.25,52.375,0, +ES 31EL5FBW6IKH0|ES XFH59UK0MYO1,ES19M20 200619P02960000,53.75,53.875,53.75,53.875,0, +ES 31EL5FBWCGWIS|ES XFH59UK0MYO1,ES19M20 200619P02970000,55.375,55.625,55.25,55.625,0, +ES 31EL5FBWIF8KK|ES XFH59UK0MYO1,ES19M20 200619P02980000,57.0,57.125,57.0,57.125,0, +ES 31EL5FBWODKMC|ES XFH59UK0MYO1,ES19M20 200619P02990000,58.75,58.875,58.75,58.875,0, +ES 31EL5FAJQ6SBO|ES XFH59UK0MYO1,ES19M20 200619P03000000,60.375,60.625,60.375,60.625,0, +ES 31EL5FBX0A8PW|ES XFH59UK0MYO1,ES19M20 200619P03010000,62.125,62.375,62.125,62.375,0, +ES 31EL5FBX68KRO|ES XFH59UK0MYO1,ES19M20 200619P03020000,64.0,64.125,64.0,64.125,0, +ES 31EL5FBXC6WTG|ES XFH59UK0MYO1,ES19M20 200619P03030000,65.875,66.25,65.625,66.125,0, +ES 31EL5FBXI58V8|ES XFH59UK0MYO1,ES19M20 200619P03040000,67.75,68.0,67.625,67.875,0, +ES 31EL5FBXO3KX0|ES XFH59UK0MYO1,ES19M20 200619P03050000,69.75,70.0,69.625,69.875,0, +ES 31EL5FBXU1WYS|ES XFH59UK0MYO1,ES19M20 200619P03060000,71.75,72.0,71.625,71.875,0, +ES 31EL5FBY0090K|ES XFH59UK0MYO1,ES19M20 200619P03070000,73.75,74.125,73.625,74.0,0, +ES 31EL5FBY5YL2C|ES XFH59UK0MYO1,ES19M20 200619P03080000,76.0,76.25,75.875,76.125,0, +ES 31EL5FBYBWX44|ES XFH59UK0MYO1,ES19M20 200619P03090000,78.125,78.5,78.0,78.375,0, +ES 31EL5FAOCU0JO|ES XFH59UK0MYO1,ES19M20 200619P03100000,80.375,80.75,80.375,80.625,0, +ES 31EL5FBYNTL7O|ES XFH59UK0MYO1,ES19M20 200619P03110000,82.75,83.0,82.625,82.875,0, +ES 31EL5FBYTRX9G|ES XFH59UK0MYO1,ES19M20 200619P03120000,85.125,85.5,85.00,85.25,0, +ES 31EL5FBYZQ9B8|ES XFH59UK0MYO1,ES19M20 200619P03130000,87.625,87.875,87.50,87.75,0, +ES 31EL5FBZ5OLD0|ES XFH59UK0MYO1,ES19M20 200619P03140000,90.125,90.375,90.00,90.25,0, +ES 31EL5FBZBMXES|ES XFH59UK0MYO1,ES19M20 200619P03150000,92.625,93.0,92.625,92.875,0, +ES 31EL5FBZHL9GK|ES XFH59UK0MYO1,ES19M20 200619P03160000,95.375,95.625,95.25,95.5,0, +ES 31EL5FBZNJLIC|ES XFH59UK0MYO1,ES19M20 200619P03170000,98.125,98.375,98.00,98.25,0, +ES 31EL5FBZTHXK4|ES XFH59UK0MYO1,ES19M20 200619P03180000,101.0,101.25,100.875,101.25,0, +ES 31EL5FBZZG9LW|ES XFH59UK0MYO1,ES19M20 200619P03190000,103.875,104.125,103.75,104.0,0, +ES 31EL5FAOISCLG|ES XFH59UK0MYO1,ES19M20 200619P03200000,106.875,107.25,106.75,107.125,0, +ES 31EL5FC0BCXPG|ES XFH59UK0MYO1,ES19M20 200619P03210000,110.00,110.375,110.00,110.25,0, +ES 31EL5FC0HB9R8|ES XFH59UK0MYO1,ES19M20 200619P03220000,113.25,113.625,113.125,113.5,0, +ES 31EL5FC0N9LT0|ES XFH59UK0MYO1,ES19M20 200619P03230000,116.625,116.875,116.50,116.875,0, +ES 31EL5FC0T7XUS|ES XFH59UK0MYO1,ES19M20 200619P03240000,120.00,120.375,120.00,120.25,0, +ES 31EL5FC0Z69WK|ES XFH59UK0MYO1,ES19M20 200619P03250000,123.75,123.875,123.50,123.875,0, +ES 31EL5FC154LYC|ES XFH59UK0MYO1,ES19M20 200619P03260000,127.50,127.625,127.25,127.625,0, +ES 31EL5FC1B2Y04|ES XFH59UK0MYO1,ES19M20 200619P03270000,131.25,131.625,131.00,131.5,0, +ES 31EL5FC1H1A1W|ES XFH59UK0MYO1,ES19M20 200619P03280000,135.25,135.625,135.125,135.5,0, +ES 31EL5FC1MZM3O|ES XFH59UK0MYO1,ES19M20 200619P03290000,139.50,139.875,139.375,139.625,0, +ES 31EL5FAOOQON8|ES XFH59UK0MYO1,ES19M20 200619P03300000,143.75,144.125,142.125,144.0,0, +ES 31EL5FC1YWA78|ES XFH59UK0MYO1,ES19M20 200619P03310000,148.375,148.625,148.00,148.5,0, +ES 31EL5FC24UM90|ES XFH59UK0MYO1,ES19M20 200619P03320000,152.75,153.375,152.75,153.25,0, +ES 31EL5FC2ASYAS|ES XFH59UK0MYO1,ES19M20 200619P03330000,157.875,158.25,157.625,158.0,0, +ES 31EL5FC2GRACK|ES XFH59UK0MYO1,ES19M20 200619P03340000,162.875,163.25,162.75,163.125,0, +ES 31EL5FC2MPMEC|ES XFH59UK0MYO1,ES19M20 200619P03350000,168.125,168.50,168.00,168.375,0, +ES 31EL5FC2SNYG4|ES XFH59UK0MYO1,ES19M20 200619P03360000,173.5,174.00,173.25,173.75,0, +ES 31EL5FC2YMAHW|ES XFH59UK0MYO1,ES19M20 200619P03370000,179.25,179.75,179.00,179.5,0, +ES 31EL5FC34KMJO|ES XFH59UK0MYO1,ES19M20 200619P03380000,185,185.50,184.75,185.25,0, +ES 31EL5FC3AIYLG|ES XFH59UK0MYO1,ES19M20 200619P03390000,191.25,191.625,190.875,191.375,0, +ES 31EL5FAOUP0P0|ES XFH59UK0MYO1,ES19M20 200619P03400000,197.375,197.875,197.375,197.625,0, diff --git a/Data/futureoption/cme/universes/es/20200619/20200107.csv b/Data/futureoption/cme/universes/es/20200619/20200107.csv new file mode 100644 index 000000000000..1530ccd50877 --- /dev/null +++ b/Data/futureoption/cme/universes/es/20200619/20200107.csv @@ -0,0 +1,109 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES XFH59UK0MYO1,ES19M20,3239.25,3267.5,3237.5,3260.5,725, +ES XFH59VWTAF1G|ES XFH59UK0MYO1,ES19M20 200619C02950000,0,0,0,0,0, +ES XFH59VWZ8R38|ES XFH59UK0MYO1,ES19M20 200619C02960000,0,0,0,0,0, +ES XFH59VX57350|ES XFH59UK0MYO1,ES19M20 200619C02970000,0,0,0,0,0, +ES XFH59VXB5F6S|ES XFH59UK0MYO1,ES19M20 200619C02980000,0,0,0,0,0, +ES XFH59VXH3R8K|ES XFH59UK0MYO1,ES19M20 200619C02990000,0,0,0,0,0, +ES XFH59UKIWYXW|ES XFH59UK0MYO1,ES19M20 200619C03000000,0,0,0,0,0, +ES XFH59VXT0FC4|ES XFH59UK0MYO1,ES19M20 200619C03010000,0,0,0,0,0, +ES XFH59VXYYRDW|ES XFH59UK0MYO1,ES19M20 200619C03020000,0,0,0,0,0, +ES XFH59VY4X3FO|ES XFH59UK0MYO1,ES19M20 200619C03030000,0,0,0,0,0, +ES XFH59VYAVFHG|ES XFH59UK0MYO1,ES19M20 200619C03040000,0,0,0,0,0, +ES XFH59VYGTRJ8|ES XFH59UK0MYO1,ES19M20 200619C03050000,0,0,0,0,0, +ES XFH59VYMS3L0|ES XFH59UK0MYO1,ES19M20 200619C03060000,0,0,0,0,0, +ES XFH59VYSQFMS|ES XFH59UK0MYO1,ES19M20 200619C03070000,0,0,0,0,0, +ES XFH59VYYOROK|ES XFH59UK0MYO1,ES19M20 200619C03080000,0,0,0,0,0, +ES XFH59VZ4N3QC|ES XFH59UK0MYO1,ES19M20 200619C03090000,0,0,0,0,0, +ES XFH59UP5K75W|ES XFH59UK0MYO1,ES19M20 200619C03100000,0,0,0,0,0, +ES XFH59VZGJRTW|ES XFH59UK0MYO1,ES19M20 200619C03110000,0,0,0,0,0, +ES XFH59VZMI3VO|ES XFH59UK0MYO1,ES19M20 200619C03120000,0,0,0,0,0, +ES XFH59VZSGFXG|ES XFH59UK0MYO1,ES19M20 200619C03130000,0,0,0,0,0, +ES XFH59VZYERZ8|ES XFH59UK0MYO1,ES19M20 200619C03140000,0,0,0,0,0, +ES XFH59W04D410|ES XFH59UK0MYO1,ES19M20 200619C03150000,0,0,0,0,0, +ES XFH59W0ABG2S|ES XFH59UK0MYO1,ES19M20 200619C03160000,0,0,0,0,0, +ES XFH59W0G9S4K|ES XFH59UK0MYO1,ES19M20 200619C03170000,0,0,0,0,0, +ES XFH59W0M846C|ES XFH59UK0MYO1,ES19M20 200619C03180000,0,0,0,0,0, +ES XFH59W0S6G84|ES XFH59UK0MYO1,ES19M20 200619C03190000,0,0,0,0,0, +ES XFH59UPBIJ7O|ES XFH59UK0MYO1,ES19M20 200619C03200000,0,0,0,0,0, +ES XFH59W1434BO|ES XFH59UK0MYO1,ES19M20 200619C03210000,0,0,0,0,0, +ES XFH59W1A1GDG|ES XFH59UK0MYO1,ES19M20 200619C03220000,0,0,0,0,0, +ES XFH59W1FZSF8|ES XFH59UK0MYO1,ES19M20 200619C03230000,0,0,0,0,0, +ES XFH59W1LY4H0|ES XFH59UK0MYO1,ES19M20 200619C03240000,0,0,0,0,0, +ES XFH59W1RWGIS|ES XFH59UK0MYO1,ES19M20 200619C03250000,0,0,0,0,0, +ES XFH59W1XUSKK|ES XFH59UK0MYO1,ES19M20 200619C03260000,0,0,0,0,0, +ES XFH59W23T4MC|ES XFH59UK0MYO1,ES19M20 200619C03270000,0,0,0,0,0, +ES XFH59W29RGO4|ES XFH59UK0MYO1,ES19M20 200619C03280000,0,0,0,0,0, +ES XFH59W2FPSPW|ES XFH59UK0MYO1,ES19M20 200619C03290000,0,0,0,0,0, +ES XFH59UPHGV9G|ES XFH59UK0MYO1,ES19M20 200619C03300000,0,0,0,0,0, +ES XFH59W2RMGTG|ES XFH59UK0MYO1,ES19M20 200619C03310000,0,0,0,0,0, +ES XFH59W2XKSV8|ES XFH59UK0MYO1,ES19M20 200619C03320000,0,0,0,0,0, +ES XFH59W33J4X0|ES XFH59UK0MYO1,ES19M20 200619C03330000,0,0,0,0,0, +ES XFH59W39HGYS|ES XFH59UK0MYO1,ES19M20 200619C03340000,0,0,0,0,0, +ES XFH59W3FFT0K|ES XFH59UK0MYO1,ES19M20 200619C03350000,0,0,0,0,0, +ES XFH59W3LE52C|ES XFH59UK0MYO1,ES19M20 200619C03360000,0,0,0,0,0, +ES XFH59W3RCH44|ES XFH59UK0MYO1,ES19M20 200619C03370000,0,0,0,0,0, +ES XFH59W3XAT5W|ES XFH59UK0MYO1,ES19M20 200619C03380000,0,0,0,0,0, +ES XFH59W43957O|ES XFH59UK0MYO1,ES19M20 200619C03390000,0,0,0,0,0, +ES XFH59UPNF7B8|ES XFH59UK0MYO1,ES19M20 200619C03400000,0,0,0,0,0, +ES XFH59W4F5TB8|ES XFH59UK0MYO1,ES19M20 200619C03410000,0,0,0,0,0, +ES XFH59W4L45D0|ES XFH59UK0MYO1,ES19M20 200619C03420000,0,0,0,0,0, +ES XFH59W4R2HES|ES XFH59UK0MYO1,ES19M20 200619C03430000,0,0,0,0,0, +ES XFH59W4X0TGK|ES XFH59UK0MYO1,ES19M20 200619C03440000,0,0,0,0,0, +ES XFH59W52Z5IC|ES XFH59UK0MYO1,ES19M20 200619C03450000,0,0,0,0,0, +ES XFH59W58XHK4|ES XFH59UK0MYO1,ES19M20 200619C03460000,0,0,0,0,0, +ES XFH59W5EVTLW|ES XFH59UK0MYO1,ES19M20 200619C03470000,0,0,0,0,0, +ES XFH59W5KU5NO|ES XFH59UK0MYO1,ES19M20 200619C03480000,0,0,0,0,0, +ES XFH59W5QSHPG|ES XFH59UK0MYO1,ES19M20 200619C03490000,0,0,0,0,0, +ES XFH59UPTDJD0|ES XFH59UK0MYO1,ES19M20 200619C03500000,0,0,0,0,0, +ES 31EL5FAO0XCG4|ES XFH59UK0MYO1,ES19M20 200619P02900000,0,0,0,0,0, +ES 31EL5FBVCQW84|ES XFH59UK0MYO1,ES19M20 200619P02910000,0,0,0,0,0, +ES 31EL5FBVIP89W|ES XFH59UK0MYO1,ES19M20 200619P02920000,0,0,0,0,0, +ES 31EL5FBVONKBO|ES XFH59UK0MYO1,ES19M20 200619P02930000,0,0,0,0,0, +ES 31EL5FBVULWDG|ES XFH59UK0MYO1,ES19M20 200619P02940000,0,0,0,0,0, +ES 31EL5FBW0K8F8|ES XFH59UK0MYO1,ES19M20 200619P02950000,0,0,0,0,0, +ES 31EL5FBW6IKH0|ES XFH59UK0MYO1,ES19M20 200619P02960000,0,0,0,0,0, +ES 31EL5FBWCGWIS|ES XFH59UK0MYO1,ES19M20 200619P02970000,0,0,0,0,0, +ES 31EL5FBWIF8KK|ES XFH59UK0MYO1,ES19M20 200619P02980000,0,0,0,0,0, +ES 31EL5FBWODKMC|ES XFH59UK0MYO1,ES19M20 200619P02990000,0,0,0,0,0, +ES 31EL5FAJQ6SBO|ES XFH59UK0MYO1,ES19M20 200619P03000000,0,0,0,0,0, +ES 31EL5FBX0A8PW|ES XFH59UK0MYO1,ES19M20 200619P03010000,0,0,0,0,0, +ES 31EL5FBX68KRO|ES XFH59UK0MYO1,ES19M20 200619P03020000,0,0,0,0,0, +ES 31EL5FBXC6WTG|ES XFH59UK0MYO1,ES19M20 200619P03030000,0,0,0,0,0, +ES 31EL5FBXI58V8|ES XFH59UK0MYO1,ES19M20 200619P03040000,0,0,0,0,0, +ES 31EL5FBXO3KX0|ES XFH59UK0MYO1,ES19M20 200619P03050000,0,0,0,0,0, +ES 31EL5FBXU1WYS|ES XFH59UK0MYO1,ES19M20 200619P03060000,0,0,0,0,0, +ES 31EL5FBY0090K|ES XFH59UK0MYO1,ES19M20 200619P03070000,0,0,0,0,0, +ES 31EL5FBY5YL2C|ES XFH59UK0MYO1,ES19M20 200619P03080000,0,0,0,0,0, +ES 31EL5FBYBWX44|ES XFH59UK0MYO1,ES19M20 200619P03090000,0,0,0,0,0, +ES 31EL5FAOCU0JO|ES XFH59UK0MYO1,ES19M20 200619P03100000,0,0,0,0,0, +ES 31EL5FBYNTL7O|ES XFH59UK0MYO1,ES19M20 200619P03110000,0,0,0,0,0, +ES 31EL5FBYTRX9G|ES XFH59UK0MYO1,ES19M20 200619P03120000,0,0,0,0,0, +ES 31EL5FBYZQ9B8|ES XFH59UK0MYO1,ES19M20 200619P03130000,0,0,0,0,0, +ES 31EL5FBZ5OLD0|ES XFH59UK0MYO1,ES19M20 200619P03140000,0,0,0,0,0, +ES 31EL5FBZBMXES|ES XFH59UK0MYO1,ES19M20 200619P03150000,0,0,0,0,0, +ES 31EL5FBZHL9GK|ES XFH59UK0MYO1,ES19M20 200619P03160000,0,0,0,0,0, +ES 31EL5FBZNJLIC|ES XFH59UK0MYO1,ES19M20 200619P03170000,0,0,0,0,0, +ES 31EL5FBZTHXK4|ES XFH59UK0MYO1,ES19M20 200619P03180000,0,0,0,0,0, +ES 31EL5FBZZG9LW|ES XFH59UK0MYO1,ES19M20 200619P03190000,0,0,0,0,0, +ES 31EL5FAOISCLG|ES XFH59UK0MYO1,ES19M20 200619P03200000,0,0,0,0,0, +ES 31EL5FC0BCXPG|ES XFH59UK0MYO1,ES19M20 200619P03210000,0,0,0,0,0, +ES 31EL5FC0HB9R8|ES XFH59UK0MYO1,ES19M20 200619P03220000,0,0,0,0,0, +ES 31EL5FC0N9LT0|ES XFH59UK0MYO1,ES19M20 200619P03230000,0,0,0,0,0, +ES 31EL5FC0T7XUS|ES XFH59UK0MYO1,ES19M20 200619P03240000,0,0,0,0,0, +ES 31EL5FC0Z69WK|ES XFH59UK0MYO1,ES19M20 200619P03250000,0,0,0,0,0, +ES 31EL5FC154LYC|ES XFH59UK0MYO1,ES19M20 200619P03260000,0,0,0,0,0, +ES 31EL5FC1B2Y04|ES XFH59UK0MYO1,ES19M20 200619P03270000,0,0,0,0,0, +ES 31EL5FC1H1A1W|ES XFH59UK0MYO1,ES19M20 200619P03280000,0,0,0,0,0, +ES 31EL5FC1MZM3O|ES XFH59UK0MYO1,ES19M20 200619P03290000,0,0,0,0,0, +ES 31EL5FAOOQON8|ES XFH59UK0MYO1,ES19M20 200619P03300000,0,0,0,0,0, +ES 31EL5FC1YWA78|ES XFH59UK0MYO1,ES19M20 200619P03310000,0,0,0,0,0, +ES 31EL5FC24UM90|ES XFH59UK0MYO1,ES19M20 200619P03320000,0,0,0,0,0, +ES 31EL5FC2ASYAS|ES XFH59UK0MYO1,ES19M20 200619P03330000,0,0,0,0,0, +ES 31EL5FC2GRACK|ES XFH59UK0MYO1,ES19M20 200619P03340000,0,0,0,0,0, +ES 31EL5FC2MPMEC|ES XFH59UK0MYO1,ES19M20 200619P03350000,0,0,0,0,0, +ES 31EL5FC2SNYG4|ES XFH59UK0MYO1,ES19M20 200619P03360000,0,0,0,0,0, +ES 31EL5FC2YMAHW|ES XFH59UK0MYO1,ES19M20 200619P03370000,0,0,0,0,0, +ES 31EL5FC34KMJO|ES XFH59UK0MYO1,ES19M20 200619P03380000,0,0,0,0,0, +ES 31EL5FC3AIYLG|ES XFH59UK0MYO1,ES19M20 200619P03390000,0,0,0,0,0, +ES 31EL5FAOUP0P0|ES XFH59UK0MYO1,ES19M20 200619P03400000,0,0,0,0,0, diff --git a/Data/futureoption/cme/universes/es/20200619/20200108.csv b/Data/futureoption/cme/universes/es/20200619/20200108.csv new file mode 100644 index 000000000000..5fbae4dce52f --- /dev/null +++ b/Data/futureoption/cme/universes/es/20200619/20200108.csv @@ -0,0 +1,109 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +ES XFH59UK0MYO1,ES19M20,3272,3276.5,3264.75,3275,305, +ES XFH59VWTAF1G|ES XFH59UK0MYO1,ES19M20 200619C02950000,0,0,0,0,0, +ES XFH59VWZ8R38|ES XFH59UK0MYO1,ES19M20 200619C02960000,0,0,0,0,0, +ES XFH59VX57350|ES XFH59UK0MYO1,ES19M20 200619C02970000,0,0,0,0,0, +ES XFH59VXB5F6S|ES XFH59UK0MYO1,ES19M20 200619C02980000,0,0,0,0,0, +ES XFH59VXH3R8K|ES XFH59UK0MYO1,ES19M20 200619C02990000,0,0,0,0,0, +ES XFH59UKIWYXW|ES XFH59UK0MYO1,ES19M20 200619C03000000,0,0,0,0,0, +ES XFH59VXT0FC4|ES XFH59UK0MYO1,ES19M20 200619C03010000,0,0,0,0,0, +ES XFH59VXYYRDW|ES XFH59UK0MYO1,ES19M20 200619C03020000,0,0,0,0,0, +ES XFH59VY4X3FO|ES XFH59UK0MYO1,ES19M20 200619C03030000,0,0,0,0,0, +ES XFH59VYAVFHG|ES XFH59UK0MYO1,ES19M20 200619C03040000,0,0,0,0,0, +ES XFH59VYGTRJ8|ES XFH59UK0MYO1,ES19M20 200619C03050000,0,0,0,0,0, +ES XFH59VYMS3L0|ES XFH59UK0MYO1,ES19M20 200619C03060000,0,0,0,0,0, +ES XFH59VYSQFMS|ES XFH59UK0MYO1,ES19M20 200619C03070000,0,0,0,0,0, +ES XFH59VYYOROK|ES XFH59UK0MYO1,ES19M20 200619C03080000,0,0,0,0,0, +ES XFH59VZ4N3QC|ES XFH59UK0MYO1,ES19M20 200619C03090000,0,0,0,0,0, +ES XFH59UP5K75W|ES XFH59UK0MYO1,ES19M20 200619C03100000,0,0,0,0,0, +ES XFH59VZGJRTW|ES XFH59UK0MYO1,ES19M20 200619C03110000,0,0,0,0,0, +ES XFH59VZMI3VO|ES XFH59UK0MYO1,ES19M20 200619C03120000,0,0,0,0,0, +ES XFH59VZSGFXG|ES XFH59UK0MYO1,ES19M20 200619C03130000,0,0,0,0,0, +ES XFH59VZYERZ8|ES XFH59UK0MYO1,ES19M20 200619C03140000,0,0,0,0,0, +ES XFH59W04D410|ES XFH59UK0MYO1,ES19M20 200619C03150000,0,0,0,0,0, +ES XFH59W0ABG2S|ES XFH59UK0MYO1,ES19M20 200619C03160000,0,0,0,0,0, +ES XFH59W0G9S4K|ES XFH59UK0MYO1,ES19M20 200619C03170000,0,0,0,0,0, +ES XFH59W0M846C|ES XFH59UK0MYO1,ES19M20 200619C03180000,0,0,0,0,0, +ES XFH59W0S6G84|ES XFH59UK0MYO1,ES19M20 200619C03190000,0,0,0,0,0, +ES XFH59UPBIJ7O|ES XFH59UK0MYO1,ES19M20 200619C03200000,0,0,0,0,0, +ES XFH59W1434BO|ES XFH59UK0MYO1,ES19M20 200619C03210000,0,0,0,0,0, +ES XFH59W1A1GDG|ES XFH59UK0MYO1,ES19M20 200619C03220000,0,0,0,0,0, +ES XFH59W1FZSF8|ES XFH59UK0MYO1,ES19M20 200619C03230000,0,0,0,0,0, +ES XFH59W1LY4H0|ES XFH59UK0MYO1,ES19M20 200619C03240000,0,0,0,0,0, +ES XFH59W1RWGIS|ES XFH59UK0MYO1,ES19M20 200619C03250000,0,0,0,0,0, +ES XFH59W1XUSKK|ES XFH59UK0MYO1,ES19M20 200619C03260000,0,0,0,0,0, +ES XFH59W23T4MC|ES XFH59UK0MYO1,ES19M20 200619C03270000,0,0,0,0,0, +ES XFH59W29RGO4|ES XFH59UK0MYO1,ES19M20 200619C03280000,0,0,0,0,0, +ES XFH59W2FPSPW|ES XFH59UK0MYO1,ES19M20 200619C03290000,0,0,0,0,0, +ES XFH59UPHGV9G|ES XFH59UK0MYO1,ES19M20 200619C03300000,0,0,0,0,0, +ES XFH59W2RMGTG|ES XFH59UK0MYO1,ES19M20 200619C03310000,0,0,0,0,0, +ES XFH59W2XKSV8|ES XFH59UK0MYO1,ES19M20 200619C03320000,0,0,0,0,0, +ES XFH59W33J4X0|ES XFH59UK0MYO1,ES19M20 200619C03330000,0,0,0,0,0, +ES XFH59W39HGYS|ES XFH59UK0MYO1,ES19M20 200619C03340000,0,0,0,0,0, +ES XFH59W3FFT0K|ES XFH59UK0MYO1,ES19M20 200619C03350000,0,0,0,0,0, +ES XFH59W3LE52C|ES XFH59UK0MYO1,ES19M20 200619C03360000,0,0,0,0,0, +ES XFH59W3RCH44|ES XFH59UK0MYO1,ES19M20 200619C03370000,0,0,0,0,0, +ES XFH59W3XAT5W|ES XFH59UK0MYO1,ES19M20 200619C03380000,0,0,0,0,0, +ES XFH59W43957O|ES XFH59UK0MYO1,ES19M20 200619C03390000,0,0,0,0,0, +ES XFH59UPNF7B8|ES XFH59UK0MYO1,ES19M20 200619C03400000,0,0,0,0,0, +ES XFH59W4F5TB8|ES XFH59UK0MYO1,ES19M20 200619C03410000,0,0,0,0,0, +ES XFH59W4L45D0|ES XFH59UK0MYO1,ES19M20 200619C03420000,0,0,0,0,0, +ES XFH59W4R2HES|ES XFH59UK0MYO1,ES19M20 200619C03430000,0,0,0,0,0, +ES XFH59W4X0TGK|ES XFH59UK0MYO1,ES19M20 200619C03440000,0,0,0,0,0, +ES XFH59W52Z5IC|ES XFH59UK0MYO1,ES19M20 200619C03450000,0,0,0,0,0, +ES XFH59W58XHK4|ES XFH59UK0MYO1,ES19M20 200619C03460000,0,0,0,0,0, +ES XFH59W5EVTLW|ES XFH59UK0MYO1,ES19M20 200619C03470000,0,0,0,0,0, +ES XFH59W5KU5NO|ES XFH59UK0MYO1,ES19M20 200619C03480000,0,0,0,0,0, +ES XFH59W5QSHPG|ES XFH59UK0MYO1,ES19M20 200619C03490000,0,0,0,0,0, +ES XFH59UPTDJD0|ES XFH59UK0MYO1,ES19M20 200619C03500000,0,0,0,0,0, +ES 31EL5FAO0XCG4|ES XFH59UK0MYO1,ES19M20 200619P02900000,0,0,0,0,0, +ES 31EL5FBVCQW84|ES XFH59UK0MYO1,ES19M20 200619P02910000,0,0,0,0,0, +ES 31EL5FBVIP89W|ES XFH59UK0MYO1,ES19M20 200619P02920000,0,0,0,0,0, +ES 31EL5FBVONKBO|ES XFH59UK0MYO1,ES19M20 200619P02930000,0,0,0,0,0, +ES 31EL5FBVULWDG|ES XFH59UK0MYO1,ES19M20 200619P02940000,0,0,0,0,0, +ES 31EL5FBW0K8F8|ES XFH59UK0MYO1,ES19M20 200619P02950000,0,0,0,0,0, +ES 31EL5FBW6IKH0|ES XFH59UK0MYO1,ES19M20 200619P02960000,0,0,0,0,0, +ES 31EL5FBWCGWIS|ES XFH59UK0MYO1,ES19M20 200619P02970000,0,0,0,0,0, +ES 31EL5FBWIF8KK|ES XFH59UK0MYO1,ES19M20 200619P02980000,0,0,0,0,0, +ES 31EL5FBWODKMC|ES XFH59UK0MYO1,ES19M20 200619P02990000,0,0,0,0,0, +ES 31EL5FAJQ6SBO|ES XFH59UK0MYO1,ES19M20 200619P03000000,0,0,0,0,0, +ES 31EL5FBX0A8PW|ES XFH59UK0MYO1,ES19M20 200619P03010000,0,0,0,0,0, +ES 31EL5FBX68KRO|ES XFH59UK0MYO1,ES19M20 200619P03020000,0,0,0,0,0, +ES 31EL5FBXC6WTG|ES XFH59UK0MYO1,ES19M20 200619P03030000,0,0,0,0,0, +ES 31EL5FBXI58V8|ES XFH59UK0MYO1,ES19M20 200619P03040000,0,0,0,0,0, +ES 31EL5FBXO3KX0|ES XFH59UK0MYO1,ES19M20 200619P03050000,0,0,0,0,0, +ES 31EL5FBXU1WYS|ES XFH59UK0MYO1,ES19M20 200619P03060000,0,0,0,0,0, +ES 31EL5FBY0090K|ES XFH59UK0MYO1,ES19M20 200619P03070000,0,0,0,0,0, +ES 31EL5FBY5YL2C|ES XFH59UK0MYO1,ES19M20 200619P03080000,0,0,0,0,0, +ES 31EL5FBYBWX44|ES XFH59UK0MYO1,ES19M20 200619P03090000,0,0,0,0,0, +ES 31EL5FAOCU0JO|ES XFH59UK0MYO1,ES19M20 200619P03100000,0,0,0,0,0, +ES 31EL5FBYNTL7O|ES XFH59UK0MYO1,ES19M20 200619P03110000,0,0,0,0,0, +ES 31EL5FBYTRX9G|ES XFH59UK0MYO1,ES19M20 200619P03120000,0,0,0,0,0, +ES 31EL5FBYZQ9B8|ES XFH59UK0MYO1,ES19M20 200619P03130000,0,0,0,0,0, +ES 31EL5FBZ5OLD0|ES XFH59UK0MYO1,ES19M20 200619P03140000,0,0,0,0,0, +ES 31EL5FBZBMXES|ES XFH59UK0MYO1,ES19M20 200619P03150000,0,0,0,0,0, +ES 31EL5FBZHL9GK|ES XFH59UK0MYO1,ES19M20 200619P03160000,0,0,0,0,0, +ES 31EL5FBZNJLIC|ES XFH59UK0MYO1,ES19M20 200619P03170000,0,0,0,0,0, +ES 31EL5FBZTHXK4|ES XFH59UK0MYO1,ES19M20 200619P03180000,0,0,0,0,0, +ES 31EL5FBZZG9LW|ES XFH59UK0MYO1,ES19M20 200619P03190000,0,0,0,0,0, +ES 31EL5FAOISCLG|ES XFH59UK0MYO1,ES19M20 200619P03200000,0,0,0,0,0, +ES 31EL5FC0BCXPG|ES XFH59UK0MYO1,ES19M20 200619P03210000,0,0,0,0,0, +ES 31EL5FC0HB9R8|ES XFH59UK0MYO1,ES19M20 200619P03220000,0,0,0,0,0, +ES 31EL5FC0N9LT0|ES XFH59UK0MYO1,ES19M20 200619P03230000,0,0,0,0,0, +ES 31EL5FC0T7XUS|ES XFH59UK0MYO1,ES19M20 200619P03240000,0,0,0,0,0, +ES 31EL5FC0Z69WK|ES XFH59UK0MYO1,ES19M20 200619P03250000,0,0,0,0,0, +ES 31EL5FC154LYC|ES XFH59UK0MYO1,ES19M20 200619P03260000,0,0,0,0,0, +ES 31EL5FC1B2Y04|ES XFH59UK0MYO1,ES19M20 200619P03270000,0,0,0,0,0, +ES 31EL5FC1H1A1W|ES XFH59UK0MYO1,ES19M20 200619P03280000,0,0,0,0,0, +ES 31EL5FC1MZM3O|ES XFH59UK0MYO1,ES19M20 200619P03290000,0,0,0,0,0, +ES 31EL5FAOOQON8|ES XFH59UK0MYO1,ES19M20 200619P03300000,0,0,0,0,0, +ES 31EL5FC1YWA78|ES XFH59UK0MYO1,ES19M20 200619P03310000,0,0,0,0,0, +ES 31EL5FC24UM90|ES XFH59UK0MYO1,ES19M20 200619P03320000,0,0,0,0,0, +ES 31EL5FC2ASYAS|ES XFH59UK0MYO1,ES19M20 200619P03330000,0,0,0,0,0, +ES 31EL5FC2GRACK|ES XFH59UK0MYO1,ES19M20 200619P03340000,0,0,0,0,0, +ES 31EL5FC2MPMEC|ES XFH59UK0MYO1,ES19M20 200619P03350000,0,0,0,0,0, +ES 31EL5FC2SNYG4|ES XFH59UK0MYO1,ES19M20 200619P03360000,0,0,0,0,0, +ES 31EL5FC2YMAHW|ES XFH59UK0MYO1,ES19M20 200619P03370000,0,0,0,0,0, +ES 31EL5FC34KMJO|ES XFH59UK0MYO1,ES19M20 200619P03380000,0,0,0,0,0, +ES 31EL5FC3AIYLG|ES XFH59UK0MYO1,ES19M20 200619P03390000,0,0,0,0,0, +ES 31EL5FAOUP0P0|ES XFH59UK0MYO1,ES19M20 200619P03400000,0,0,0,0,0, diff --git a/Data/futureoption/comex/universes/gc/20200428/20200102.csv b/Data/futureoption/comex/universes/gc/20200428/20200102.csv new file mode 100644 index 000000000000..6a5c0e9a690a --- /dev/null +++ b/Data/futureoption/comex/universes/gc/20200428/20200102.csv @@ -0,0 +1,2 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +GC XE1Y0ZJ8NQ8T,GC28J20,0,0,0,0,0, diff --git a/Data/futureoption/comex/universes/gc/20200428/20200103.csv b/Data/futureoption/comex/universes/gc/20200428/20200103.csv new file mode 100644 index 000000000000..34f1bbf19e83 --- /dev/null +++ b/Data/futureoption/comex/universes/gc/20200428/20200103.csv @@ -0,0 +1,6 @@ +#symbol_id,symbol_value,open,high,low,close,volume,open_interest +GC XE1Y0ZJ8NQ8T,GC28J20,1572.2,1595.7,1568.9,1577.3,0, +OG XCBWV3K9GEW0|GC XE1Y0ZJ8NQ8T,OG 200225C01600000,14.15,113.9,11.55,23.45,0, +OG XD5G9X7YSRWG|GC XE1Y0ZJ8NQ8T,OG 200326C01650000,22.4,111.6,17.2,20.25,0, +OG 31C9GFD5CKWQO|GC XE1Y0ZJ8NQ8T,OG 200326P01540000,27.15,69.55,8.9,19.5,0, +OG 31BFX0QKBVPGG|GC XE1Y0ZJ8NQ8T,OG 200225P01545000,12.1,17.4,10.9,13.9,0, diff --git a/DownloaderDataProvider/Program.cs b/DownloaderDataProvider/Program.cs index 5556d5dcc6b9..4437948fd5c7 100644 --- a/DownloaderDataProvider/Program.cs +++ b/DownloaderDataProvider/Program.cs @@ -24,6 +24,7 @@ using QuantConnect.Lean.Engine.DataFeeds; using DataFeeds = QuantConnect.Lean.Engine.DataFeeds; using QuantConnect.DownloaderDataProvider.Launcher.Models.Constants; +using QuantConnect.Lean.Engine.HistoricalData; namespace QuantConnect.DownloaderDataProvider.Launcher; public static class Program @@ -162,7 +163,7 @@ private static (DateTimeZone dataTimeZone, DateTimeZone exchangeTimeZone) GetDat /// This method sets up logging, data providers, map file providers, and factor file providers. /// /// - /// The method reads configuration values to determine whether debugging is enabled, + /// The method reads configuration values to determine whether debugging is enabled, /// which log handler to use, and which data, map file, and factor file providers to initialize. /// /// @@ -184,7 +185,12 @@ public static void InitializeConfigurations() var optionChainProvider = Composer.Instance.GetPart(); if (optionChainProvider == null) { - optionChainProvider = new CachingOptionChainProvider(new LiveOptionChainProvider(new ZipDataCacheProvider(dataProvider, false), mapFileProvider)); + var historyManager = Composer.Instance.GetExportedValueByTypeName(nameof(HistoryProviderManager)); + historyManager.Initialize(new HistoryProviderInitializeParameters(null, null, dataProvider, _dataCacheProvider, + mapFileProvider, factorFileProvider, _ => { }, false, new DataPermissionManager(), null, new AlgorithmSettings())); + var baseOptionChainProvider = new LiveOptionChainProvider(); + baseOptionChainProvider.Initialize(new(mapFileProvider, historyManager)); + optionChainProvider = new CachingOptionChainProvider(baseOptionChainProvider); Composer.Instance.AddPart(optionChainProvider); } diff --git a/Engine/DataFeeds/BacktestingChainProvider.cs b/Engine/DataFeeds/BacktestingChainProvider.cs index 54d057ced9da..ee24eb45acde 100644 --- a/Engine/DataFeeds/BacktestingChainProvider.cs +++ b/Engine/DataFeeds/BacktestingChainProvider.cs @@ -15,7 +15,6 @@ using System; using QuantConnect.Util; -using QuantConnect.Logging; using QuantConnect.Interfaces; using QuantConnect.Securities; using System.Collections.Generic; @@ -30,22 +29,33 @@ namespace QuantConnect.Lean.Engine.DataFeeds /// public abstract class BacktestingChainProvider { - // see https://github.com/QuantConnect/Lean/issues/6384 - private static readonly TickType[] DataTypes = new[] { TickType.Quote, TickType.OpenInterest, TickType.Trade }; - private static readonly Resolution[] Resolutions = new[] { Resolution.Minute, Resolution.Hour, Resolution.Daily }; - private bool _loggedPreviousTradableDate; + /// + /// The map file provider instance to use + /// + protected IMapFileProvider MapFileProvider { get; private set; } + + /// + /// The history provider instance to use + /// + protected IHistoryProvider HistoryProvider { get; private set; } /// - /// The data cache instance to use + /// Initializes a new instance of the class /// - protected IDataCacheProvider DataCacheProvider { get; } + protected BacktestingChainProvider() + { + } /// - /// Creates a new instance + /// Initializes a new instance of the class /// - protected BacktestingChainProvider(IDataCacheProvider dataCacheProvider) + /// The initialization parameters + // TODO: This should be in the chain provider interfaces. + // They might be even be unified in a single interface (futures and options chains providers) + public void Initialize(ChainProviderInitializeParameters parameters) { - DataCacheProvider = dataCacheProvider; + HistoryProvider = parameters.HistoryProvider; + MapFileProvider = parameters.MapFileProvider; } /// @@ -55,68 +65,17 @@ protected BacktestingChainProvider(IDataCacheProvider dataCacheProvider) /// The date to search for protected IEnumerable GetSymbols(Symbol canonicalSymbol, DateTime date) { - // TODO: This will be removed when all chains (including Futures and FOPs) are file-based instead of zip-entry based - if (canonicalSymbol.SecurityType == SecurityType.Option || canonicalSymbol.SecurityType == SecurityType.IndexOption) - { - return GetOptionSymbols(canonicalSymbol, date); - } - - IEnumerable entries = null; - var usedResolution = Resolution.Minute; - foreach (var resolution in Resolutions) - { - usedResolution = resolution; - entries = GetZipEntries(canonicalSymbol, date, usedResolution); - if (entries != null) - { - break; - } - } - - if (entries == null) - { - var mhdb = MarketHoursDatabase.FromDataFolder(); - if (mhdb.TryGetEntry(canonicalSymbol.ID.Market, canonicalSymbol, canonicalSymbol.SecurityType, out var entry) && !entry.ExchangeHours.IsDateOpen(date)) - { - if (!_loggedPreviousTradableDate) - { - _loggedPreviousTradableDate = true; - Log.Trace($"BacktestingCacheProvider.GetSymbols(): {date} is not a tradable date for {canonicalSymbol}. When requesting contracts" + - $" for non tradable dates, will return contracts of previous tradable date."); - } - - // be user friendly, will return contracts from the previous tradable date - return GetSymbols(canonicalSymbol, Time.GetStartTimeForTradeBars(entry.ExchangeHours, date, Time.OneDay, 1, false, entry.DataTimeZone, dailyPreciseEndTime: false)); - } - - if (Log.DebuggingEnabled) - { - Log.Debug($"BacktestingCacheProvider.GetSymbols(): found no source of contracts for {canonicalSymbol} for date {date.ToString(DateFormat.EightCharacter)} for any tick type"); - } - - return Enumerable.Empty(); - } - - // generate and return the contract symbol for each zip entry - return entries - .Select(zipEntryName => LeanData.ReadSymbolFromZipEntry(canonicalSymbol, usedResolution, zipEntryName)) - .Where(symbol => !IsContractExpired(symbol, date)); - } - - private IEnumerable GetOptionSymbols(Symbol canonicalSymbol, DateTime date) - { - var historyProvider = Composer.Instance.GetPart(); var marketHoursDataBase = MarketHoursDatabase.FromDataFolder(); - var optionUniverseType = typeof(OptionUniverse); + var universeType = canonicalSymbol.SecurityType.IsOption() ? typeof(OptionUniverse) : typeof(FutureUniverse); // Use this GetEntry extension method since it's data type dependent, so we get the correct entry for the option universe - var marketHoursEntry = marketHoursDataBase.GetEntry(canonicalSymbol, new[] { optionUniverseType }); + var marketHoursEntry = marketHoursDataBase.GetEntry(canonicalSymbol, new[] { universeType }); var previousTradingDate = Time.GetStartTimeForTradeBars(marketHoursEntry.ExchangeHours, date, Time.OneDay, 1, extendedMarketHours: false, marketHoursEntry.DataTimeZone); var request = new HistoryRequest( previousTradingDate.ConvertToUtc(marketHoursEntry.ExchangeHours.TimeZone), date.ConvertToUtc(marketHoursEntry.ExchangeHours.TimeZone), - optionUniverseType, + universeType, canonicalSymbol, Resolution.Daily, marketHoursEntry.ExchangeHours, @@ -126,14 +85,18 @@ private IEnumerable GetOptionSymbols(Symbol canonicalSymbol, DateTime da false, DataNormalizationMode.Raw, TickType.Quote); - var history = historyProvider.GetHistory(new[] { request }, marketHoursEntry.DataTimeZone).ToList(); + var history = HistoryProvider.GetHistory(new[] { request }, marketHoursEntry.DataTimeZone)?.ToList(); - if (history == null || history.Count == 0) + var symbols = history == null || history.Count == 0 + ? Enumerable.Empty() + : history.GetUniverseData().SelectMany(x => x.Values.Single()).Select(x => x.Symbol); + + if (canonicalSymbol.SecurityType.IsOption()) { - return Enumerable.Empty(); + return symbols.Where(symbol => symbol.SecurityType.IsOption()); } - return history.GetUniverseData().SelectMany(x => x.Values.Single().Where(x => x.Symbol.SecurityType.IsOption())).Select(x => x.Symbol); + return symbols; } /// @@ -143,24 +106,5 @@ protected static bool IsContractExpired(Symbol symbol, DateTime date) { return symbol.ID.Date.Date < date.Date; } - - private IEnumerable GetZipEntries(Symbol canonicalSymbol, DateTime date, Resolution resolution) - { - foreach (var tickType in DataTypes) - { - // build the zip file name and fetch it with our provider - var zipFileName = LeanData.GenerateZipFilePath(Globals.DataFolder, canonicalSymbol, date, resolution, tickType); - try - { - return DataCacheProvider.GetZipEntries(zipFileName); - } - catch - { - // the cache provider will throw if the file isn't available TODO: it's api should be more like TryGetZipEntries - } - } - - return null; - } } } diff --git a/Engine/DataFeeds/BacktestingFutureChainProvider.cs b/Engine/DataFeeds/BacktestingFutureChainProvider.cs index bbeef2c3dc01..82a12521b596 100644 --- a/Engine/DataFeeds/BacktestingFutureChainProvider.cs +++ b/Engine/DataFeeds/BacktestingFutureChainProvider.cs @@ -1,11 +1,11 @@ /* * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); + * + * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,15 +24,6 @@ namespace QuantConnect.Lean.Engine.DataFeeds /// public class BacktestingFutureChainProvider : BacktestingChainProvider, IFutureChainProvider { - /// - /// Creates a new instance - /// - /// The data cache provider instance to use - public BacktestingFutureChainProvider(IDataCacheProvider dataCacheProvider) - : base(dataCacheProvider) - { - } - /// /// Gets the list of future contracts for a given underlying symbol /// diff --git a/Engine/DataFeeds/BacktestingOptionChainProvider.cs b/Engine/DataFeeds/BacktestingOptionChainProvider.cs index a456f39f34d6..8cdc59491655 100644 --- a/Engine/DataFeeds/BacktestingOptionChainProvider.cs +++ b/Engine/DataFeeds/BacktestingOptionChainProvider.cs @@ -25,24 +25,11 @@ namespace QuantConnect.Lean.Engine.DataFeeds /// public class BacktestingOptionChainProvider : BacktestingChainProvider, IOptionChainProvider { - private IMapFileProvider _mapFileProvider; - - /// - /// Creates a new instance - /// - /// The data cache provider instance to use - /// The map file provider instance to use - public BacktestingOptionChainProvider(IDataCacheProvider dataCacheProvider, IMapFileProvider mapFileProvider) - : base(dataCacheProvider) - { - _mapFileProvider = mapFileProvider; - } - /// /// Gets the list of option contracts for a given underlying symbol /// /// The option or the underlying symbol to get the option chain for. - /// Providing the option allows targetting an option ticker different than the default e.g. SPXW + /// Providing the option allows targeting an option ticker different than the default e.g. SPXW /// The date for which to request the option chain (only used in backtesting) /// The list of option contracts public virtual IEnumerable GetOptionContractList(Symbol symbol, DateTime date) @@ -91,7 +78,7 @@ private Symbol MapUnderlyingSymbol(Symbol underlying, DateTime date) { if (underlying.RequiresMapping()) { - var mapFileResolver = _mapFileProvider.Get(AuxiliaryDataKey.Create(underlying)); + var mapFileResolver = MapFileProvider.Get(AuxiliaryDataKey.Create(underlying)); var mapFile = mapFileResolver.ResolveMapFile(underlying); var ticker = mapFile.GetMappedSymbol(date, underlying.Value); return underlying.UpdateMappedSymbol(ticker); diff --git a/Engine/DataFeeds/ChainProviderInitializeParameters.cs b/Engine/DataFeeds/ChainProviderInitializeParameters.cs new file mode 100644 index 000000000000..7d2c32882016 --- /dev/null +++ b/Engine/DataFeeds/ChainProviderInitializeParameters.cs @@ -0,0 +1,46 @@ +/* + * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. + * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ + +using QuantConnect.Interfaces; + +namespace QuantConnect.Lean.Engine.DataFeeds +{ + /// + /// DTO for initializing the + /// + public class ChainProviderInitializeParameters + { + /// + /// The map file provider instance to us + /// + public IMapFileProvider MapFileProvider { get; set; } + + /// + /// The history provider to use + /// + public IHistoryProvider HistoryProvider { get; set; } + + /// + /// Initializes a new instance of the class + /// + /// The map file provider instance to use + /// The history provider to use + public ChainProviderInitializeParameters(IMapFileProvider mapFileProvider, IHistoryProvider historyProvider) + { + MapFileProvider = mapFileProvider; + HistoryProvider = historyProvider; + } + } +} diff --git a/Engine/DataFeeds/DataManager.cs b/Engine/DataFeeds/DataManager.cs index 08f2d7456d34..e39483f53af9 100644 --- a/Engine/DataFeeds/DataManager.cs +++ b/Engine/DataFeeds/DataManager.cs @@ -113,10 +113,6 @@ public DataManager( // so universe selection always happens right away at the start of the algorithm. var universeType = universe.GetType(); if ( - // We exclude the OptionChainUniverse because their selection in live trading is based on having a full bar - // of the underlying. In the future, option chain universe file-based selection will be improved - // in order to avoid this. - (universeType != typeof(OptionChainUniverse) || config.Symbol.SecurityType != SecurityType.FutureOption) && // We exclude the UserDefinedUniverse because their selection already happens at the algorithm start time. // For instance, ETFs universe selection depends its first trigger time to be before the equity universe // (the UserDefinedUniverse), because the ETFs are EndTime-indexed and that would make their first selection @@ -689,12 +685,12 @@ bool isCanonical { if (isCanonical) { - if (symbolSecurityType != SecurityType.FutureOption && symbolSecurityType.IsOption()) + if (symbolSecurityType.IsOption()) { return new List> { new Tuple(typeof(OptionUniverse), TickType.Quote) }; } - return new List> { new Tuple(typeof(ZipEntryName), TickType.Quote) }; + return new List> { new Tuple(typeof(FutureUniverse), TickType.Quote) }; } IEnumerable availableDataType = AvailableDataTypes[symbolSecurityType] @@ -719,8 +715,10 @@ public List GetSubscriptionDataConfigs(Symbol symbol = n { lock (_subscriptionManagerSubscriptions) { - return _subscriptionManagerSubscriptions.Keys.Where(config => (includeInternalConfigs || !config.IsInternalFeed) - && (symbol == null || config.Symbol.ID == symbol.ID)).ToList(); + return _subscriptionManagerSubscriptions.Keys + .Where(config => (includeInternalConfigs || !config.IsInternalFeed) && (symbol == null || config.Symbol.ID == symbol.ID)) + .OrderBy(config => config.IsInternalFeed) + .ToList(); } } diff --git a/Engine/DataFeeds/Enumerators/DataQueueFuturesChainUniverseDataCollectionEnumerator.cs b/Engine/DataFeeds/Enumerators/DataQueueFuturesChainUniverseDataCollectionEnumerator.cs deleted file mode 100644 index e3990ddb8af9..000000000000 --- a/Engine/DataFeeds/Enumerators/DataQueueFuturesChainUniverseDataCollectionEnumerator.cs +++ /dev/null @@ -1,136 +0,0 @@ -/* - * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. - * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * -*/ - -using System; -using System.Collections.Generic; -using QuantConnect.Data; -using QuantConnect.Data.UniverseSelection; -using System.Collections; -using System.Linq; -using QuantConnect.Data.Auxiliary; -using QuantConnect.Interfaces; -using QuantConnect.Logging; - -namespace QuantConnect.Lean.Engine.DataFeeds.Enumerators -{ - /// - /// Enumerates live futures symbol universe data into instances - /// - public class DataQueueFuturesChainUniverseDataCollectionEnumerator : IEnumerator - { - private readonly SubscriptionRequest _subscriptionRequest; - private readonly IDataQueueUniverseProvider _universeProvider; - private readonly ITimeProvider _timeProvider; - - private bool _needNewCurrent; - private DateTime _lastEmitTime; - - /// - /// Initializes a new instance of the class. - /// - /// The subscription request to be used - /// Symbol universe provider of the data queue - /// The time provider to be used - public DataQueueFuturesChainUniverseDataCollectionEnumerator( - SubscriptionRequest subscriptionRequest, - IDataQueueUniverseProvider universeProvider, - ITimeProvider timeProvider) - { - _subscriptionRequest = subscriptionRequest; - _universeProvider = universeProvider; - _timeProvider = timeProvider; - - _needNewCurrent = true; - } - - /// - /// Returns current futures chain enumerator position - /// - public BaseDataCollection Current { get; private set; } - - /// - /// Returns current futures chain enumerator position - /// - object IEnumerator.Current => Current; - - /// - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - /// - public void Dispose() - { - } - - /// - /// Advances the enumerator to the next element of the collection. - /// - /// - /// true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection. - /// - public bool MoveNext() - { - if (!_needNewCurrent) - { - // refresh on date change (in exchange time zone) - _needNewCurrent = _timeProvider.GetUtcNow().ConvertFromUtc(_subscriptionRequest.Configuration.ExchangeTimeZone).Date != _lastEmitTime.Date; - } - - if (_needNewCurrent) - { - if (!_universeProvider.CanPerformSelection()) - { - Current = null; - return true; - } - - var localTime = _timeProvider.GetUtcNow() - .ConvertFromUtc(_subscriptionRequest.Configuration.ExchangeTimeZone) - .RoundDown(_subscriptionRequest.Configuration.Increment); - - // loading the list of futures contracts and converting them into zip entries - var symbols = _universeProvider.LookupSymbols(_subscriptionRequest.Security.Symbol, false); - var zipEntries = symbols.Select(x => new ZipEntryName { Time = localTime, Symbol = x } as BaseData).ToList(); - var current = new BaseDataCollection - { - Symbol = _subscriptionRequest.Security.Symbol, - Data = zipEntries, - Time = localTime, - EndTime = localTime - }; - - _lastEmitTime = localTime; - - Log.Trace($"DataQueueFuturesChainUniverseDataCollectionEnumerator({current.Symbol}): Emitting data point: {current.EndTime}. Count: {current.Data.Count}"); - - Current = current; - _needNewCurrent = false; - } - else - { - Current = null; - } - - return true; - } - - /// - /// Sets the enumerator to its initial position, which is before the first element in the collection. - /// - public void Reset() - { - _needNewCurrent = true; - } - } -} diff --git a/Engine/DataFeeds/Enumerators/DataQueueOptionChainUniverseDataCollectionEnumerator.cs b/Engine/DataFeeds/Enumerators/DataQueueOptionChainUniverseDataCollectionEnumerator.cs deleted file mode 100644 index 31b940e13858..000000000000 --- a/Engine/DataFeeds/Enumerators/DataQueueOptionChainUniverseDataCollectionEnumerator.cs +++ /dev/null @@ -1,164 +0,0 @@ -/* - * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. - * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * -*/ - -using System; -using System.Collections.Generic; -using System.Linq; -using QuantConnect.Data; -using QuantConnect.Data.UniverseSelection; -using QuantConnect.Interfaces; -using QuantConnect.Data.Auxiliary; -using System.Collections; -using QuantConnect.Logging; - -namespace QuantConnect.Lean.Engine.DataFeeds.Enumerators -{ - /// - /// Enumerates live options symbol universe data into instances - /// - public class DataQueueOptionChainUniverseDataCollectionEnumerator : IEnumerator - { - private readonly SubscriptionRequest _subscriptionRequest; - private readonly IDataQueueUniverseProvider _universeProvider; - private readonly ITimeProvider _timeProvider; - private bool _needNewCurrent; - private DateTime _lastEmitTime; - private BaseDataCollection _currentData; - - /// - /// Gets the enumerator for the underlying asset - /// - public IEnumerator Underlying { get; } - - /// - /// Initializes a new instance of the class. - /// - /// The subscription request to be used - /// Underlying enumerator - /// Symbol universe provider of the data queue - /// The time provider to be used - public DataQueueOptionChainUniverseDataCollectionEnumerator( - SubscriptionRequest subscriptionRequest, - IEnumerator underlying, - IDataQueueUniverseProvider universeProvider, - ITimeProvider timeProvider) - { - _subscriptionRequest = subscriptionRequest; - Underlying = underlying; - _universeProvider = universeProvider; - _timeProvider = timeProvider; - - _needNewCurrent = true; - } - - /// - /// Returns current option chain enumerator position - /// - public BaseDataCollection Current { get; private set; } - - /// - /// Returns current option chain enumerator position - /// - object IEnumerator.Current => Current; - - /// - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - /// - public void Dispose() - { - Underlying.Dispose(); - } - - /// - /// Advances the enumerator to the next element of the collection. - /// - /// - /// true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection. - /// - public bool MoveNext() - { - Underlying.MoveNext(); - - if (Underlying.Current == null) - { - Current = null; - return true; - } - - if (!_needNewCurrent) - { - // refresh on date change (in exchange time zone) - _needNewCurrent = _timeProvider.GetUtcNow().ConvertFromUtc(_subscriptionRequest.Configuration.ExchangeTimeZone).Date != _lastEmitTime.Date; - } - - if (_needNewCurrent) - { - if (!_universeProvider.CanPerformSelection()) - { - Current = null; - return true; - } - - var localTime = _timeProvider.GetUtcNow() - .ConvertFromUtc(_subscriptionRequest.Configuration.ExchangeTimeZone) - .RoundDown(_subscriptionRequest.Configuration.Increment); - - // loading the list of futures contracts and converting them into zip entries - var symbols = _universeProvider.LookupSymbols(_subscriptionRequest.Security.Symbol, false); - var zipEntries = symbols.Select(x => new ZipEntryName { Time = localTime, Symbol = x } as BaseData).ToList(); - _currentData = new BaseDataCollection - { - Symbol = _subscriptionRequest.Security.Symbol, - Underlying = Underlying.Current, - Data = zipEntries, - Time = localTime, - EndTime = localTime - }; - - Log.Trace($"DataQueueOptionChainUniverseDataCollectionEnumerator({_currentData.Symbol}): Emitting data point: {_currentData.EndTime}. " + - $"Count: {_currentData.Data.Count}. Underlying: {_currentData.Underlying} Underlying.EndTime: {_currentData.Underlying.EndTime}"); - - _lastEmitTime = localTime; - - Current = _currentData; - _needNewCurrent = false; - } - else - { - if (Current == null) - { - Current = _currentData; - } - - Current = (BaseDataCollection)Current.Clone(fillForward: true); - Current.Underlying = Underlying.Current; - Current.Time = Underlying.Current.EndTime; - Current.EndTime = Underlying.Current.EndTime; - } - - return true; - } - - /// - /// Sets the enumerator to its initial position, which is before the first element in the collection. - /// - public void Reset() - { - Underlying.Reset(); - _needNewCurrent = true; - } - } -} diff --git a/Engine/DataFeeds/Enumerators/Factories/BaseDataSubscriptionEnumeratorFactory.cs b/Engine/DataFeeds/Enumerators/Factories/BaseDataSubscriptionEnumeratorFactory.cs deleted file mode 100644 index 02a0223cdab1..000000000000 --- a/Engine/DataFeeds/Enumerators/Factories/BaseDataSubscriptionEnumeratorFactory.cs +++ /dev/null @@ -1,87 +0,0 @@ -/* - * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. - * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * -*/ - -using System; -using QuantConnect.Data; -using QuantConnect.Interfaces; -using System.Collections.Generic; -using QuantConnect.Data.Auxiliary; -using QuantConnect.Data.UniverseSelection; - -namespace QuantConnect.Lean.Engine.DataFeeds.Enumerators.Factories -{ - /// - /// Provides a default implementation of that uses - /// factory methods for reading sources - /// - public class BaseDataSubscriptionEnumeratorFactory : ISubscriptionEnumeratorFactory - { - private readonly IOptionChainProvider _optionChainProvider; - private readonly IFutureChainProvider _futureChainProvider; - private readonly Func> _tradableDaysProvider; - - /// - /// Initializes a new instance of the class - /// - /// The option chain provider - /// The future chain provider - public BaseDataSubscriptionEnumeratorFactory(IOptionChainProvider optionChainProvider, IFutureChainProvider futureChainProvider) - { - _futureChainProvider = futureChainProvider; - _optionChainProvider = optionChainProvider; - _tradableDaysProvider = (request => request.TradableDaysInDataTimeZone); - } - - /// - /// Creates an enumerator to read the specified request - /// - /// The subscription request to be read - /// Provider used to get data when it is not present on disk - /// An enumerator reading the subscription request - public IEnumerator CreateEnumerator(SubscriptionRequest request, IDataProvider dataProvider) - { - // We decide to use the ZipDataCacheProvider instead of the SingleEntryDataCacheProvider here - // for resiliency and as a fix for an issue preventing us from reading non-equity options data. - // It has the added benefit of caching any zip files that we request from the filesystem, and reading - // files contained within the zip file, which the SingleEntryDataCacheProvider does not support. - var sourceFactory = request.Configuration.GetBaseDataInstance(); - foreach (var date in _tradableDaysProvider(request)) - { - IEnumerable symbols; - if (request.Configuration.SecurityType.IsOption()) - { - symbols = _optionChainProvider.GetOptionContractList(request.Configuration.Symbol, date); - } - else if (request.Configuration.SecurityType == SecurityType.Future) - { - symbols = _futureChainProvider.GetFutureContractList(request.Configuration.Symbol, date); - } - else - { - throw new NotImplementedException($"{request.Configuration.SecurityType} is not supported"); - } - - // we are going to use these symbols to create a collection that for options will also have the underlying that will be emitted in exchange time zone - // note the merging of the data will happen based on their end time so time zones are important to respect - var exchangeTimeZoneDate = date.ConvertTo(request.Configuration.DataTimeZone, request.ExchangeHours.TimeZone); - foreach (var symbol in symbols) - { - yield return new ZipEntryName { Symbol = symbol, Time = exchangeTimeZoneDate }; - } - } - } - } -} diff --git a/Engine/DataFeeds/Enumerators/Factories/OptionChainUniverseSubscriptionEnumeratorFactory.cs b/Engine/DataFeeds/Enumerators/Factories/OptionChainUniverseSubscriptionEnumeratorFactory.cs deleted file mode 100644 index 9b21dddadf37..000000000000 --- a/Engine/DataFeeds/Enumerators/Factories/OptionChainUniverseSubscriptionEnumeratorFactory.cs +++ /dev/null @@ -1,100 +0,0 @@ -/* - * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. - * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * -*/ - -using System; -using System.Collections.Generic; -using System.Linq; -using QuantConnect.Data; -using QuantConnect.Data.Market; -using QuantConnect.Data.UniverseSelection; -using QuantConnect.Interfaces; - -namespace QuantConnect.Lean.Engine.DataFeeds.Enumerators.Factories -{ - /// - /// Provides an implementation of for the - /// - public class OptionChainUniverseSubscriptionEnumeratorFactory : ISubscriptionEnumeratorFactory - { - private readonly Func> _enumeratorConfigurator; - private readonly bool _isLiveMode; - - private readonly IDataQueueUniverseProvider _symbolUniverse; - private readonly ITimeProvider _timeProvider; - - /// - /// Initializes a new instance of the class - /// - /// Function used to configure the sub-enumerators before sync (fill-forward/filter/ect...) - /// Symbol universe provider of the data queue - /// The time provider instance used to determine when bars are completed and can be emitted - public OptionChainUniverseSubscriptionEnumeratorFactory(Func> enumeratorConfigurator, - IDataQueueUniverseProvider symbolUniverse, ITimeProvider timeProvider) - { - _isLiveMode = true; - _symbolUniverse = symbolUniverse; - _timeProvider = timeProvider; - _enumeratorConfigurator = enumeratorConfigurator; - } - - /// - /// Creates an enumerator to read the specified request - /// - /// The subscription request to be read - /// Provider used to get data when it is not present on disk - /// An enumerator reading the subscription request - public IEnumerator CreateEnumerator(SubscriptionRequest request, IDataProvider dataProvider) - { - if (_isLiveMode) - { - // configuring the enumerator - var subscriptionConfiguration = GetSubscriptionConfigurations(request).First(); - var subscriptionRequest = new SubscriptionRequest(request, configuration: subscriptionConfiguration); - var configuredEnumerator = _enumeratorConfigurator(subscriptionRequest); - - return new DataQueueOptionChainUniverseDataCollectionEnumerator(subscriptionRequest, configuredEnumerator, _symbolUniverse, _timeProvider); - } - else - { - throw new InvalidOperationException($"Backtesting is expected to be using {nameof(BaseDataSubscriptionEnumeratorFactory)}"); - } - } - - private IEnumerable GetSubscriptionConfigurations(SubscriptionRequest request) - { - // canonical also needs underlying price data - var config = request.Configuration; - var underlying = config.Symbol.Underlying; - - // Making sure data is non-tick - var resolution = config.Resolution == Resolution.Tick ? Resolution.Second : config.Resolution; - - var configurations = new List - { - // add underlying trade data - new SubscriptionDataConfig(config, resolution: resolution, fillForward: true, symbol: underlying, objectType: typeof (TradeBar), tickType: TickType.Trade), - }; - - if (!_isLiveMode) - { - // rewrite the primary to be fill forward - configurations.Add(new SubscriptionDataConfig(config, resolution: resolution, fillForward: true)); - } - - return configurations; - } - } -} diff --git a/Engine/DataFeeds/FileSystemDataFeed.cs b/Engine/DataFeeds/FileSystemDataFeed.cs index a351f7988973..9b71b1470067 100644 --- a/Engine/DataFeeds/FileSystemDataFeed.cs +++ b/Engine/DataFeeds/FileSystemDataFeed.cs @@ -192,24 +192,6 @@ protected IEnumerator CreateUniverseEnumerator(SubscriptionRequest req { factory = new BaseDataCollectionSubscriptionEnumeratorFactory(_algorithm.ObjectStore); } - else if (request.Configuration.Type == typeof(ZipEntryName)) - { - // TODO: subscription should already come in correctly built - var resolution = request.Configuration.Resolution == Resolution.Tick ? Resolution.Second : request.Configuration.Resolution; - - // TODO: subscription should already come in as fill forward true - request = new SubscriptionRequest(request, configuration: new SubscriptionDataConfig(request.Configuration, fillForward: true, resolution: resolution)); - - var result = new BaseDataSubscriptionEnumeratorFactory(_algorithm.OptionChainProvider, _algorithm.FutureChainProvider) - .CreateEnumerator(request, _dataProvider); - - if (LeanData.UseDailyStrictEndTimes(_algorithm.Settings, request, request.Configuration.Symbol, request.Configuration.Increment)) - { - result = new StrictDailyEndTimesEnumerator(result, request.ExchangeHours, request.StartTimeLocal); - } - result = ConfigureEnumerator(request, true, result, fillForwardResolution); - return TryAppendUnderlyingEnumerator(request, result, createUnderlyingEnumerator, fillForwardResolution); - } // define our data enumerator var enumerator = factory.CreateEnumerator(request, _dataProvider); diff --git a/Engine/DataFeeds/LiveFutureChainProvider.cs b/Engine/DataFeeds/LiveFutureChainProvider.cs index 478fcff6e129..340a4e620580 100644 --- a/Engine/DataFeeds/LiveFutureChainProvider.cs +++ b/Engine/DataFeeds/LiveFutureChainProvider.cs @@ -1,11 +1,11 @@ /* * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); + * + * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -27,14 +27,6 @@ namespace QuantConnect.Lean.Engine.DataFeeds /// public class LiveFutureChainProvider : BacktestingFutureChainProvider { - /// - /// Creates a new instance - /// - /// The data cache provider instance to use - public LiveFutureChainProvider(IDataCacheProvider dataCacheProvider) : base(dataCacheProvider) - { - } - /// /// Gets the list of future contracts for a given underlying symbol /// diff --git a/Engine/DataFeeds/LiveOptionChainProvider.cs b/Engine/DataFeeds/LiveOptionChainProvider.cs index ee79bd101ec8..848d3bb7e2b7 100644 --- a/Engine/DataFeeds/LiveOptionChainProvider.cs +++ b/Engine/DataFeeds/LiveOptionChainProvider.cs @@ -68,16 +68,6 @@ static LiveOptionChainProvider() _client.DefaultRequestHeaders.AcceptLanguage.Add(new StringWithQualityHeaderValue("en-US", 0.5)); } - /// - /// Creates a new instance - /// - /// The data cache provider instance to use - /// The map file provider instance to use - public LiveOptionChainProvider(IDataCacheProvider dataCacheProvider, IMapFileProvider mapFileProvider) - : base(dataCacheProvider, mapFileProvider) - { - } - /// /// Gets the option chain associated with the underlying Symbol /// diff --git a/Engine/DataFeeds/LiveTradingDataFeed.cs b/Engine/DataFeeds/LiveTradingDataFeed.cs index c06b2bdbd38c..8383e93d6eb1 100644 --- a/Engine/DataFeeds/LiveTradingDataFeed.cs +++ b/Engine/DataFeeds/LiveTradingDataFeed.cs @@ -341,7 +341,8 @@ private Subscription CreateUniverseSubscription(SubscriptionRequest request) } else if (config.Type.IsAssignableTo(typeof(ETFConstituentUniverse)) || config.Type.IsAssignableTo(typeof(FundamentalUniverse)) || - (request.Universe is OptionChainUniverse && request.Configuration.SecurityType != SecurityType.FutureOption)) + request.Universe is OptionChainUniverse || + request.Universe is FuturesChainUniverse) { Log.Trace($"LiveTradingDataFeed.CreateUniverseSubscription(): Creating {config.Type.Name} universe: {config.Symbol.ID}"); @@ -368,40 +369,6 @@ private Subscription CreateUniverseSubscription(SubscriptionRequest request) // advance time if before 23pm or after 5am and not on Saturdays time => time.Hour < 23 && time.Hour > 5 && time.DayOfWeek != DayOfWeek.Saturday); } - else if (request.Universe is OptionChainUniverse) - { - Log.Trace("LiveTradingDataFeed.CreateUniverseSubscription(): Creating option chain universe: " + config.Symbol.ID); - - Func> configure = (subRequest) => - { - // Pass the security exchange hours explicitly to avoid using the ones in the request, since - // those could be different. e.g. when requests are created for open interest data the exchange - // hours are set to always open to avoid OI data being filtered out due to the exchange being closed. - var useDailyStrictEndTimes = LeanData.UseDailyStrictEndTimes(_algorithm.Settings, request, request.Configuration.Symbol, - request.Configuration.Increment, request.Security.Exchange.Hours); - var fillForwardResolution = _subscriptions.UpdateAndGetFillForwardResolution(subRequest.Configuration); - var input = Subscribe(subRequest.Configuration, (sender, args) => subscription?.OnNewDataAvailable(), (_) => false); - return new LiveFillForwardEnumerator(_frontierTimeProvider, input, subRequest.Security.Exchange, fillForwardResolution, - subRequest.Configuration.ExtendedMarketHours, localEndTime, subRequest.Configuration.Resolution, - subRequest.Configuration.DataTimeZone, useDailyStrictEndTimes, request.Configuration.Type); - }; - - var symbolUniverse = GetUniverseProvider(request.Configuration.SecurityType); - - var enumeratorFactory = new OptionChainUniverseSubscriptionEnumeratorFactory(configure, symbolUniverse, _timeProvider); - enumerator = enumeratorFactory.CreateEnumerator(request, _dataProvider); - - enumerator = new FrontierAwareEnumerator(enumerator, _frontierTimeProvider, tzOffsetProvider); - } - else if (request.Universe is FuturesChainUniverse) - { - Log.Trace("LiveTradingDataFeed.CreateUniverseSubscription(): Creating futures chain universe: " + config.Symbol.ID); - - var symbolUniverse = GetUniverseProvider(SecurityType.Future); - - enumerator = new DataQueueFuturesChainUniverseDataCollectionEnumerator(request, symbolUniverse, _timeProvider); - enumerator = new FrontierAwareEnumerator(enumerator, _frontierTimeProvider, tzOffsetProvider); - } else { Log.Trace("LiveTradingDataFeed.CreateUniverseSubscription(): Creating custom universe: " + config.Symbol.ID); diff --git a/Engine/DataFeeds/Queues/FakeDataQueue.cs b/Engine/DataFeeds/Queues/FakeDataQueue.cs index b682717add73..88c5ba1a569c 100644 --- a/Engine/DataFeeds/Queues/FakeDataQueue.cs +++ b/Engine/DataFeeds/Queues/FakeDataQueue.cs @@ -38,7 +38,6 @@ public class FakeDataQueue : IDataQueueHandler, IDataQueueUniverseProvider private int _dataPointsPerSecondPerSymbol; private readonly Timer _timer; - private readonly IDataCacheProvider _dataCacheProvider; private readonly IOptionChainProvider _optionChainProvider; private readonly EventBasedDataQueueHandlerSubscriptionManager _subscriptionManager; private readonly IDataAggregator _aggregator; @@ -67,9 +66,17 @@ public FakeDataQueue(IDataAggregator dataAggregator, int dataPointsPerSecondPerS { _aggregator = dataAggregator; _dataPointsPerSecondPerSymbol = dataPointsPerSecondPerSymbol; - _dataCacheProvider = new ZipDataCacheProvider(new DefaultDataProvider(), true); + var mapFileProvider = Composer.Instance.GetPart(); - _optionChainProvider = new LiveOptionChainProvider(_dataCacheProvider, mapFileProvider); + var historyManager = (IHistoryProvider)Composer.Instance.GetPart(); + if (historyManager == null) + { + historyManager = Composer.Instance.GetPart(); + } + var optionChainProvider = new LiveOptionChainProvider(); + optionChainProvider.Initialize(new(mapFileProvider, historyManager)); + _optionChainProvider = optionChainProvider; + _marketHoursDatabase = MarketHoursDatabase.FromDataFolder(); _symbolExchangeTimeZones = new Dictionary(); _subscriptionManager = new EventBasedDataQueueHandlerSubscriptionManager(); @@ -149,7 +156,6 @@ public void Dispose() { _timer.Stop(); _timer.DisposeSafely(); - _dataCacheProvider.DisposeSafely(); } /// @@ -158,7 +164,7 @@ public void Dispose() private void PopulateQueue() { var symbols = _subscriptionManager.GetSubscribedSymbols(); - + foreach (var symbol in symbols) { diff --git a/Engine/DataFeeds/TimeSliceFactory.cs b/Engine/DataFeeds/TimeSliceFactory.cs index 4a7d00ebed4e..d8190ee9d938 100644 --- a/Engine/DataFeeds/TimeSliceFactory.cs +++ b/Engine/DataFeeds/TimeSliceFactory.cs @@ -464,11 +464,9 @@ private bool HandleOptionData(DateTime algorithmTime, BaseData baseData, OptionC return false; } - OptionContract contract; - if (!chain.Contracts.TryGetValue(baseData.Symbol, out contract)) + if (!chain.Contracts.TryGetValue(baseData.Symbol, out var contract)) { contract = OptionContract.Create(baseData, security, chain.Underlying); - chain.Contracts[baseData.Symbol] = contract; if (option != null) @@ -477,31 +475,9 @@ private bool HandleOptionData(DateTime algorithmTime, BaseData baseData, OptionC } } - // populate ticks and tradebars dictionaries with no aux data - switch (baseData.DataType) - { - case MarketDataType.Tick: - var tick = (Tick)baseData; - chain.Ticks.Add(tick.Symbol, tick); - contract.Update(tick); - break; - - case MarketDataType.TradeBar: - var tradeBar = (TradeBar)baseData; - chain.TradeBars[symbol] = tradeBar; - contract.Update(tradeBar); - break; - - case MarketDataType.QuoteBar: - var quote = (QuoteBar)baseData; - chain.QuoteBars[symbol] = quote; - contract.Update(quote); - break; - - case MarketDataType.Base: - chain.AddAuxData(baseData); - break; - } + contract.Update(baseData); + chain.AddData(baseData); + return true; } @@ -528,99 +504,16 @@ private bool HandleFuturesData(DateTime algorithmTime, BaseData baseData, Future return false; } - FuturesContract contract; - if (!chain.Contracts.TryGetValue(baseData.Symbol, out contract)) + if (!chain.Contracts.TryGetValue(baseData.Symbol, out var contract)) { - var underlyingSymbol = baseData.Symbol.Underlying; - contract = new FuturesContract(baseData.Symbol, underlyingSymbol) - { - Time = baseData.EndTime, - LastPrice = security.Close, - Volume = (long)security.Volume, - BidPrice = security.BidPrice, - BidSize = (long)security.BidSize, - AskPrice = security.AskPrice, - AskSize = (long)security.AskSize, - OpenInterest = security.OpenInterest - }; + contract = new FuturesContract(baseData.Symbol); chain.Contracts[baseData.Symbol] = contract; } - // populate ticks and tradebars dictionaries with no aux data - switch (baseData.DataType) - { - case MarketDataType.Tick: - var tick = (Tick)baseData; - chain.Ticks.Add(tick.Symbol, tick); - UpdateContract(contract, tick); - break; - - case MarketDataType.TradeBar: - var tradeBar = (TradeBar)baseData; - chain.TradeBars[symbol] = tradeBar; - UpdateContract(contract, tradeBar); - break; - - case MarketDataType.QuoteBar: - var quote = (QuoteBar)baseData; - chain.QuoteBars[symbol] = quote; - UpdateContract(contract, quote); - break; - - case MarketDataType.Base: - chain.AddAuxData(baseData); - break; - } - return true; - } + contract.Update(baseData); + chain.AddData(baseData); - private static void UpdateContract(FuturesContract contract, QuoteBar quote) - { - if (quote.Ask != null && quote.Ask.Close != 0m) - { - contract.AskPrice = quote.Ask.Close; - contract.AskSize = (long)quote.LastAskSize; - } - if (quote.Bid != null && quote.Bid.Close != 0m) - { - contract.BidPrice = quote.Bid.Close; - contract.BidSize = (long)quote.LastBidSize; - } - } - - private static void UpdateContract(FuturesContract contract, Tick tick) - { - if (tick.TickType == TickType.Trade) - { - contract.LastPrice = tick.Price; - } - else if (tick.TickType == TickType.Quote) - { - if (tick.AskPrice != 0m) - { - contract.AskPrice = tick.AskPrice; - contract.AskSize = (long)tick.AskSize; - } - if (tick.BidPrice != 0m) - { - contract.BidPrice = tick.BidPrice; - contract.BidSize = (long)tick.BidSize; - } - } - else if (tick.TickType == TickType.OpenInterest) - { - if (tick.Value != 0m) - { - contract.OpenInterest = tick.Value; - } - } - } - - private static void UpdateContract(FuturesContract contract, TradeBar tradeBar) - { - if (tradeBar.Close == 0m) return; - contract.LastPrice = tradeBar.Close; - contract.Volume = (long)tradeBar.Volume; + return true; } } } diff --git a/Engine/Engine.cs b/Engine/Engine.cs index 7e325049f162..1e72023a52f7 100644 --- a/Engine/Engine.cs +++ b/Engine/Engine.cs @@ -217,6 +217,7 @@ public void Run(AlgorithmNodePacket job, AlgorithmManager manager, string assemb historyProvider.DownloadFailed += (sender, args) => { AlgorithmHandlers.Results.ErrorMessage(args.Message, args.StackTrace); }; historyProvider.ReaderErrorDetected += (sender, args) => { AlgorithmHandlers.Results.RuntimeError(args.Message, args.StackTrace); }; + Composer.Instance.AddPart(historyProvider); algorithm.HistoryProvider = historyProvider; // initialize the default brokerage message handler diff --git a/Engine/HistoricalData/FakeHistoryProvider.cs b/Engine/HistoricalData/FakeHistoryProvider.cs index 8717a5b4d543..d772276bb531 100644 --- a/Engine/HistoricalData/FakeHistoryProvider.cs +++ b/Engine/HistoricalData/FakeHistoryProvider.cs @@ -91,34 +91,6 @@ public override IEnumerable GetHistory(IEnumerable reques Period = single.Resolution.ToTimeSpan() }; } - else if (single.DataType == typeof(ZipEntryName)) - { - if (single.Symbol.SecurityType == SecurityType.Future) - { - data = new ZipEntryName - { - Symbol = Symbol.CreateFuture(single.Symbol.ID.Symbol, single.Symbol.ID.Market, currentLocalTime.AddDays(20)), - Time = currentLocalTime - }; - } - else if (single.Symbol.SecurityType.IsOption()) - { - data = new ZipEntryName - { - Symbol = Symbol.CreateOption(single.Symbol.Underlying.ID.Symbol, - single.Symbol.ID.Market, - single.Symbol.Underlying.SecurityType.DefaultOptionStyle(), - default(OptionRight), - 0m, - currentLocalTime.AddDays(20)), - Time = currentLocalTime - }; - } - else - { - yield break; - } - } else { yield break; diff --git a/Engine/Setup/BacktestingSetupHandler.cs b/Engine/Setup/BacktestingSetupHandler.cs index 6f38e292d8e9..67a4bbe6a6d5 100644 --- a/Engine/Setup/BacktestingSetupHandler.cs +++ b/Engine/Setup/BacktestingSetupHandler.cs @@ -167,10 +167,15 @@ public bool Setup(SetupHandlerParameters parameters) algorithm.Schedule.SetEventSchedule(parameters.RealTimeHandler); // set the option chain provider - algorithm.SetOptionChainProvider(new CachingOptionChainProvider(new BacktestingOptionChainProvider(parameters.DataCacheProvider, parameters.MapFileProvider))); + var optionChainProvider = new BacktestingOptionChainProvider(); + var initParameters = new ChainProviderInitializeParameters(parameters.MapFileProvider, algorithm.HistoryProvider); + optionChainProvider.Initialize(initParameters); + algorithm.SetOptionChainProvider(new CachingOptionChainProvider(optionChainProvider)); // set the future chain provider - algorithm.SetFutureChainProvider(new CachingFutureChainProvider(new BacktestingFutureChainProvider(parameters.DataCacheProvider))); + var futureChainProvider = new BacktestingFutureChainProvider(); + futureChainProvider.Initialize(initParameters); + algorithm.SetFutureChainProvider(new CachingFutureChainProvider(futureChainProvider)); // before we call initialize BaseSetupHandler.LoadBacktestJobAccountCurrency(algorithm, job); diff --git a/Engine/Setup/BrokerageSetupHandler.cs b/Engine/Setup/BrokerageSetupHandler.cs index 1a4b4d90fdcc..4cfefd875356 100644 --- a/Engine/Setup/BrokerageSetupHandler.cs +++ b/Engine/Setup/BrokerageSetupHandler.cs @@ -254,7 +254,9 @@ public bool Setup(SetupHandlerParameters parameters) var optionChainProvider = Composer.Instance.GetPart(); if (optionChainProvider == null) { - optionChainProvider = new CachingOptionChainProvider(new LiveOptionChainProvider(parameters.DataCacheProvider, parameters.MapFileProvider)); + var baseOptionChainProvider = new LiveOptionChainProvider(); + baseOptionChainProvider.Initialize(new(parameters.MapFileProvider, algorithm.HistoryProvider)); + optionChainProvider = new CachingOptionChainProvider(baseOptionChainProvider); Composer.Instance.AddPart(optionChainProvider); } // set the option chain provider @@ -263,7 +265,9 @@ public bool Setup(SetupHandlerParameters parameters) var futureChainProvider = Composer.Instance.GetPart(); if (futureChainProvider == null) { - futureChainProvider = new CachingFutureChainProvider(new LiveFutureChainProvider(parameters.DataCacheProvider)); + var baseFutureChainProvider = new LiveFutureChainProvider(); + baseFutureChainProvider.Initialize(new(parameters.MapFileProvider, algorithm.HistoryProvider)); + futureChainProvider = new CachingFutureChainProvider(baseFutureChainProvider); Composer.Instance.AddPart(futureChainProvider); } // set the future chain provider diff --git a/Research/QuantBook.cs b/Research/QuantBook.cs index f59e4e2cb219..c64ca5bbfbe6 100644 --- a/Research/QuantBook.cs +++ b/Research/QuantBook.cs @@ -38,7 +38,6 @@ using QuantConnect.Lean.Engine.Setup; using QuantConnect.Indicators; using QuantConnect.Scheduling; -using System.Collections; namespace QuantConnect.Research { @@ -200,8 +199,13 @@ public QuantBook() : base() ) ); - SetOptionChainProvider(new CachingOptionChainProvider(new BacktestingOptionChainProvider(_dataCacheProvider, mapFileProvider))); - SetFutureChainProvider(new CachingFutureChainProvider(new BacktestingFutureChainProvider(_dataCacheProvider))); + var initParameters = new ChainProviderInitializeParameters(mapFileProvider, HistoryProvider); + var optionChainProvider = new BacktestingOptionChainProvider(); + optionChainProvider.Initialize(initParameters); + var futureChainProvider = new BacktestingFutureChainProvider(); + futureChainProvider.Initialize(initParameters); + SetOptionChainProvider(new CachingOptionChainProvider(optionChainProvider)); + SetFutureChainProvider(new CachingFutureChainProvider(futureChainProvider)); SetAlgorithmMode(AlgorithmMode.Research); SetDeploymentTarget(Config.GetValue("deployment-target", DeploymentTarget.LocalPlatform)); @@ -427,29 +431,23 @@ public OptionHistory OptionHistory(Symbol symbol, DateTime start, DateTime? end extendedMarketHours: extendedMarketHours); } } - var allSymbols = new List(); - for (var date = start; date < end; date = date.AddDays(1)) + + var allSymbols = new HashSet(); + var optionFilterUniverse = new OptionFilterUniverse(option); + + foreach (var date in QuantConnect.Time.EachTradeableDay(option, start, end.Value.AddDays(-1), extendedMarketHours)) { - if (option.Exchange.DateIsOpen(date, extendedMarketHours: extendedMarketHours)) + var universeData = GetChainHistory(symbol, date, out var underlyingData); + + if (underlyingData is not null) { - allSymbols.AddRange(OptionChainProvider.GetOptionContractList(symbol, date)); + optionFilterUniverse.Refresh(universeData, underlyingData, underlyingData.EndTime); + allSymbols.UnionWith(option.ContractFilter.Filter(optionFilterUniverse).Select(x => x.Symbol)); } } - var optionFilterUniverse = new OptionFilterUniverse(option); - // TODO: Once we tackle FOPs to work as equity and index options, we can clean this up: - // - Instead of calling OptionChainProvider.GetOptionContractList above to get allSymbol, - // we can directly make a history request for the new option universe type like History(...) - // instead of creating them below, given that the option chain provider does this history request internally. - var distinctSymbols = allSymbols.Distinct().Select(x => new OptionUniverse() { Symbol = x, Time = start}); - symbols = base.History(symbol.Underlying, start, end.Value, resolution) - .SelectMany(x => - { - // the option chain symbols wont change so we can set 'exchangeDateChange' to false always - optionFilterUniverse.Refresh(distinctSymbols, x, x.EndTime); - return option.ContractFilter.Filter(optionFilterUniverse).Select(x => x.Symbol); - }) - .Distinct().Concat(new[] { symbol.Underlying }); + var distinctSymbols = allSymbols.Distinct().Select(x => new OptionUniverse() { Symbol = x, Time = start }); + symbols = allSymbols.Concat(new[] { symbol.Underlying }); } else { @@ -505,9 +503,8 @@ public FutureHistory FutureHistory(Symbol symbol, DateTime start, DateTime? end { if (future.Exchange.DateIsOpen(date, extendedMarketHours)) { - var allList = FutureChainProvider.GetFutureContractList(future.Symbol, date); - - allSymbols.UnionWith(future.ContractFilter.Filter(new FutureFilterUniverse(allList, date))); + var universeData = GetChainHistory(future.Symbol, date, out _); + allSymbols.UnionWith(future.ContractFilter.Filter(new FutureFilterUniverse(universeData, date)).Select(x => x.Symbol)); } } } @@ -863,6 +860,28 @@ public PyDict GetPortfolioStatistics(PyObject dataFrame) } } + /// + /// Get's the universe data for the specified date + /// + private IEnumerable GetChainHistory(Symbol canonicalSymbol, DateTime date, out BaseData underlyingData) + where T : BaseChainUniverseData + { + // Use this GetEntry extension method since it's data type dependent, so we get the correct entry for the option universe + var marketHoursEntry = MarketHoursDatabase.GetEntry(canonicalSymbol, new[] { typeof(T) }); + var start = QuantConnect.Time.GetStartTimeForTradeBars(marketHoursEntry.ExchangeHours, date, QuantConnect.Time.OneDay, 1, + extendedMarketHours: false, marketHoursEntry.DataTimeZone); + var universeData = History(canonicalSymbol, start, date).SingleOrDefault(); + + if (universeData is not null) + { + underlyingData = universeData.Underlying; + return universeData.Data.Cast(); + } + + underlyingData = null; + return Enumerable.Empty(); + } + /// /// Helper method to perform selection on the given data and filter it /// diff --git a/Tests/Algorithm/AlgorithmAddDataTests.cs b/Tests/Algorithm/AlgorithmAddDataTests.cs index db0a6febdee9..e39d0adce033 100644 --- a/Tests/Algorithm/AlgorithmAddDataTests.cs +++ b/Tests/Algorithm/AlgorithmAddDataTests.cs @@ -101,7 +101,7 @@ public void DefaultDataFeeds_AreAdded_Successfully() Assert.IsTrue(GetMatchingSubscription(algo, option.Symbol, typeof(OptionUniverse)) != null); // index option - var indexOption = algo.AddSecurity(SecurityType.Option, "spx"); + var indexOption = algo.AddSecurity(SecurityType.IndexOption, "spx"); Assert.IsTrue(indexOption.Subscriptions.Count() == 1); Assert.IsTrue(GetMatchingSubscription(algo, indexOption.Symbol, typeof(OptionUniverse)) != null); @@ -113,7 +113,7 @@ public void DefaultDataFeeds_AreAdded_Successfully() // future var future = algo.AddSecurity(SecurityType.Future, "ES"); Assert.IsTrue(future.Subscriptions.Count() == 1); - Assert.IsTrue(future.Subscriptions.FirstOrDefault(x => typeof(ZipEntryName).IsAssignableFrom(x.Type)) != null); + Assert.IsTrue(future.Subscriptions.FirstOrDefault(x => typeof(FutureUniverse) == x.Type) != null); // Crypto high resolution var cryptoMinute = algo.AddSecurity(SecurityType.Equity, "goog"); diff --git a/Tests/Algorithm/AlgorithmChainsTests.cs b/Tests/Algorithm/AlgorithmChainsTests.cs index 1609459170ee..6d2cf04af0b3 100644 --- a/Tests/Algorithm/AlgorithmChainsTests.cs +++ b/Tests/Algorithm/AlgorithmChainsTests.cs @@ -34,29 +34,23 @@ public class AlgorithmChainsTest { private QCAlgorithm _algorithm; private BacktestingOptionChainProvider _optionChainProvider; + private BacktestingFutureChainProvider _futureChainProvider; - [OneTimeSetUp] - public void OneTimeSetUp() + [SetUp] + public void SetUp() { - var historyProvider = Composer.Instance.GetExportedValueByTypeName("SubscriptionDataReaderHistoryProvider", true); - var parameters = new HistoryProviderInitializeParameters(null, null, TestGlobals.DataProvider, TestGlobals.DataCacheProvider, - TestGlobals.MapFileProvider, TestGlobals.FactorFileProvider, (_) => { }, true, new DataPermissionManager(), null, - new AlgorithmSettings()); - try - { - historyProvider.Initialize(parameters); - } - catch (InvalidOperationException) - { - // Already initialized - } - _algorithm = new QCAlgorithm(); - _algorithm.SetHistoryProvider(historyProvider); + _algorithm.SetHistoryProvider(TestGlobals.HistoryProvider); _algorithm.SubscriptionManager.SetDataManager(new DataManagerStub(_algorithm)); - _optionChainProvider = new BacktestingOptionChainProvider(TestGlobals.DataCacheProvider, TestGlobals.MapFileProvider); + var initParameters = new ChainProviderInitializeParameters(TestGlobals.MapFileProvider, TestGlobals.HistoryProvider); + _optionChainProvider = new BacktestingOptionChainProvider(); + _optionChainProvider.Initialize(initParameters); _algorithm.SetOptionChainProvider(_optionChainProvider); + + _futureChainProvider = new BacktestingFutureChainProvider(); + _futureChainProvider.Initialize(initParameters); + _algorithm.SetFutureChainProvider(_futureChainProvider); } private static TestCaseData[] OptionChainTestCases => new TestCaseData[] @@ -109,7 +103,7 @@ public void GetsFullDataOptionChainAsDataFrame(Symbol symbol, DateTime date, boo var dfLength = dataFrame.GetAttr("shape")[0].GetAndDispose(); Assert.AreEqual(1, dfLength); - symbols = AssertUnflattenedSingleChainDataFrame(dataFrame, symbol); + symbols = AssertUnflattenedSingleChainDataFrame(dataFrame, symbol); } Assert.IsNotNull(symbols); @@ -129,48 +123,17 @@ public void GetsMultipleFullDataOptionChainAsDataFrame([Values] bool flatten) using var dataFrame = _algorithm.OptionChains(symbols, flatten).DataFrame; var expectedOptionChains = symbols.ToDictionary(x => x, x => _optionChainProvider.GetOptionContractList(x, date).ToList()); - var chainsTotalCount = expectedOptionChains.Values.Sum(x => x.Count); - - if (flatten) - { - var dfLength = dataFrame.GetAttr("shape")[0].GetAndDispose(); - Assert.AreEqual(chainsTotalCount, dfLength); - Assert.Multiple(() => - { - foreach (var (symbol, expectedChain) in expectedOptionChains) - { - var chainSymbols = AssertFlattenedSingleChainDataFrame(dataFrame, symbol); - - Assert.IsNotNull(chainSymbols); - CollectionAssert.AreEquivalent(expectedChain, chainSymbols); - } - }); - } - else - { - var dfLength = dataFrame.GetAttr("shape")[0].GetAndDispose(); - Assert.AreEqual(symbols.Length, dfLength); - - Assert.Multiple(() => - { - foreach (var (symbol, expectedChain) in expectedOptionChains) - { - var chainSymbols = AssertUnflattenedSingleChainDataFrame(dataFrame, symbol); - - Assert.IsNotNull(chainSymbols); - CollectionAssert.AreEquivalent(expectedChain, chainSymbols); - } - }); - } + AssertMultiChainsDataFrame(flatten, symbols, dataFrame, expectedOptionChains, isOptionChain: true); } - private static List AssertFlattenedSingleChainDataFrame(PyObject dataFrame, Symbol symbol, bool hasCanonicalIndex = true) + private static List AssertFlattenedSingleChainDataFrame(PyObject dataFrame, Symbol symbol, bool hasCanonicalIndex = true, + bool isOptionChain = true) { PyObject subDataFrame = null; try { - subDataFrame = hasCanonicalIndex ? GetCanonicalSubDataFrame(dataFrame, symbol) : dataFrame; + subDataFrame = GetCanonicalSubDataFrame(dataFrame, symbol, isOptionChain, hasCanonicalIndex, out var canonicalSymbol); using var dfColumns = subDataFrame.GetAttr("columns"); using var dfColumnsList = dfColumns.InvokeMethod("tolist"); @@ -182,17 +145,23 @@ private static List AssertFlattenedSingleChainDataFrame(PyObject dataFra item.DisposeSafely(); } - var expectedColumns = symbol.SecurityType != SecurityType.Future && symbol.SecurityType != SecurityType.FutureOption - ? new[] + var expectedColumns = canonicalSymbol.SecurityType switch + { + SecurityType.Future => new[] { "expiry", "volume", "askprice", "asksize", "bidprice", "bidsize", "lastprice", "openinterest" }, + SecurityType.FutureOption => new[] { - "expiry", "strike", "right", "style", "volume", "delta", "gamma", "vega", "theta", "rho", "underlyingsymbol" - } - : new[] + "expiry", "strike", "scaledstrike", "right", "style", "volume", "askprice", "asksize", "bidprice", "bidsize", + "lastprice", "underlyingsymbol", "underlyinglastprice" + }, + _ => new[] { - "expiry", "strike", "scaledstrike", "right", "style", "volume", "underlyingsymbol" - }; + "expiry", "strike", "scaledstrike", "right", "style", "volume", "askprice", "asksize", "bidprice", "bidsize", + "lastprice", "openinterest", "impliedvolatility", "delta", "gamma", "vega", "theta", "rho", + "underlyingsymbol", "underlyinglastprice" + } + }; - CollectionAssert.IsSubsetOf(expectedColumns, columns); + CollectionAssert.AreEquivalent(expectedColumns, columns); using var dfIndex = subDataFrame.GetAttr("index"); return dfIndex.InvokeMethod("tolist").GetAndDispose>(); @@ -206,43 +175,219 @@ private static List AssertFlattenedSingleChainDataFrame(PyObject dataFra } } - private static List AssertUnflattenedSingleChainDataFrame(PyObject dataFrame, Symbol symbol) + private static List AssertUnflattenedSingleChainDataFrame(PyObject dataFrame, Symbol symbol, bool isOptionChain = true) + where T : BaseContract { - using var subDataFrame = GetCanonicalSubDataFrame(dataFrame, symbol); + using var subDataFrame = GetCanonicalSubDataFrame(dataFrame, symbol, isOptionChain, true, out _); using var dfOptionChainList = subDataFrame["contracts"]; - var contracts = dfOptionChainList.GetAndDispose>().ToList(); + var contracts = dfOptionChainList.GetAndDispose>().ToList(); return contracts.Select(x => x.Symbol).ToList(); } - private static PyObject GetCanonicalSubDataFrame(PyObject dataFrame, Symbol symbol) + private static PyObject GetCanonicalSubDataFrame(PyObject dataFrame, Symbol symbol, bool forOptionChain, bool hasCanonicalIndex, + out Symbol canonicalSymbol) { - var canonicalSymbol = symbol.SecurityType.IsOption() ? symbol : Symbol.CreateCanonicalOption(symbol); + canonicalSymbol = symbol; + if (canonicalSymbol.SecurityType == SecurityType.Future && !forOptionChain) + { + canonicalSymbol = canonicalSymbol.Canonical; + } + else if (!canonicalSymbol.SecurityType.IsOption()) + { + canonicalSymbol = Symbol.CreateCanonicalOption(symbol); + } + + if (!hasCanonicalIndex) + { + return dataFrame; + } + using var pySymbol = canonicalSymbol.ToPython(); return dataFrame.GetAttr("loc")[pySymbol]; } - [TestCase(2015, 12, 23, 23)] - [TestCase(2015, 12, 24, 0)] - [TestCase(2015, 12, 24, 1)] - [TestCase(2015, 12, 24, 2)] - [TestCase(2015, 12, 24, 6)] - [TestCase(2015, 12, 24, 12)] - [TestCase(2015, 12, 24, 16)] - public void IndexOptionChainApisAreConsistent(int year, int month, int day, int hour) + private static IEnumerable GetOptionChainApisTestData() { - var dateTime = new DateTime(year, month, day, hour, 0, 0); - _algorithm.SetDateTime(dateTime.ConvertToUtc(_algorithm.TimeZone)); + var indexSymbol = Symbols.SPX; + yield return new TestCaseData(indexSymbol, new DateTime(2015, 12, 23, 23, 0, 0)); + yield return new TestCaseData(indexSymbol, new DateTime(2015, 12, 24, 0, 0, 0)); + yield return new TestCaseData(indexSymbol, new DateTime(2015, 12, 24, 1, 0, 0)); + yield return new TestCaseData(indexSymbol, new DateTime(2015, 12, 24, 2, 0, 0)); + yield return new TestCaseData(indexSymbol, new DateTime(2015, 12, 24, 6, 0, 0)); + yield return new TestCaseData(indexSymbol, new DateTime(2015, 12, 24, 12, 0, 0)); + yield return new TestCaseData(indexSymbol, new DateTime(2015, 12, 24, 16, 0, 0)); + + var equitySymbol = Symbols.GOOG; + yield return new TestCaseData(equitySymbol, new DateTime(2015, 12, 24, 0, 0, 0)); + yield return new TestCaseData(equitySymbol, new DateTime(2015, 12, 24, 1, 0, 0)); + yield return new TestCaseData(equitySymbol, new DateTime(2015, 12, 24, 2, 0, 0)); + yield return new TestCaseData(equitySymbol, new DateTime(2015, 12, 24, 6, 0, 0)); + yield return new TestCaseData(equitySymbol, new DateTime(2015, 12, 24, 12, 0, 0)); + yield return new TestCaseData(equitySymbol, new DateTime(2015, 12, 24, 16, 0, 0)); + + var futureSymbol = Symbol.CreateFuture(Futures.Indices.SP500EMini, Market.CME, new DateTime(2020, 6, 19)); + yield return new TestCaseData(futureSymbol, new DateTime(2020, 01, 04, 23, 0, 0)); + yield return new TestCaseData(futureSymbol, new DateTime(2020, 01, 05, 0, 0, 0)); + yield return new TestCaseData(futureSymbol, new DateTime(2020, 01, 05, 1, 0, 0)); + yield return new TestCaseData(futureSymbol, new DateTime(2020, 01, 05, 2, 0, 0)); + yield return new TestCaseData(futureSymbol, new DateTime(2020, 01, 05, 6, 0, 0)); + yield return new TestCaseData(futureSymbol, new DateTime(2020, 01, 05, 12, 0, 0)); + yield return new TestCaseData(futureSymbol, new DateTime(2020, 01, 05, 16, 0, 0)); + } - var symbol = Symbols.SPX; - var exchange = MarketHoursDatabase.FromDataFolder().GetExchangeHours(symbol.ID.Market, symbol, symbol.SecurityType); + [TestCaseSource(nameof(GetOptionChainApisTestData))] + public void OptionChainApisAreConsistent(Symbol symbol, DateTime dateTime) + { + _algorithm.SetDateTime(dateTime.ConvertToUtc(_algorithm.TimeZone)); + var exchange = MarketHoursDatabase.FromDataFolder().GetExchangeHours(symbol.ID.Market, symbol, symbol.SecurityType); var chainFromAlgorithmApi = _algorithm.OptionChain(symbol).Select(x => x.Symbol).ToList(); - var chainFromChainProviderApi = _optionChainProvider.GetOptionContractList(symbol, dateTime.ConvertTo(_algorithm.TimeZone, exchange.TimeZone)).ToList(); + var chainFromChainProviderApi = _optionChainProvider.GetOptionContractList(symbol, + dateTime.ConvertTo(_algorithm.TimeZone, exchange.TimeZone)).ToList(); CollectionAssert.IsNotEmpty(chainFromAlgorithmApi); CollectionAssert.AreEquivalent(chainFromAlgorithmApi, chainFromChainProviderApi); } + + private static IEnumerable GetFutureChainApisTestData() + { + var futureSymbol = Symbol.CreateFuture(Futures.Indices.SP500EMini, Market.CME, new DateTime(2020, 6, 19)); + var canonicalFutureSymbol = futureSymbol.Canonical; + var futureOptionSymbol = Symbol.CreateOption(futureSymbol, futureSymbol.ID.Market, OptionStyle.American, OptionRight.Call, + 75m, new DateTime(2020, 5, 19)); + + foreach (var symbol in new[] { futureSymbol, canonicalFutureSymbol, futureOptionSymbol }) + { + foreach (var withFutureAdded in new[] { true, false }) + { + yield return new TestCaseData(symbol, new DateTime(2013, 10, 06, 23, 0, 0), withFutureAdded); + yield return new TestCaseData(symbol, new DateTime(2013, 10, 07, 0, 0, 0), withFutureAdded); + yield return new TestCaseData(symbol, new DateTime(2013, 10, 07, 1, 0, 0), withFutureAdded); + yield return new TestCaseData(symbol, new DateTime(2013, 10, 07, 2, 0, 0), withFutureAdded); + yield return new TestCaseData(symbol, new DateTime(2013, 10, 07, 6, 0, 0), withFutureAdded); + yield return new TestCaseData(symbol, new DateTime(2013, 10, 07, 12, 0, 0), withFutureAdded); + yield return new TestCaseData(symbol, new DateTime(2013, 10, 07, 16, 0, 0), withFutureAdded); + } + } + } + + [TestCaseSource(nameof(GetFutureChainApisTestData))] + public void FuturesChainApisAreConsistent(Symbol symbol, DateTime dateTime, bool withFutureAdded) + { + _algorithm.SetDateTime(dateTime.ConvertToUtc(_algorithm.TimeZone)); + + if (withFutureAdded) + { + // It should work regardless of whether the future is added to the algorithm + _algorithm.AddFuture("ES"); + } + + var exchange = MarketHoursDatabase.FromDataFolder().GetExchangeHours(symbol.ID.Market, symbol, symbol.SecurityType); + var chainFromAlgorithmApi = _algorithm.FuturesChain(symbol).Select(x => x.Symbol).ToList(); + var chainFromChainProviderApi = _futureChainProvider.GetFutureContractList(symbol, + dateTime.ConvertTo(_algorithm.TimeZone, exchange.TimeZone)).ToList(); + + CollectionAssert.IsNotEmpty(chainFromAlgorithmApi); + CollectionAssert.AreEquivalent(chainFromAlgorithmApi, chainFromChainProviderApi); + } + + [Test] + public void GetsFullDataFuturesChainAsDataFrame([Values] bool flatten, [Values] bool withFutureAdded) + { + _algorithm.SetPandasConverter(); + var date = new DateTime(2013, 10, 07); + _algorithm.SetDateTime(date.ConvertToUtc(_algorithm.TimeZone)); + + using var _ = Py.GIL(); + + // It should work regardless of whether the future is added to the algorithm + var symbol = withFutureAdded ? _algorithm.AddFuture(Futures.Indices.SP500EMini).Symbol : Symbols.ES_Future_Chain; + using var dataFrame = _algorithm.FuturesChain(symbol, flatten).DataFrame; + List symbols = null; + + var exchange = MarketHoursDatabase.FromDataFolder().GetExchangeHours(symbol.ID.Market, symbol, symbol.SecurityType); + var exchangeTime = date.ConvertTo(_algorithm.TimeZone, exchange.TimeZone); + var expectedFutureContractSymbols = _futureChainProvider.GetFutureContractList(symbol, exchangeTime).ToList(); + + if (flatten) + { + symbols = AssertFlattenedSingleChainDataFrame(dataFrame, symbol, hasCanonicalIndex: false, isOptionChain: false); + } + else + { + var dfLength = dataFrame.GetAttr("shape")[0].GetAndDispose(); + Assert.AreEqual(1, dfLength); + + symbols = AssertUnflattenedSingleChainDataFrame(dataFrame, symbol, isOptionChain: false); + } + + Assert.IsNotNull(symbols); + CollectionAssert.AreEquivalent(expectedFutureContractSymbols, symbols); + } + + [Test] + public void GetsMultipleFullDataFuturesChainsAsDataFrame([Values] bool flatten, [Values] bool withFutureAdded) + { + var dateTime = new DateTime(2013, 10, 07, 12, 0, 0); + _algorithm.SetPandasConverter(); + _algorithm.SetDateTime(dateTime.ConvertToUtc(_algorithm.TimeZone)); + + using var _ = Py.GIL(); + + var symbols = withFutureAdded + ? new[] { Symbols.ES_Future_Chain, Symbols.CreateFuturesCanonicalSymbol(Futures.Dairy.ClassIIIMilk) } + : new[] { _algorithm.AddFuture(Futures.Indices.SP500EMini).Symbol, _algorithm.AddFuture(Futures.Dairy.ClassIIIMilk).Symbol }; + using var dataFrame = _algorithm.FuturesChains(symbols, flatten).DataFrame; + + var expectedFuturesChains = symbols.ToDictionary(x => x, x => + { + var exchange = MarketHoursDatabase.FromDataFolder().GetExchangeHours(x.ID.Market, x, x.SecurityType); + return _futureChainProvider.GetFutureContractList(x, dateTime.ConvertTo(_algorithm.TimeZone, exchange.TimeZone)).ToList(); + }); + + AssertMultiChainsDataFrame(flatten, symbols, dataFrame, expectedFuturesChains, isOptionChain: false); + } + + private static void AssertMultiChainsDataFrame(bool flatten, Symbol[] symbols, PyObject dataFrame, + Dictionary> expectedChains, bool isOptionChain) + where T : BaseContract + { + var chainsTotalCount = expectedChains.Values.Sum(x => x.Count); + + if (flatten) + { + var dfLength = dataFrame.GetAttr("shape")[0].GetAndDispose(); + Assert.AreEqual(chainsTotalCount, dfLength); + + Assert.Multiple(() => + { + foreach (var (symbol, expectedChain) in expectedChains) + { + var chainSymbols = AssertFlattenedSingleChainDataFrame(dataFrame, symbol, isOptionChain: isOptionChain); + + Assert.IsNotNull(chainSymbols); + CollectionAssert.AreEquivalent(expectedChain, chainSymbols); + } + }); + } + else + { + var dfLength = dataFrame.GetAttr("shape")[0].GetAndDispose(); + Assert.AreEqual(symbols.Length, dfLength); + + Assert.Multiple(() => + { + foreach (var (symbol, expectedChain) in expectedChains) + { + var chainSymbols = AssertUnflattenedSingleChainDataFrame(dataFrame, symbol, isOptionChain); + + Assert.IsNotNull(chainSymbols); + CollectionAssert.AreEquivalent(expectedChain, chainSymbols); + } + }); + } + } } } diff --git a/Tests/Algorithm/AlgorithmHistoryTests.cs b/Tests/Algorithm/AlgorithmHistoryTests.cs index 19ced9506b1a..fc872668efcf 100644 --- a/Tests/Algorithm/AlgorithmHistoryTests.cs +++ b/Tests/Algorithm/AlgorithmHistoryTests.cs @@ -4334,7 +4334,9 @@ private static void AssertFuturesHistoryWithDifferentContractDepthOffsetsResults { CheckThatHistoryResultsHaveEqualBarCount(historyResults, expectedHistoryCount); - var futureChainProvider = new BacktestingFutureChainProvider(TestGlobals.DataCacheProvider); + var futureChainProvider = new BacktestingFutureChainProvider(); + futureChainProvider.Initialize(new(TestGlobals.MapFileProvider, TestGlobals.HistoryProvider)); + var firstDateTime = historyResults[0][0].EndTime; var futureChain = futureChainProvider.GetFutureContractList(expectedSymbol, firstDateTime).ToList(); diff --git a/Tests/AlgorithmRunner.cs b/Tests/AlgorithmRunner.cs index a07dbbe4a036..00229da733d3 100644 --- a/Tests/AlgorithmRunner.cs +++ b/Tests/AlgorithmRunner.cs @@ -260,6 +260,7 @@ public override IEnumerable GetHistory(IEnumerable reques { requests = requests.ToList(); if (requests.Any(r => r.Symbol.SecurityType != SecurityType.Option && r.Symbol.SecurityType != SecurityType.IndexOption + && r.Symbol.SecurityType != SecurityType.FutureOption && r.Symbol.SecurityType != SecurityType.Future && r.Symbol.IsCanonical())) { throw new RegressionTestException($"Invalid history request symbols: {string.Join(",", requests.Select(x => x.Symbol))}"); diff --git a/Tests/Common/Data/SubscriptionManagerTests.cs b/Tests/Common/Data/SubscriptionManagerTests.cs index 487c19ba7556..a05967a3d8c2 100644 --- a/Tests/Common/Data/SubscriptionManagerTests.cs +++ b/Tests/Common/Data/SubscriptionManagerTests.cs @@ -22,7 +22,6 @@ using NUnit.Framework; using Python.Runtime; using QuantConnect.Data; -using QuantConnect.Data.Auxiliary; using QuantConnect.Data.Consolidators; using QuantConnect.Data.Market; using QuantConnect.Data.UniverseSelection; @@ -71,10 +70,10 @@ public void GetsSubscriptionDataTypesSingle(SecurityType securityType, Resolutio } [Test] - [TestCase(SecurityType.Future, Resolution.Minute, typeof(ZipEntryName), TickType.Quote)] - [TestCase(SecurityType.Future, Resolution.Tick, typeof(ZipEntryName), TickType.Quote)] - [TestCase(SecurityType.FutureOption, Resolution.Minute, typeof(ZipEntryName), TickType.Quote)] - [TestCase(SecurityType.FutureOption, Resolution.Tick, typeof(ZipEntryName), TickType.Quote)] + [TestCase(SecurityType.Future, Resolution.Minute, typeof(FutureUniverse), TickType.Quote)] + [TestCase(SecurityType.Future, Resolution.Tick, typeof(FutureUniverse), TickType.Quote)] + [TestCase(SecurityType.FutureOption, Resolution.Minute, typeof(OptionUniverse), TickType.Quote)] + [TestCase(SecurityType.FutureOption, Resolution.Tick, typeof(OptionUniverse), TickType.Quote)] [TestCase(SecurityType.Option, Resolution.Minute, typeof(OptionUniverse), TickType.Quote)] [TestCase(SecurityType.Option, Resolution.Tick, typeof(OptionUniverse), TickType.Quote)] [TestCase(SecurityType.IndexOption, Resolution.Minute, typeof(OptionUniverse), TickType.Quote)] diff --git a/Tests/Common/Data/UniverseSelection/OptionUniverseTests.cs b/Tests/Common/Data/UniverseSelection/OptionUniverseTests.cs index 5a74c6e97fac..69f6bfed2857 100644 --- a/Tests/Common/Data/UniverseSelection/OptionUniverseTests.cs +++ b/Tests/Common/Data/UniverseSelection/OptionUniverseTests.cs @@ -85,7 +85,7 @@ public void OneTimeSetUp() public void RoundTripCsvConversion() { var stringBuilder = new StringBuilder(); - stringBuilder.AppendLine("#" + OptionUniverse.CsvHeader); + stringBuilder.AppendLine("#" + OptionUniverse.CsvHeader(SecurityType.Option)); foreach (var data in _optionUniverseFile) { diff --git a/Tests/Common/Securities/FutureFilterTests.cs b/Tests/Common/Securities/FutureFilterTests.cs index c64e7fd76583..36489c76dcdc 100644 --- a/Tests/Common/Securities/FutureFilterTests.cs +++ b/Tests/Common/Securities/FutureFilterTests.cs @@ -18,6 +18,7 @@ using System.Linq; using NUnit.Framework; using QuantConnect.Data.Market; +using QuantConnect.Data.UniverseSelection; using QuantConnect.Securities; namespace QuantConnect.Tests.Common.Securities @@ -33,10 +34,10 @@ public void FiltersExpiryRange() Func universeFunc = universe => universe .Expiration(TimeSpan.FromDays(3), TimeSpan.FromDays(7)); - Func, IDerivativeSecurityFilterUniverse> func = + Func, IDerivativeSecurityFilterUniverse> func = universe => universeFunc(universe as FutureFilterUniverse); - var filter = new FuncSecurityDerivativeFilter(func); + var filter = new FuncSecurityDerivativeFilter(func); var symbols = new[] { Symbol.CreateFuture("SPY", Market.CME, time.AddDays(0)), // 0 @@ -50,8 +51,9 @@ public void FiltersExpiryRange() Symbol.CreateFuture("SPY", Market.CME, time.AddDays(8)), // 8 Symbol.CreateFuture("SPY", Market.CME, time.AddDays(9)), // 9 }; + var data = symbols.Select(x => new FutureUniverse() { Symbol = x }); - var filtered = filter.Filter(new FutureFilterUniverse(symbols, time)).ToList(); + var filtered = filter.Filter(new FutureFilterUniverse(data, time)).Select(x => x.Symbol).ToList(); Assert.AreEqual(5, filtered.Count); Assert.AreEqual(symbols[3], filtered[0]); Assert.AreEqual(symbols[4], filtered[1]); @@ -67,10 +69,10 @@ public void FiltersOutWeeklysByDefault() Func universeFunc = universe => universe; - Func, IDerivativeSecurityFilterUniverse> func = + Func, IDerivativeSecurityFilterUniverse> func = universe => universeFunc(universe as FutureFilterUniverse).ApplyTypesFilter(); - var filter = new FuncSecurityDerivativeFilter(func); + var filter = new FuncSecurityDerivativeFilter(func); var symbols = new[] { Symbol.CreateFuture("VX", Market.CFE, time.AddDays(0)), // 0 Standard!! @@ -80,8 +82,9 @@ public void FiltersOutWeeklysByDefault() Symbol.CreateFuture("VX", Market.CFE, time.AddDays(16)), // 16 Symbol.CreateFuture("VX", Market.CFE, time.AddDays(28)), // 28 Standard!! }; + var data = symbols.Select(x => new FutureUniverse() { Symbol = x }); - var filtered = filter.Filter(new FutureFilterUniverse(symbols, time)).ToList(); + var filtered = filter.Filter(new FutureFilterUniverse(data, time)).Select(x => x.Symbol).ToList(); Assert.AreEqual(2, filtered.Count); Assert.AreEqual(symbols[0], filtered[0]); Assert.AreEqual(symbols[5], filtered[1]); @@ -92,10 +95,10 @@ public void WeeklysFilterDoesNotFilterStandardContractWithExpiryMonthPriorOrAfte { Func universeFunc = universe => universe; - Func, IDerivativeSecurityFilterUniverse> func = + Func, IDerivativeSecurityFilterUniverse> func = universe => universeFunc(universe as FutureFilterUniverse).ApplyTypesFilter(); - var filter = new FuncSecurityDerivativeFilter(func); + var filter = new FuncSecurityDerivativeFilter(func); var symbols = new[] { Symbol.CreateFuture("CL", Market.NYMEX, new DateTime(2020, 11, 20)), @@ -105,8 +108,9 @@ public void WeeklysFilterDoesNotFilterStandardContractWithExpiryMonthPriorOrAfte Symbol.CreateFuture("YO", Market.NYMEX, new DateTime(2021, 4, 30)), Symbol.CreateFuture("NG", Market.NYMEX, new DateTime(2020, 11, 25)) }; + var data = symbols.Select(x => new FutureUniverse() { Symbol = x }); - var standardContracts = filter.Filter(new FutureFilterUniverse(symbols, new DateTime(2020, 1, 1))).ToList(); + var standardContracts = filter.Filter(new FutureFilterUniverse(data, new DateTime(2020, 1, 1))).Select(x => x.Symbol).ToList(); Assert.AreEqual(6, standardContracts.Count); Assert.AreEqual(symbols[0], standardContracts[0]); Assert.AreEqual(symbols[1], standardContracts[1]); @@ -124,10 +128,10 @@ public void FilterAllowBothTypes() // Include Weeklys to get both types of contracts through Func universeFunc = universe => universe.IncludeWeeklys(); - Func, IDerivativeSecurityFilterUniverse> func = + Func, IDerivativeSecurityFilterUniverse> func = universe => universeFunc(universe as FutureFilterUniverse).ApplyTypesFilter(); - var filter = new FuncSecurityDerivativeFilter(func); + var filter = new FuncSecurityDerivativeFilter(func); var symbols = new[] { Symbol.CreateFuture("VX", Market.CFE, time.AddDays(0)), // 0 Standard!! @@ -137,8 +141,9 @@ public void FilterAllowBothTypes() Symbol.CreateFuture("VX", Market.CFE, time.AddDays(16)), // 16 Symbol.CreateFuture("VX", Market.CFE, time.AddDays(28)), // 28 Standard!! }; + var data = symbols.Select(x => new FutureUniverse() { Symbol = x }); - var filtered = filter.Filter(new FutureFilterUniverse(symbols, time)).ToList(); + var filtered = filter.Filter(new FutureFilterUniverse(data, time)).Select(x => x.Symbol).ToList(); Assert.AreEqual(6, filtered.Count); Assert.AreEqual(symbols, filtered); } @@ -151,10 +156,10 @@ public void FilterOutStandards() // Weeklys only to drop standard contracts Func universeFunc = universe => universe.WeeklysOnly(); - Func, IDerivativeSecurityFilterUniverse> func = + Func, IDerivativeSecurityFilterUniverse> func = universe => universeFunc(universe as FutureFilterUniverse).ApplyTypesFilter(); - var filter = new FuncSecurityDerivativeFilter(func); + var filter = new FuncSecurityDerivativeFilter(func); var symbols = new[] { Symbol.CreateFuture("VX", Market.CFE, time.AddDays(0)), // 0 Standard!! @@ -164,8 +169,9 @@ public void FilterOutStandards() Symbol.CreateFuture("VX", Market.CFE, time.AddDays(16)), // 16 Symbol.CreateFuture("VX", Market.CFE, time.AddDays(28)), // 28 Standard!! }; + var data = symbols.Select(x => new FutureUniverse() { Symbol = x }); - var filtered = filter.Filter(new FutureFilterUniverse(symbols, time)).ToList(); + var filtered = filter.Filter(new FutureFilterUniverse(data, time)).Select(x => x.Symbol).ToList(); Assert.AreEqual(4, filtered.Count); Assert.AreEqual(symbols[1], filtered[0]); Assert.AreEqual(symbols[2], filtered[1]); @@ -183,10 +189,10 @@ public void FiltersFrontMonth() Func universeFunc = universe => universe.FrontMonth(); - Func, IDerivativeSecurityFilterUniverse> func = + Func, IDerivativeSecurityFilterUniverse> func = universe => universeFunc(universe as FutureFilterUniverse); - var filter = new FuncSecurityDerivativeFilter(func); + var filter = new FuncSecurityDerivativeFilter(func); var symbols = new[] { Symbol.CreateFuture("SPY", Market.USA, expiry1), // 0 @@ -200,8 +206,9 @@ public void FiltersFrontMonth() Symbol.CreateFuture("SPY", Market.USA, expiry4), // 8 Symbol.CreateFuture("SPY", Market.USA, expiry4), // 9 }; + var data = symbols.Select(x => new FutureUniverse() { Symbol = x }); - var filtered = filter.Filter(new FutureFilterUniverse(symbols, new DateTime(2016, 02, 26))).ToList(); + var filtered = filter.Filter(new FutureFilterUniverse(data, new DateTime(2016, 02, 26))).ToList(); Assert.AreEqual(4, filtered.Count); } @@ -215,10 +222,10 @@ public void FiltersBackMonth() Func universeFunc = universe => universe.BackMonth(); - Func, IDerivativeSecurityFilterUniverse> func = + Func, IDerivativeSecurityFilterUniverse> func = universe => universeFunc(universe as FutureFilterUniverse); - var filter = new FuncSecurityDerivativeFilter(func); + var filter = new FuncSecurityDerivativeFilter(func); var symbols = new[] { Symbol.CreateFuture("SPY", Market.USA, expiry1), // 0 @@ -232,8 +239,9 @@ public void FiltersBackMonth() Symbol.CreateFuture("SPY", Market.USA, expiry4), // 8 Symbol.CreateFuture("SPY", Market.USA, expiry4), // 9 }; + var data = symbols.Select(x => new FutureUniverse() { Symbol = x }); - var filtered = filter.Filter(new FutureFilterUniverse(symbols, new DateTime(2016, 02, 26))).ToList(); + var filtered = filter.Filter(new FutureFilterUniverse(data, new DateTime(2016, 02, 26))).ToList(); Assert.AreEqual(3, filtered.Count); } @@ -247,10 +255,10 @@ public void FiltersExpirationCycles() Func universeFunc = universe => universe.ExpirationCycle(FutureExpirationCycles.March); - Func, IDerivativeSecurityFilterUniverse> func = + Func, IDerivativeSecurityFilterUniverse> func = universe => universeFunc(universe as FutureFilterUniverse); - var filter = new FuncSecurityDerivativeFilter(func); + var filter = new FuncSecurityDerivativeFilter(func); var symbols = new[] { Symbol.CreateFuture("SPY", Market.USA, expiry1), // 0 @@ -264,8 +272,9 @@ public void FiltersExpirationCycles() Symbol.CreateFuture("SPY", Market.USA, expiry4), // 8 Symbol.CreateFuture("SPY", Market.USA, expiry4), // 9 }; + var data = symbols.Select(x => new FutureUniverse() { Symbol = x }); - var filtered = filter.Filter(new FutureFilterUniverse(symbols, new DateTime(2016, 02, 26))).ToList(); + var filtered = filter.Filter(new FutureFilterUniverse(data, new DateTime(2016, 02, 26))).ToList(); Assert.AreEqual(5, filtered.Count); } @@ -278,17 +287,18 @@ public void FilterTypeDoesNotBreakOnMissingExpiryFunction() // By Default only includes standards Func universeFunc = universe => universe; - Func, IDerivativeSecurityFilterUniverse> func = + Func, IDerivativeSecurityFilterUniverse> func = universe => universeFunc(universe as FutureFilterUniverse).ApplyTypesFilter(); - var filter = new FuncSecurityDerivativeFilter(func); + var filter = new FuncSecurityDerivativeFilter(func); var symbols = new[] { Symbol.CreateFuture("VX", Market.USA, time.AddDays(0)), // There is no Expiry function for VX on Market.USA }; + var data = symbols.Select(x => new FutureUniverse() { Symbol = x }); // Since this is a unidentifiable symbol for our expiry functions it will return true and be passed through - var filtered = filter.Filter(new FutureFilterUniverse(symbols, time)).ToList(); + var filtered = filter.Filter(new FutureFilterUniverse(data, time)).Select(x => x.Symbol).ToList(); Assert.AreEqual(1, filtered.Count); Assert.AreEqual(symbols[0], filtered[0]); } diff --git a/Tests/Common/Securities/Options/OptionChainProviderTests.cs b/Tests/Common/Securities/Options/OptionChainProviderTests.cs index 9dc85b92a7a6..57a0a8e7dea8 100644 --- a/Tests/Common/Securities/Options/OptionChainProviderTests.cs +++ b/Tests/Common/Securities/Options/OptionChainProviderTests.cs @@ -30,19 +30,17 @@ namespace QuantConnect.Tests.Common.Securities.Options [TestFixture, Parallelizable(ParallelScope.Fixtures)] public class OptionChainProviderTests { + private BacktestingOptionChainProvider _backtestingOptionChainProvider; + private LiveOptionChainProvider _liveOptionChainProvider; + [OneTimeSetUp] public void OneTimeSetUp() { - var historyProvider = Composer.Instance.GetExportedValueByTypeName("SubscriptionDataReaderHistoryProvider", true); - var parameters = new HistoryProviderInitializeParameters(null, null, TestGlobals.DataProvider, TestGlobals.DataCacheProvider, TestGlobals.MapFileProvider, TestGlobals.FactorFileProvider, (_) => { }, true, new DataPermissionManager(), null, new AlgorithmSettings()); - try - { - historyProvider.Initialize(parameters); - } - catch (InvalidOperationException) - { - // Already initialized - } + _backtestingOptionChainProvider = new BacktestingOptionChainProvider(); + _backtestingOptionChainProvider.Initialize(new(TestGlobals.MapFileProvider, TestGlobals.HistoryProvider)); + + _liveOptionChainProvider = new LiveOptionChainProvider(); + _liveOptionChainProvider.Initialize(new(TestGlobals.MapFileProvider, TestGlobals.HistoryProvider)); } [Test] @@ -51,8 +49,7 @@ public void UsesMultipleResolutionsFutureOption() // we don't have minute data for this date var date = new DateTime(2020, 01, 7); var future = Symbol.CreateFuture(QuantConnect.Securities.Futures.Indices.SP500EMini, Market.CME, new DateTime(2020, 6, 19)); - var provider = new BacktestingOptionChainProvider(TestGlobals.DataCacheProvider, TestGlobals.MapFileProvider); - var optionChain = provider.GetOptionContractList(future, date).OrderBy(s => s.ID.StrikePrice).ToList(); + var optionChain = _backtestingOptionChainProvider.GetOptionContractList(future, date).OrderBy(s => s.ID.StrikePrice).ToList(); Assert.IsTrue(optionChain.All(x => x.SecurityType == SecurityType.FutureOption)); Assert.IsTrue(optionChain.All(x => x.ID.Symbol == "ES")); @@ -70,8 +67,7 @@ public void BacktestingOptionChainProviderUsesPreviousTradableDateChain() var date = new DateTime(2014, 6, 7); Assert.AreEqual(DayOfWeek.Saturday, date.DayOfWeek); - var provider = new BacktestingOptionChainProvider(TestGlobals.DataCacheProvider, TestGlobals.MapFileProvider); - var twxOptionChain = provider.GetOptionContractList(Symbol.Create("TWX", SecurityType.Equity, Market.USA), date) + var twxOptionChain = _backtestingOptionChainProvider.GetOptionContractList(Symbol.Create("TWX", SecurityType.Equity, Market.USA), date) .ToList(); Assert.AreEqual(184, twxOptionChain.Count); @@ -82,8 +78,7 @@ public void BacktestingOptionChainProviderUsesPreviousTradableDateChain() [Test] public void BacktestingOptionChainProviderLoadsEquityOptionChain() { - var provider = new BacktestingOptionChainProvider(TestGlobals.DataCacheProvider, TestGlobals.MapFileProvider); - var twxOptionChain = provider.GetOptionContractList(Symbol.Create("TWX", SecurityType.Equity, Market.USA), new DateTime(2014, 6, 5)) + var twxOptionChain = _backtestingOptionChainProvider.GetOptionContractList(Symbol.Create("TWX", SecurityType.Equity, Market.USA), new DateTime(2014, 6, 5)) .ToList(); Assert.AreEqual(184, twxOptionChain.Count); @@ -94,8 +89,7 @@ public void BacktestingOptionChainProviderLoadsEquityOptionChain() [Test] public void BacktestingOptionChainProviderLoadsFutureOptionChain() { - var provider = new BacktestingOptionChainProvider(TestGlobals.DataCacheProvider, TestGlobals.MapFileProvider); - var esOptionChain = provider.GetOptionContractList( + var esOptionChain = _backtestingOptionChainProvider.GetOptionContractList( Symbol.CreateFuture( QuantConnect.Securities.Futures.Indices.SP500EMini, Market.CME, @@ -114,9 +108,7 @@ public void BacktestingOptionChainProviderIndexOption() var spxOption = Symbol.CreateCanonicalOption(Symbols.SPX); foreach (var option in new [] { Symbols.SPX, spxOption }) { - var provider = new BacktestingOptionChainProvider(TestGlobals.DataCacheProvider, TestGlobals.MapFileProvider); - - var optionChain = provider.GetOptionContractList(option, new DateTime(2021, 01, 04)).ToList(); + var optionChain = _backtestingOptionChainProvider.GetOptionContractList(option, new DateTime(2021, 01, 04)).ToList(); Assert.AreEqual(6, optionChain.Count); Assert.AreEqual(3200, optionChain.OrderBy(s => s.ID.StrikePrice).First().ID.StrikePrice); @@ -136,9 +128,7 @@ public void BacktestingOptionChainProviderWeeklyIndexOption() var spxWeeklyOption = Symbol.CreateCanonicalOption(Symbols.SPX, "SPXW", null, null); foreach (var option in new[] { spxWeeklyOption }) { - var provider = new BacktestingOptionChainProvider(TestGlobals.DataCacheProvider, TestGlobals.MapFileProvider); - - var optionChain = provider.GetOptionContractList(option, new DateTime(2021, 01, 04)).ToList(); + var optionChain = _backtestingOptionChainProvider.GetOptionContractList(option, new DateTime(2021, 01, 04)).ToList(); Assert.AreEqual(12, optionChain.Count); Assert.AreEqual(3700, optionChain.OrderBy(s => s.ID.StrikePrice).First().ID.StrikePrice); @@ -156,8 +146,6 @@ public void BacktestingOptionChainProviderWeeklyIndexOption() public void BacktestingOptionChainProviderResolvesSymbolMapping() { var ticker = "GOOCV"; // Old ticker, should resolve and fetch GOOG - var provider = new BacktestingOptionChainProvider(TestGlobals.DataCacheProvider, TestGlobals.MapFileProvider); - var underlyingSymbol = QuantConnect.Symbol.Create(ticker, SecurityType.Equity, Market.USA); var alias = "?" + underlyingSymbol.Value; var optionSymbol = Symbol.CreateOption( @@ -169,7 +157,7 @@ public void BacktestingOptionChainProviderResolvesSymbolMapping() SecurityIdentifier.DefaultDate, alias); - var googOptionChain = provider.GetOptionContractList(optionSymbol.Underlying, new DateTime(2015, 12, 23)) + var googOptionChain = _backtestingOptionChainProvider.GetOptionContractList(optionSymbol.Underlying, new DateTime(2015, 12, 23)) .ToList(); Assert.AreEqual(118, googOptionChain.Count); @@ -207,14 +195,12 @@ public void CachingProviderCachesSymbolsByDate() [Test] public void LiveOptionChainProviderReturnsData() { - var provider = new LiveOptionChainProvider(TestGlobals.DataCacheProvider, TestGlobals.MapFileProvider); - var spxOption = Symbol.CreateCanonicalOption(Symbols.SPX); var spxwOption = Symbol.CreateCanonicalOption(Symbols.SPX, "SPXW", null, null); foreach (var symbol in new[] { Symbols.SPY, Symbols.AAPL, Symbols.MSFT, Symbols.SPX, spxOption, spxwOption }) { - var result = provider.GetOptionContractList(symbol, DateTime.Today).ToList(); + var result = _liveOptionChainProvider.GetOptionContractList(symbol, DateTime.Today).ToList(); var countCall = result.Count(x => x.ID.OptionRight == OptionRight.Call); var countPut = result.Count(x => x.ID.OptionRight == OptionRight.Put); @@ -240,8 +226,7 @@ public void LiveOptionChainProviderReturnsNoDataForInvalidSymbol() { var symbol = Symbol.Create("ABCDEF123", SecurityType.Equity, Market.USA); - var provider = new LiveOptionChainProvider(TestGlobals.DataCacheProvider, TestGlobals.MapFileProvider); - var result = provider.GetOptionContractList(symbol, DateTime.Today); + var result = _liveOptionChainProvider.GetOptionContractList(symbol, DateTime.Today); Assert.IsFalse(result.Any()); } @@ -265,8 +250,7 @@ public void LiveOptionChainProviderReturnsFutureOptionData() } var underlyingFuture = Symbol.CreateFuture("ES", Market.CME, expiry); - var provider = new LiveOptionChainProvider(TestGlobals.DataCacheProvider, TestGlobals.MapFileProvider); - var result = provider.GetOptionContractList(underlyingFuture, now).ToList(); + var result = _liveOptionChainProvider.GetOptionContractList(underlyingFuture, now).ToList(); Assert.AreNotEqual(0, result.Count); @@ -287,8 +271,7 @@ public void LiveOptionChainProviderReturnsNoDataForOldFuture() var december = now.AddMonths(-now.Month).AddYears(-1); var underlyingFuture = Symbol.CreateFuture("ES", Market.CME, december); - var provider = new LiveOptionChainProvider(TestGlobals.DataCacheProvider, TestGlobals.MapFileProvider); - var result = provider.GetOptionContractList(underlyingFuture, december); + var result = _liveOptionChainProvider.GetOptionContractList(underlyingFuture, december); Assert.AreEqual(0, result.Count()); } @@ -314,8 +297,7 @@ public void BacktestingOptionChainProviderReturnsMultipleContractsForZipFileCont strike, expiry); - var provider = new BacktestingOptionChainProvider(TestGlobals.DataCacheProvider, TestGlobals.MapFileProvider); - var contracts = provider.GetOptionContractList(underlying, new DateTime(2020, 1, 5)) + var contracts = _backtestingOptionChainProvider.GetOptionContractList(underlying, new DateTime(2020, 1, 5)) .ToHashSet(); Assert.IsTrue( diff --git a/Tests/Common/Securities/Options/OptionFilterUniverseTests.cs b/Tests/Common/Securities/Options/OptionFilterUniverseTests.cs index d367deb03aea..b2669f09349b 100644 --- a/Tests/Common/Securities/Options/OptionFilterUniverseTests.cs +++ b/Tests/Common/Securities/Options/OptionFilterUniverseTests.cs @@ -18,6 +18,7 @@ using QuantConnect.Data.Market; using QuantConnect.Data.UniverseSelection; using QuantConnect.Securities; +using QuantConnect.Securities.Option; using System; using System.Collections.Generic; using System.IO; @@ -99,7 +100,7 @@ public void FiltersContractsByImpliedVolatility() var expectedContracts = 11; // Set up - var universe = new OptionFilterUniverse(null, _testOptionsData, _underlying); + var universe = new OptionFilterUniverse(GetOption(), _testOptionsData, _underlying); universe.Refresh(_testOptionsData, _underlying, _underlying.EndTime); // Filter @@ -122,7 +123,7 @@ public void FiltersContractsByOpenInterest() var expectedContracts = 2; // Set up - var universe = new OptionFilterUniverse(null, _testOptionsData, _underlying); + var universe = new OptionFilterUniverse(GetOption(), _testOptionsData, _underlying); universe.Refresh(_testOptionsData, _underlying, _underlying.EndTime); // Filter @@ -145,7 +146,7 @@ public void FiltersContractsByOpenInterest() public void FiltersContractsByIndividualGreek(string greekName, decimal greekMinValue, decimal greekMaxValue, int expectedContracts) { // Set up - var universe = new OptionFilterUniverse(null, _testOptionsData, _underlying); + var universe = new OptionFilterUniverse(GetOption(), _testOptionsData, _underlying); universe.Refresh(_testOptionsData, _underlying, _underlying.EndTime); // Filter @@ -174,7 +175,7 @@ public void FiltersContractsByMultipleGreeks() var expectedContracts = 11; // Set up - var universe = new OptionFilterUniverse(null, _testOptionsData, _underlying); + var universe = new OptionFilterUniverse(GetOption(), _testOptionsData, _underlying); universe.Refresh(_testOptionsData, _underlying, _underlying.EndTime); // Filter @@ -191,6 +192,59 @@ public void FiltersContractsByMultipleGreeks() })); } + [Test] + public void OptionUnivereDataFiltersAreNotSupportedForFutureOptions() + { + // Set up + var symbol = Symbols.CreateFutureOptionSymbol(Symbols.ES_Future_Chain, OptionRight.Call, + 1000m, new DateTime(2024, 12, 27)); + var option = new Option( + SecurityExchangeHours.AlwaysOpen(TimeZones.NewYork), + new SubscriptionDataConfig(typeof(TradeBar), symbol, Resolution.Minute, + TimeZones.NewYork, TimeZones.NewYork, true, false, false), + new Cash(Currencies.USD, 0, 1m), + new OptionSymbolProperties(SymbolProperties.GetDefault(Currencies.USD)), + ErrorCurrencyConverter.Instance, + RegisteredSecurityDataTypesProvider.Null + ); + var universe = new OptionFilterUniverse(option, _testOptionsData, _underlying); + + // Filter and assert + Assert.Multiple(() => + { + Assert.Throws(() => universe.ImpliedVolatility(0m, 1m)); + Assert.Throws(() => universe.IV(0m, 1m)); + Assert.Throws(() => universe.OpenInterest(0, 1)); + Assert.Throws(() => universe.OI(0, 1)); + Assert.Throws(() => universe.Delta(0m, 1m)); + Assert.Throws(() => universe.D(0m, 1m)); + Assert.Throws(() => universe.Gamma(0m, 1m)); + Assert.Throws(() => universe.G(0m, 1m)); + Assert.Throws(() => universe.Vega(0m, 1m)); + Assert.Throws(() => universe.V(0m, 1m)); + Assert.Throws(() => universe.Theta(0m, 1m)); + Assert.Throws(() => universe.T(0m, 1m)); + Assert.Throws(() => universe.Rho(0m, 1m)); + Assert.Throws(() => universe.R(0m, 1m)); + }); + } + + private static Option GetOption(Symbol symbol = null) + { + symbol ??= Symbols.SPY_C_192_Feb19_2016; + var option = new Option( + SecurityExchangeHours.AlwaysOpen(TimeZones.NewYork), + new SubscriptionDataConfig(typeof(TradeBar), symbol, Resolution.Minute, + TimeZones.NewYork, TimeZones.NewYork, true, false, false), + new Cash(Currencies.USD, 0, 1m), + new OptionSymbolProperties(SymbolProperties.GetDefault(Currencies.USD)), + ErrorCurrencyConverter.Instance, + RegisteredSecurityDataTypesProvider.Null + ); + + return option; + } + private OptionUniverse GetContractData(Symbol contract) { return _testOptionsData.Single(x => x.Symbol == contract); diff --git a/Tests/Common/Securities/SecurityIdentifierTests.cs b/Tests/Common/Securities/SecurityIdentifierTests.cs index 954f23b2244a..e894f3684d70 100644 --- a/Tests/Common/Securities/SecurityIdentifierTests.cs +++ b/Tests/Common/Securities/SecurityIdentifierTests.cs @@ -559,7 +559,8 @@ public void HighPrecisionNumberThrows(double strike) [Test, Ignore("Requires complete option data to validate chain")] public void ValidateAAPLOptionChainSecurityIdentifiers() { - var chainProvider = new BacktestingOptionChainProvider(TestGlobals.DataCacheProvider, TestGlobals.MapFileProvider); + var chainProvider = new BacktestingOptionChainProvider(); + chainProvider.Initialize(new(TestGlobals.MapFileProvider, TestGlobals.HistoryProvider)); var aapl = Symbol.Create("AAPL", SecurityType.Equity, Market.USA); var chains = new HashSet(); var expectedChains = File.ReadAllLines("TestData/aapl_chain.csv") diff --git a/Tests/Common/Securities/SecurityServiceTests.cs b/Tests/Common/Securities/SecurityServiceTests.cs index 484dcb06669d..8b17a27f4452 100644 --- a/Tests/Common/Securities/SecurityServiceTests.cs +++ b/Tests/Common/Securities/SecurityServiceTests.cs @@ -22,6 +22,7 @@ using QuantConnect.Data; using QuantConnect.Data.Auxiliary; using QuantConnect.Data.Market; +using QuantConnect.Data.UniverseSelection; using QuantConnect.Interfaces; using QuantConnect.Securities; using QuantConnect.Tests.Engine.DataFeeds; @@ -66,11 +67,11 @@ public void CanCreate_CanonicalOption_WithCorrectSubscriptions() { var optionSymbol = Symbol.Create("GOOG", SecurityType.Option, Market.USA); - var configs = _subscriptionManager.SubscriptionDataConfigService.Add(typeof(ZipEntryName), optionSymbol, Resolution.Minute, false, false, false); + var configs = _subscriptionManager.SubscriptionDataConfigService.Add(typeof(OptionUniverse), optionSymbol, Resolution.Minute, false, false, false); var option = _securityService.CreateSecurity(optionSymbol, configs, 1.0m, false); Assert.AreEqual(option.Subscriptions.Count(), 1); - Assert.AreEqual(option.Subscriptions.First().Type, typeof(ZipEntryName)); + Assert.AreEqual(option.Subscriptions.First().Type, typeof(OptionUniverse)); Assert.AreEqual(option.Subscriptions.First().TickType, TickType.Quote); } @@ -191,19 +192,19 @@ public void CannotCreateSecurityWhenBaseCurrencyNotFound(string ticker, Security var configs = _subscriptionManager.SubscriptionDataConfigService.Add(symbol, Resolution.Second, false, false, false, false, false, subscriptionTypes); Assert.Throws(() => _securityService.CreateSecurity(symbol, configs, 1.0m, false)); } - + [Test] public void CreatesEquityOptionWithContractMultiplierEqualsToContractUnitOfTrade() { var underlying = Symbol.Create("TWX", SecurityType.Equity, Market.USA); var equityOption = Symbol.CreateOption( - underlying, - Market.USA, - OptionStyle.American, - OptionRight.Call, + underlying, + Market.USA, + OptionStyle.American, + OptionRight.Call, 320m, new DateTime(2020, 12, 18)); - + var subscriptionTypes = new List> { new Tuple(typeof(TradeBar), TickType.Trade), @@ -213,7 +214,7 @@ public void CreatesEquityOptionWithContractMultiplierEqualsToContractUnitOfTrade var configs = _subscriptionManager.SubscriptionDataConfigService.Add(equityOption, Resolution.Minute, true, false, false, false, false, subscriptionTypes); var equityOptionSecurity = (QuantConnect.Securities.Option.Option)_securityService.CreateSecurity(equityOption, configs, 1.0m); - + Assert.AreEqual(100, equityOptionSecurity.ContractMultiplier); Assert.AreEqual(100,equityOptionSecurity.ContractUnitOfTrade); } @@ -227,13 +228,13 @@ public void CreatesFutureOptionWithContractMultiplierEqualsToFutureContractMulti new DateTime(2020, 12, 18)); var futureOption = Symbol.CreateOption( - underlying, - Market.CME, - OptionStyle.American, - OptionRight.Call, + underlying, + Market.CME, + OptionStyle.American, + OptionRight.Call, 3250m, new DateTime(2020, 12, 18)); - + var subscriptionTypes = new List> { new Tuple(typeof(TradeBar), TickType.Trade), @@ -243,7 +244,7 @@ public void CreatesFutureOptionWithContractMultiplierEqualsToFutureContractMulti var configs = _subscriptionManager.SubscriptionDataConfigService.Add(futureOption, Resolution.Minute, true, false, false, false, false, subscriptionTypes); var futureOptionSecurity = (QuantConnect.Securities.Option.Option)_securityService.CreateSecurity(futureOption, configs, 1.0m); - + Assert.AreEqual(50, futureOptionSecurity.ContractMultiplier); Assert.AreEqual(1, futureOptionSecurity.ContractUnitOfTrade); } @@ -262,11 +263,11 @@ public void AddPrimaryExchangeToSecurityObject() SymbolPropertiesDatabase.FromDataFolder(), algorithm, new RegisteredSecurityDataTypesProvider(), - new SecurityCacheProvider(algorithm.Portfolio), + new SecurityCacheProvider(algorithm.Portfolio), mockedPrimaryExchangeProvider.Object); var configs = _subscriptionManager.SubscriptionDataConfigService.Add(typeof(TradeBar), equitySymbol, Resolution.Second, false, false, false); - + // Act var equity = securityService.CreateSecurity(equitySymbol, configs, 1.0m, false); diff --git a/Tests/Common/SymbolRepresentationTests.cs b/Tests/Common/SymbolRepresentationTests.cs index 7ac25ee5acc4..29083f4b95f0 100644 --- a/Tests/Common/SymbolRepresentationTests.cs +++ b/Tests/Common/SymbolRepresentationTests.cs @@ -49,6 +49,8 @@ public void OptionSymbolAliasMatchesOSI() [TestCase("CSCO 230501P00045000", SecurityType.Option, OptionStyle.American, "CSCO", "CSCO", "CSCO", 45.00, "2023-05-01")] [TestCase("DAX 250715C01000000", SecurityType.IndexOption, OptionStyle.European, "DAX", "DAX", "DAX", 1000.00, "2025-07-15")] [TestCase("FTSE 230122C00750000", SecurityType.IndexOption, OptionStyle.European, "FTSE", "FTSE", "FTSE", 750.00, "2023-01-22")] + [TestCase("DC01H12 120401C00015500", SecurityType.FutureOption, OptionStyle.American, "DC01H12", "DC", "DC01H12", 15.5, "2012-04-01")] + [TestCase("ES20H20 200320P03290000", SecurityType.FutureOption, OptionStyle.American, "ES20H20", "ES", "ES20H20", 3290.00, "2020-03-20")] public void ParseOptionTickerOSI(string optionStr, SecurityType securityType, OptionStyle optionStyle, string expectedTargetOptionTicker, string expectedUnderlyingTicker, string expectedUnderlyingMappedTicker, decimal expectedStrikePrice, string expectedDate) diff --git a/Tests/Engine/DataFeeds/BacktestingFutureChainProviderTests.cs b/Tests/Engine/DataFeeds/BacktestingFutureChainProviderTests.cs index d2ef59eadcf7..3c8b876b6850 100644 --- a/Tests/Engine/DataFeeds/BacktestingFutureChainProviderTests.cs +++ b/Tests/Engine/DataFeeds/BacktestingFutureChainProviderTests.cs @@ -1,11 +1,11 @@ /* * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); + * + * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -13,12 +13,12 @@ * limitations under the License. */ -using System; using System.Linq; using NUnit.Framework; using QuantConnect.Lean.Engine.DataFeeds; using QuantConnect.Logging; using QuantConnect.Securities; +using QuantConnect.Util; namespace QuantConnect.Tests.Engine.DataFeeds { @@ -33,7 +33,8 @@ public void SetUp() { // Store initial Log Handler _logHandler = Log.LogHandler; - _provider = new BacktestingFutureChainProvider(TestGlobals.DataCacheProvider); + _provider = new BacktestingFutureChainProvider(); + _provider.Initialize(new(TestGlobals.MapFileProvider, TestGlobals.HistoryProvider)); } [OneTimeTearDown] @@ -55,22 +56,6 @@ public void CorrectlyDeterminesContractList(string date) Assert.IsNotEmpty(result); } - [Test] - public void ChecksBothOpenInterestAndQuoteFiles() - { - var testHandler = new QueueLogHandler(); - Log.LogHandler = testHandler; - var originalValue = Log.DebuggingEnabled; - Log.DebuggingEnabled = true; - var symbol = Symbol.CreateFuture("NonExisting", Market.USA, new DateTime(2013, 11, 11)); - var result = _provider.GetFutureContractList(symbol, new DateTime(2013, 10, 11)).ToList(); - - Log.DebuggingEnabled = originalValue; - Assert.IsTrue(testHandler.Logs.Any(entry => - entry.Message.Contains("found no source of contracts for NONEXISTING 2X for date 20131011 for any tick type", StringComparison.InvariantCultureIgnoreCase))); - Assert.IsEmpty(result); - } - [TestCase("20201007", 2)] [TestCase("20131007", 5)] public void UsesMultipleResolutions(string strDate, int expectedCount) diff --git a/Tests/Engine/DataFeeds/Enumerators/DataQueueFuturesChainUniverseDataCollectionEnumeratorTests.cs b/Tests/Engine/DataFeeds/Enumerators/DataQueueFuturesChainUniverseDataCollectionEnumeratorTests.cs deleted file mode 100644 index 01aa0f9d0610..000000000000 --- a/Tests/Engine/DataFeeds/Enumerators/DataQueueFuturesChainUniverseDataCollectionEnumeratorTests.cs +++ /dev/null @@ -1,153 +0,0 @@ -/* - * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. - * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * -*/ - -using System; -using NUnit.Framework; -using QuantConnect.Data; -using QuantConnect.Interfaces; -using QuantConnect.Securities; -using System.Collections.Generic; -using QuantConnect.Data.Auxiliary; -using QuantConnect.Lean.Engine.DataFeeds; -using QuantConnect.Data.UniverseSelection; -using QuantConnect.Lean.Engine.DataFeeds.Enumerators; - -namespace QuantConnect.Tests.Engine.DataFeeds.Enumerators -{ - [TestFixture, Parallelizable(ParallelScope.All)] - public class DataQueueFuturesChainUniverseDataCollectionEnumeratorTests - { - [TestCase(Resolution.Tick, "20181017 05:00", 5)] - [TestCase(Resolution.Second, "20181017 05:00", 5)] - [TestCase(Resolution.Minute, "20181017 05:00", 5)] - [TestCase(Resolution.Hour, "20181017 05:00", 5)] - [TestCase(Resolution.Daily, "20181017 05:00", 5)] - - [TestCase(Resolution.Tick, "20181017 10:00", 10)] - [TestCase(Resolution.Second, "20181017 10:00", 10)] - [TestCase(Resolution.Minute, "20181017 10:00", 10)] - [TestCase(Resolution.Hour, "20181017 10:00", 10)] - [TestCase(Resolution.Daily, "20181017 10:00", 10)] - public void RefreshesFutureChainUniverseOnDateChange(Resolution resolution, string dateTime, int expectedStartHour) - { - var startTime = Time.ParseDate(dateTime); - Assert.AreEqual(expectedStartHour, startTime.Hour); - var timeProvider = new ManualTimeProvider(startTime); - - var symbolUniverse = new TestDataQueueUniverseProvider(timeProvider); - - var canonicalSymbol = Symbol.Create(Futures.Indices.VIX, SecurityType.Future, Market.CFE, "/VX"); - - var request = GetRequest(canonicalSymbol, startTime, resolution); - var enumerator = new DataQueueFuturesChainUniverseDataCollectionEnumerator(request, symbolUniverse, timeProvider); - - Assert.IsTrue(enumerator.MoveNext()); - Assert.IsNotNull(enumerator.Current); - Assert.AreEqual(1, symbolUniverse.TotalLookupCalls); - var data = enumerator.Current; - Assert.IsNotNull(data); - Assert.AreEqual(1, data.Data.Count); - - timeProvider.Advance(Time.OneSecond); - - Assert.IsTrue(enumerator.MoveNext()); - Assert.IsNull(enumerator.Current); - Assert.AreEqual(1, symbolUniverse.TotalLookupCalls); - - timeProvider.Advance(Time.OneMinute); - - Assert.IsTrue(enumerator.MoveNext()); - Assert.IsNull(enumerator.Current); - Assert.AreEqual(1, symbolUniverse.TotalLookupCalls); - - timeProvider.Advance(Time.OneDay); - - Assert.IsTrue(enumerator.MoveNext()); - Assert.IsNotNull(enumerator.Current); - Assert.AreEqual(2, symbolUniverse.TotalLookupCalls); - data = enumerator.Current; - Assert.IsNotNull(data); - Assert.AreEqual(2, data.Data.Count); - - timeProvider.Advance(Time.OneMinute); - - Assert.IsTrue(enumerator.MoveNext()); - Assert.IsNull(enumerator.Current); - Assert.AreEqual(2, symbolUniverse.TotalLookupCalls); - - enumerator.Dispose(); - request.Universe.Dispose(); - } - - private static SubscriptionRequest GetRequest(Symbol canonicalSymbol, DateTime startTime, Resolution resolution) - { - var entry = MarketHoursDatabase.FromDataFolder().GetEntry(canonicalSymbol.ID.Market, canonicalSymbol, canonicalSymbol.SecurityType); - var config = new SubscriptionDataConfig( - typeof(ZipEntryName), - canonicalSymbol, - resolution, - entry.DataTimeZone, - entry.ExchangeHours.TimeZone, - true, - false, - false, - false, - TickType.Quote, - false, - DataNormalizationMode.Raw - ); - - var algo = new AlgorithmStub(); - var future = algo.AddFuture(canonicalSymbol.Value); - - var universeSettings = new UniverseSettings(resolution, 0, true, false, TimeSpan.Zero); -#pragma warning disable CA2000 - var universe = new FuturesChainUniverse(future, universeSettings); -#pragma warning restore CA2000 - return new SubscriptionRequest(true, universe, future, config, startTime, Time.EndOfTime); - } - - private class TestDataQueueUniverseProvider : IDataQueueUniverseProvider - { - private readonly Symbol[] _symbolList1 = - { - Symbol.CreateFuture(Futures.Indices.VIX, Market.CFE, new DateTime(2018, 10, 31)) - }; - private readonly Symbol[] _symbolList2 = - { - Symbol.CreateFuture(Futures.Indices.VIX, Market.CFE, new DateTime(2018, 10, 31)), - Symbol.CreateFuture(Futures.Indices.VIX, Market.CFE, new DateTime(2018, 11, 30)), - }; - - private readonly ITimeProvider _timeProvider; - - public int TotalLookupCalls { get; set; } - - public TestDataQueueUniverseProvider(ITimeProvider timeProvider) - { - _timeProvider = timeProvider; - } - - public IEnumerable LookupSymbols(Symbol symbol, bool includeExpired, string securityCurrency = null) - { - TotalLookupCalls++; - return _timeProvider.GetUtcNow().Date.Day >= 18 ? _symbolList2 : _symbolList1; - } - - public bool CanPerformSelection() => true; - } - } -} diff --git a/Tests/Engine/DataFeeds/Enumerators/DataQueueOptionChainUniverseDataCollectionEnumeratorTests.cs b/Tests/Engine/DataFeeds/Enumerators/DataQueueOptionChainUniverseDataCollectionEnumeratorTests.cs deleted file mode 100644 index 0402a7ec8a25..000000000000 --- a/Tests/Engine/DataFeeds/Enumerators/DataQueueOptionChainUniverseDataCollectionEnumeratorTests.cs +++ /dev/null @@ -1,198 +0,0 @@ -/* - * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. - * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * -*/ - -using System; -using System.Linq; -using NUnit.Framework; -using QuantConnect.Data; -using QuantConnect.Interfaces; -using QuantConnect.Securities; -using QuantConnect.Data.Market; -using System.Collections.Generic; -using QuantConnect.Data.Auxiliary; -using QuantConnect.Securities.Option; -using QuantConnect.Lean.Engine.DataFeeds; -using QuantConnect.Data.UniverseSelection; -using QuantConnect.Lean.Engine.DataFeeds.Enumerators; - -namespace QuantConnect.Tests.Engine.DataFeeds.Enumerators -{ - [TestFixture, Parallelizable(ParallelScope.All)] - public class DataQueueOptionChainUniverseDataCollectionEnumeratorTests - { - [TestCase(Resolution.Tick)] - [TestCase(Resolution.Second)] - [TestCase(Resolution.Minute)] - [TestCase(Resolution.Hour)] - [TestCase(Resolution.Daily)] - public void NullUnderlying(Resolution resolution) - { - var startTime = new DateTime(2018, 10, 17, 5, 0, 0); - var timeProvider = new ManualTimeProvider(startTime); - - var symbolUniverse = new TestDataQueueUniverseProvider(timeProvider); - - var canonicalSymbol = Symbols.SPY_Option_Chain; - var request = GetRequest(canonicalSymbol, startTime, resolution); - using var underlying = new EnqueueableEnumerator(); - using var enumerator = new DataQueueOptionChainUniverseDataCollectionEnumerator(request, underlying, symbolUniverse, timeProvider); - - Assert.IsTrue(enumerator.MoveNext()); - Assert.IsNull(enumerator.Current); - - request.Universe.Dispose(); - } - - [TestCase(Resolution.Tick, "20181017 05:00", 5)] - [TestCase(Resolution.Second, "20181017 05:00", 5)] - [TestCase(Resolution.Minute, "20181017 05:00", 5)] - [TestCase(Resolution.Hour, "20181017 05:00", 5)] - [TestCase(Resolution.Daily, "20181017 05:00", 5)] - - [TestCase(Resolution.Tick, "20181017 10:00", 10)] - [TestCase(Resolution.Second, "20181017 10:00", 10)] - [TestCase(Resolution.Minute, "20181017 10:00", 10)] - [TestCase(Resolution.Hour, "20181017 10:00", 10)] - [TestCase(Resolution.Daily, "20181017 10:00", 10)] - public void RefreshesUniverseChainOnDateChange(Resolution resolution, string dateTime, int expectedStartHour) - { - var startTime = Time.ParseDate(dateTime); - Assert.AreEqual(expectedStartHour, startTime.Hour); - var timeProvider = new ManualTimeProvider(startTime); - - var symbolUniverse = new TestDataQueueUniverseProvider(timeProvider); - - var canonicalSymbol = Symbols.SPY_Option_Chain; - var request = GetRequest(canonicalSymbol, startTime, resolution); - var underlyingSymbol = (request.Security as Option).Underlying.Symbol; - using var underlying = new EnqueueableEnumerator(); - using var enumerator = new DataQueueOptionChainUniverseDataCollectionEnumerator(request, underlying, symbolUniverse, timeProvider); - - underlying.Enqueue(new Tick(timeProvider.GetUtcNow().ConvertFromUtc(request.Security.Exchange.TimeZone), underlyingSymbol, 9, 10)); - Assert.IsTrue(enumerator.MoveNext()); - Assert.IsNotNull(enumerator.Current); - Assert.AreEqual(1, symbolUniverse.TotalLookupCalls); - var data = enumerator.Current; - Assert.IsNotNull(data); - Assert.AreEqual(1, data.Data.Count); - Assert.IsFalse(enumerator.Current.IsFillForward); - - timeProvider.Advance(Time.OneSecond); - underlying.Enqueue(new Tick(timeProvider.GetUtcNow().ConvertFromUtc(request.Security.Exchange.TimeZone), underlyingSymbol, 9, 10)); - - Assert.IsTrue(enumerator.MoveNext()); - Assert.IsNotNull(enumerator.Current); - Assert.AreEqual(1, symbolUniverse.TotalLookupCalls); - // fill forwarding the chain selection, but time should advance - Assert.AreEqual(data.Data.Single().Symbol, enumerator.Current.Data.Single().Symbol); - Assert.IsTrue(enumerator.Current.EndTime > data.EndTime); - Assert.IsTrue(enumerator.Current.IsFillForward); - data = enumerator.Current; - - timeProvider.Advance(Time.OneMinute); - underlying.Enqueue(new Tick(timeProvider.GetUtcNow().ConvertFromUtc(request.Security.Exchange.TimeZone), underlyingSymbol, 9, 10)); - - Assert.IsTrue(enumerator.MoveNext()); - Assert.IsNotNull(enumerator.Current); - Assert.AreEqual(1, symbolUniverse.TotalLookupCalls); - // fill forwarding the chain selection, but time should advance - Assert.AreEqual(data.Data.Single().Symbol, enumerator.Current.Data.Single().Symbol); - Assert.IsTrue(enumerator.Current.EndTime > data.EndTime); - Assert.IsTrue(enumerator.Current.IsFillForward); - data = enumerator.Current; - - timeProvider.Advance(Time.OneDay); - underlying.Enqueue(new Tick(timeProvider.GetUtcNow().ConvertFromUtc(request.Security.Exchange.TimeZone), underlyingSymbol, 9, 10)); - - Assert.IsTrue(enumerator.MoveNext()); - Assert.IsNotNull(enumerator.Current); - // selection should of have changed - Assert.AreNotEqual(data.Data.Single().Symbol, enumerator.Current.Data.Single().Symbol); - Assert.IsTrue(enumerator.Current.EndTime > data.EndTime); - Assert.IsFalse(enumerator.Current.IsFillForward); - data = enumerator.Current; - Assert.AreEqual(2, symbolUniverse.TotalLookupCalls); - data = enumerator.Current; - Assert.IsNotNull(data); - Assert.AreEqual(1, data.Data.Count); - - timeProvider.Advance(Time.OneMinute); - underlying.Enqueue(new Tick(timeProvider.GetUtcNow().ConvertFromUtc(request.Security.Exchange.TimeZone), underlyingSymbol, 9, 10)); - - Assert.IsTrue(enumerator.MoveNext()); - Assert.AreEqual(2, symbolUniverse.TotalLookupCalls); - // fill forwarding the chain selection, but time should advance - Assert.AreEqual(data.Data.Single().Symbol, enumerator.Current.Data.Single().Symbol); - Assert.IsTrue(enumerator.Current.EndTime > data.EndTime); - Assert.IsTrue(enumerator.Current.IsFillForward); - - enumerator.Dispose(); - request.Universe.Dispose(); - } - - private static SubscriptionRequest GetRequest(Symbol canonicalSymbol, DateTime startTime, Resolution resolution) - { - var entry = MarketHoursDatabase.FromDataFolder().GetEntry(canonicalSymbol.ID.Market, canonicalSymbol, canonicalSymbol.SecurityType); - var config = new SubscriptionDataConfig( - typeof(ZipEntryName), - canonicalSymbol, - resolution, - entry.DataTimeZone, - entry.ExchangeHours.TimeZone, - true, - false, - false, - false, - TickType.Quote, - false, - DataNormalizationMode.Raw - ); - - var algo = new AlgorithmStub(); - var underlying = algo.AddEquity("SPY"); - var option = algo.AddOption(underlying.Symbol); - option.Underlying = underlying; - - var universeSettings = new UniverseSettings(resolution, 0, true, false, TimeSpan.Zero); -# pragma warning disable CA2000 - var universe = new OptionChainUniverse(option, universeSettings); -#pragma warning restore CA2000 - return new SubscriptionRequest(true, universe, option, config, startTime, Time.EndOfTime); - } - - private class TestDataQueueUniverseProvider : IDataQueueUniverseProvider - { - private readonly Symbol[] _symbolList1 = { Symbols.SPY_C_192_Feb19_2016 }; - private readonly Symbol[] _symbolList2 = { Symbols.SPY_P_192_Feb19_2016 }; - private readonly ITimeProvider _timeProvider; - - public int TotalLookupCalls { get; set; } - - public TestDataQueueUniverseProvider(ITimeProvider timeProvider) - { - _timeProvider = timeProvider; - } - - public IEnumerable LookupSymbols(Symbol symbol, bool includeExpired, string securityCurrency = null) - { - TotalLookupCalls++; - return _timeProvider.GetUtcNow().Date.Day >= 18 ? _symbolList2 : _symbolList1; - } - - public bool CanPerformSelection() => true; - } - } -} diff --git a/Tests/Engine/DataFeeds/Enumerators/Factories/BaseDataSubscriptionEnumeratorFactoryTests.cs b/Tests/Engine/DataFeeds/Enumerators/Factories/BaseDataSubscriptionEnumeratorFactoryTests.cs deleted file mode 100644 index 5452c9609f11..000000000000 --- a/Tests/Engine/DataFeeds/Enumerators/Factories/BaseDataSubscriptionEnumeratorFactoryTests.cs +++ /dev/null @@ -1,77 +0,0 @@ -/* - * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. - * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * -*/ - -using System; -using NUnit.Framework; -using QuantConnect.Data; -using QuantConnect.Data.Market; -using QuantConnect.Data.UniverseSelection; -using QuantConnect.Lean.Engine.DataFeeds; -using QuantConnect.Lean.Engine.DataFeeds.Enumerators.Factories; -using QuantConnect.Logging; -using QuantConnect.Securities; - -namespace QuantConnect.Tests.Engine.DataFeeds.Enumerators.Factories -{ - [TestFixture] - public class BaseDataSubscriptionEnumeratorFactoryTests - { - // This test reports higher memory usage when ran with Travis, so we exclude it for now - [Test, Category("TravisExclude")] - public void DoesNotLeakMemory() - { - var symbol = Symbols.SPY_Option_Chain; - var config = new SubscriptionDataConfig(typeof(TradeBar), symbol, Resolution.Daily, TimeZones.NewYork, TimeZones.NewYork, false, false, false, false, TickType.Trade, false); - var security = new Security( - SecurityExchangeHours.AlwaysOpen(TimeZones.NewYork), - config, - new Cash(Currencies.USD, 0, 1), - SymbolProperties.GetDefault(Currencies.USD), - ErrorCurrencyConverter.Instance, - RegisteredSecurityDataTypesProvider.Null, - new SecurityCache() - ); - - var fileProvider = TestGlobals.DataProvider; - var cache = TestGlobals.DataCacheProvider; - var factory = new BaseDataSubscriptionEnumeratorFactory(new BacktestingOptionChainProvider(cache, TestGlobals.MapFileProvider), new BacktestingFutureChainProvider(cache)); - - GC.Collect(); - var ramUsageBeforeLoop = OS.TotalPhysicalMemoryUsed; - - var date = new DateTime(1998, 1, 1); - - const int iterations = 1000; - for (var i = 0; i < iterations; i++) - { - var request = new SubscriptionRequest(false, null, security, config, date, date); - using (var enumerator = factory.CreateEnumerator(request, fileProvider)) - { - enumerator.MoveNext(); - } - date = date.AddDays(1); - } - - GC.Collect(); - var ramUsageAfterLoop = OS.TotalPhysicalMemoryUsed; - - Log.Trace($"RAM usage - before: {ramUsageBeforeLoop} MB, after: {ramUsageAfterLoop} MB"); - - Assert.IsTrue(ramUsageAfterLoop - ramUsageBeforeLoop < 10); - } - - } -} diff --git a/Tests/Engine/DataFeeds/Enumerators/Factories/OptionChainUniverseSubscriptionEnumeratorFactoryTests.cs b/Tests/Engine/DataFeeds/Enumerators/Factories/OptionChainUniverseSubscriptionEnumeratorFactoryTests.cs deleted file mode 100644 index c994e55dd676..000000000000 --- a/Tests/Engine/DataFeeds/Enumerators/Factories/OptionChainUniverseSubscriptionEnumeratorFactoryTests.cs +++ /dev/null @@ -1,202 +0,0 @@ -/* - * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. - * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * -*/ - -using System; -using System.Collections.Generic; -using NUnit.Framework; -using QuantConnect.Data; -using QuantConnect.Data.Auxiliary; -using QuantConnect.Data.Market; -using QuantConnect.Data.UniverseSelection; -using QuantConnect.Interfaces; -using QuantConnect.Lean.Engine.DataFeeds; -using QuantConnect.Lean.Engine.DataFeeds.Enumerators; -using QuantConnect.Lean.Engine.DataFeeds.Enumerators.Factories; -using QuantConnect.Securities; -using QuantConnect.Securities.Option; -using QuantConnect.Util; - -namespace QuantConnect.Tests.Engine.DataFeeds.Enumerators.Factories -{ - [TestFixture] - public class OptionChainUniverseSubscriptionEnumeratorFactoryTests - { - [Test] - public void RefreshesOptionChainUniverseOnDateChange() - { - var startTime = new DateTime(2018, 10, 19, 10, 0, 0); - var timeProvider = new ManualTimeProvider(startTime); - - var canonicalSymbol = Symbol.Create("SPY", SecurityType.Option, Market.USA, "?SPY"); - - var quoteCurrency = new Cash(Currencies.USD, 0, 1); - var exchangeHours = MarketHoursDatabase.FromDataFolder().GetExchangeHours(Market.USA, canonicalSymbol, SecurityType.Option); - var config = new SubscriptionDataConfig( - typeof(ZipEntryName), - canonicalSymbol, - Resolution.Minute, - TimeZones.Utc, - TimeZones.NewYork, - true, - false, - false, - false, - TickType.Quote, - false, - DataNormalizationMode.Raw - ); - - var option = new Option( - canonicalSymbol, - exchangeHours, - quoteCurrency, - new OptionSymbolProperties(SymbolProperties.GetDefault(Currencies.USD)), - ErrorCurrencyConverter.Instance, - RegisteredSecurityDataTypesProvider.Null, - new SecurityCache(), - null - ); - - var fillForwardResolution = Ref.CreateReadOnly(() => Resolution.Minute.ToTimeSpan()); - var symbolUniverse = new TestDataQueueUniverseProvider(timeProvider); - EnqueueableEnumerator underlyingEnumerator = null; - Func> underlyingEnumeratorFunc = - (req) => - { - underlyingEnumerator = new EnqueueableEnumerator(); - return new LiveFillForwardEnumerator( - timeProvider, - underlyingEnumerator, - option.Exchange, - fillForwardResolution, - false, - Time.EndOfTime, - Resolution.Minute, - TimeZones.Utc, false); - }; - var factory = new OptionChainUniverseSubscriptionEnumeratorFactory(underlyingEnumeratorFunc, symbolUniverse, timeProvider); - - var universeSettings = new UniverseSettings(Resolution.Minute, 0, true, false, TimeSpan.Zero); - using var universe = new OptionChainUniverse(option, universeSettings); - var request = new SubscriptionRequest(true, universe, option, config, startTime, Time.EndOfTime); - var enumerator = (DataQueueOptionChainUniverseDataCollectionEnumerator) factory.CreateEnumerator(request, TestGlobals.DataProvider); - - // 2018-10-19 10:00 AM UTC - underlyingEnumerator.Enqueue(new Tick { Symbol = Symbols.SPY, Value = 280m }); - - // 2018-10-19 10:01 AM UTC - timeProvider.Advance(Time.OneMinute); - - underlyingEnumerator.Enqueue(new Tick { Symbol = Symbols.SPY, Value = 280m }); - - Assert.IsTrue(enumerator.MoveNext()); - Assert.IsNotNull(enumerator.Current); - Assert.AreEqual(1, symbolUniverse.TotalLookupCalls); - var data = enumerator.Current; - Assert.IsNotNull(data); - Assert.AreEqual(1, data.Data.Count); - Assert.IsNotNull(data.Underlying); - - // 2018-10-19 10:02 AM UTC - timeProvider.Advance(Time.OneMinute); - - underlyingEnumerator.Enqueue(new Tick { Symbol = Symbols.SPY, Value = 280m }); - - Assert.IsTrue(enumerator.MoveNext()); - Assert.IsNotNull(enumerator.Current); - Assert.AreEqual(1, symbolUniverse.TotalLookupCalls); - data = enumerator.Current; - Assert.IsNotNull(data); - Assert.AreEqual(1, data.Data.Count); - Assert.IsNotNull(data.Underlying); - - // 2018-10-19 10:03 AM UTC - timeProvider.Advance(Time.OneMinute); - - underlyingEnumerator.Enqueue(new Tick { Symbol = Symbols.SPY, Value = 280m }); - - Assert.IsTrue(enumerator.MoveNext()); - Assert.IsNotNull(enumerator.Current); - Assert.AreEqual(1, symbolUniverse.TotalLookupCalls); - data = enumerator.Current; - Assert.IsNotNull(data); - Assert.AreEqual(1, data.Data.Count); - Assert.IsNotNull(data.Underlying); - - // 2018-10-20 10:03 AM UTC - timeProvider.Advance(Time.OneDay); - - underlyingEnumerator.Enqueue(new Tick { Symbol = Symbols.SPY, Value = 280m }); - - Assert.IsTrue(enumerator.MoveNext()); - Assert.IsNotNull(enumerator.Current); - Assert.AreEqual(2, symbolUniverse.TotalLookupCalls); - data = enumerator.Current; - Assert.IsNotNull(data); - Assert.AreEqual(2, data.Data.Count); - Assert.IsNotNull(data.Underlying); - - // 2018-10-20 10:04 AM UTC - timeProvider.Advance(Time.OneMinute); - - underlyingEnumerator.Enqueue(new Tick { Symbol = Symbols.SPY, Value = 280m }); - - Assert.IsTrue(enumerator.MoveNext()); - Assert.IsNotNull(enumerator.Current); - Assert.AreEqual(2, symbolUniverse.TotalLookupCalls); - data = enumerator.Current; - Assert.IsNotNull(data); - Assert.AreEqual(2, data.Data.Count); - Assert.IsNotNull(data.Underlying); - - enumerator.Dispose(); - } - - public class TestDataQueueUniverseProvider : IDataQueueUniverseProvider - { - private readonly Symbol[] _symbolList1 = - { - Symbol.CreateOption("SPY", Market.USA, OptionStyle.American, OptionRight.Call, 280m, new DateTime(2018, 10, 19)) - }; - private readonly Symbol[] _symbolList2 = - { - Symbol.CreateOption("SPY", Market.USA, OptionStyle.American, OptionRight.Call, 280m, new DateTime(2018, 10, 19)), - Symbol.CreateOption("SPY", Market.USA, OptionStyle.American, OptionRight.Put, 280m, new DateTime(2018, 10, 19)) - }; - - private readonly ITimeProvider _timeProvider; - - public int TotalLookupCalls { get; set; } - - public TestDataQueueUniverseProvider(ITimeProvider timeProvider) - { - _timeProvider = timeProvider; - } - - public IEnumerable LookupSymbols(Symbol symbol, bool includeExpired, string securityCurrency = null) - { - TotalLookupCalls++; - - return _timeProvider.GetUtcNow().Date.Day >= 20 ? _symbolList2 : _symbolList1; - } - - public bool CanPerformSelection() - { - return true; - } - } - } -} diff --git a/Tests/Engine/DataFeeds/FileSystemDataFeedTests.cs b/Tests/Engine/DataFeeds/FileSystemDataFeedTests.cs index 7516bf8dce9a..7a878d3eebf2 100644 --- a/Tests/Engine/DataFeeds/FileSystemDataFeedTests.cs +++ b/Tests/Engine/DataFeeds/FileSystemDataFeedTests.cs @@ -175,7 +175,10 @@ public void OptionChainEnumerator(bool fillForward) algorithm.Transactions.SetOrderProcessor(new FakeOrderProcessor()); algorithm.SetStartDate(new DateTime(2014, 06, 06)); algorithm.SetEndDate(new DateTime(2014, 06, 09)); - algorithm.SetOptionChainProvider(new BacktestingOptionChainProvider(TestGlobals.DataCacheProvider, TestGlobals.MapFileProvider)); + + var optionChainProvider = new BacktestingOptionChainProvider(); + optionChainProvider.Initialize(new(TestGlobals.MapFileProvider, TestGlobals.HistoryProvider)); + algorithm.SetOptionChainProvider(optionChainProvider); var dataPermissionManager = new DataPermissionManager(); using var synchronizer = new Synchronizer(); @@ -224,7 +227,10 @@ public void FutureChainEnumerator(bool fillForward) algorithm.Transactions.SetOrderProcessor(new FakeOrderProcessor()); algorithm.SetStartDate(new DateTime(2013, 10, 07)); algorithm.SetEndDate(new DateTime(2013, 10, 08)); - algorithm.SetFutureChainProvider(new BacktestingFutureChainProvider(TestGlobals.DataCacheProvider)); + + var optionChainProvider = new BacktestingOptionChainProvider(); + optionChainProvider.Initialize(new(TestGlobals.MapFileProvider, TestGlobals.HistoryProvider)); + algorithm.SetOptionChainProvider(optionChainProvider); var dataPermissionManager = new DataPermissionManager(); using var synchronizer = new Synchronizer(); @@ -241,22 +247,14 @@ public void FutureChainEnumerator(bool fillForward) var lastMonth = algorithm.StartDate.Month; foreach (var timeSlice in synchronizer.StreamData(cancellationTokenSource.Token)) { - if (!timeSlice.IsTimePulse && timeSlice.UniverseData?.Count > 0) + if (!timeSlice.IsTimePulse && timeSlice.UniverseData?.Count > 0 && timeSlice.Time.Date <= algorithm.EndDate) { var nyTime = timeSlice.Time.ConvertFromUtc(algorithm.TimeZone); - - var currentExpectedTime = new TimeSpan(0, 0, 0).Add(TimeSpan.FromMinutes(count % (24 * 60))); - while (!future.Exchange.Hours.IsOpen(nyTime.Date.Add(currentExpectedTime).AddMinutes(-1), true)) - { - // skip closed market times - currentExpectedTime = new TimeSpan(0, 0, 0).Add(TimeSpan.FromMinutes(++count % (24 * 60))); - } - var universeData = timeSlice.UniverseData.OrderBy(kvp => kvp.Key.Configuration.Symbol).ToList(); - - var chainData = universeData[0].Value; + var universeData = timeSlice.UniverseData; + var chainData = universeData.Where(x => x.Key is FuturesChainUniverse).Single().Value; Log.Trace($"{nyTime}. Count: {count}. Universe Data Count {universeData.Count}"); - Assert.AreEqual(currentExpectedTime, nyTime.TimeOfDay, $"Failed on: {nyTime}. Count: {count}"); + Assert.AreEqual(TimeSpan.Zero, nyTime.TimeOfDay, $"Failed on: {nyTime}. Count: {count}"); Assert.IsTrue(timeSlice.UniverseData.All(kvp => kvp.Value.EndTime.ConvertFromUtc(algorithm.TimeZone).TimeOfDay == nyTime.TimeOfDay)); if (chainData.FilteredContracts.IsNullOrEmpty()) { @@ -276,8 +274,8 @@ public void FutureChainEnumerator(bool fillForward) Assert.IsTrue(universeData.Any(kvp => kvp.Key.Configuration.Symbol == future.Symbol)); Assert.IsTrue(universeData.Any(kvp => kvp.Key.Configuration.Symbol.ID.Symbol.Contains("CONTINUOUS", StringComparison.InvariantCultureIgnoreCase))); - var continuousData = universeData[1].Value; - Assert.AreEqual(currentExpectedTime, nyTime.TimeOfDay, $"Failed on: {nyTime}"); + var continuousData = universeData.Where(x => x.Key is ContinuousContractUniverse).Single().Value; + Assert.AreEqual(TimeSpan.Zero, nyTime.TimeOfDay, $"Failed on: {nyTime}"); Assert.IsTrue(!chainData.FilteredContracts.IsNullOrEmpty()); } @@ -287,8 +285,8 @@ public void FutureChainEnumerator(bool fillForward) feed.Exit(); algorithm.DataManager.RemoveAllSubscriptions(); - // 2 days worth of minute data - Assert.AreEqual(24 * 2 * 60 + 1, count); + // 2 tradable days + Assert.AreEqual(2, count); } [Test] diff --git a/Tests/Engine/DataFeeds/LiveTradingDataFeedTests.cs b/Tests/Engine/DataFeeds/LiveTradingDataFeedTests.cs index 25dc5acb9807..12156533aaef 100644 --- a/Tests/Engine/DataFeeds/LiveTradingDataFeedTests.cs +++ b/Tests/Engine/DataFeeds/LiveTradingDataFeedTests.cs @@ -39,6 +39,7 @@ using QuantConnect.Orders; using QuantConnect.Packets; using QuantConnect.Securities; +using QuantConnect.Securities.Future; using QuantConnect.Tests.Common.Securities; using QuantConnect.Util; using static QuantConnect.Tests.Engine.DataFeeds.Enumerators.LiveSubscriptionEnumeratorTests; @@ -195,36 +196,36 @@ public void EmitsLeanAggregatedDailyData(bool strictEndTimes, bool warmup) } [TestCase(SecurityType.Option, Resolution.Daily, 7, true)] - [TestCase(SecurityType.Future, Resolution.Daily, 0, true)] + [TestCase(SecurityType.Future, Resolution.Daily, 11, true)] [TestCase(SecurityType.IndexOption, Resolution.Daily, 14, true)] [TestCase(SecurityType.Option, Resolution.Daily, 14, true)] - [TestCase(SecurityType.Future, Resolution.Daily, 1, true)] + [TestCase(SecurityType.Future, Resolution.Daily, 120, true)] [TestCase(SecurityType.Option, Resolution.Daily, 7, false)] - [TestCase(SecurityType.Future, Resolution.Daily, 0, false)] + [TestCase(SecurityType.Future, Resolution.Daily, 11, false)] [TestCase(SecurityType.IndexOption, Resolution.Daily, 14, false)] [TestCase(SecurityType.Option, Resolution.Hour, 7, false)] - [TestCase(SecurityType.Future, Resolution.Hour, 0, false)] + [TestCase(SecurityType.Future, Resolution.Hour, 11, false)] [TestCase(SecurityType.IndexOption, Resolution.Hour, 14, false)] [TestCase(SecurityType.Option, Resolution.Minute, 7, false)] - [TestCase(SecurityType.Future, Resolution.Minute, 0, false)] + [TestCase(SecurityType.Future, Resolution.Minute, 11, false)] [TestCase(SecurityType.IndexOption, Resolution.Minute, 14, false)] [TestCase(SecurityType.Option, Resolution.Second, 7, false)] - [TestCase(SecurityType.Future, Resolution.Second, 0, false)] + [TestCase(SecurityType.Future, Resolution.Second, 11, false)] [TestCase(SecurityType.IndexOption, Resolution.Second, 14, false)] [TestCase(SecurityType.Option, Resolution.Tick, 7, false)] - [TestCase(SecurityType.Future, Resolution.Tick, 0, false)] + [TestCase(SecurityType.Future, Resolution.Tick, 11, false)] [TestCase(SecurityType.IndexOption, Resolution.Tick, 14, false)] [TestCase(SecurityType.Option, Resolution.Daily, 14, false)] - [TestCase(SecurityType.Future, Resolution.Daily, 1, false)] + [TestCase(SecurityType.Future, Resolution.Daily, 120, false)] [TestCase(SecurityType.Option, Resolution.Hour, 14, false)] - [TestCase(SecurityType.Future, Resolution.Hour, 1, false)] + [TestCase(SecurityType.Future, Resolution.Hour, 120, false)] [TestCase(SecurityType.Option, Resolution.Minute, 14, false)] - [TestCase(SecurityType.Future, Resolution.Minute, 1, false)] + [TestCase(SecurityType.Future, Resolution.Minute, 120, false)] [TestCase(SecurityType.Option, Resolution.Second, 14, false)] - [TestCase(SecurityType.Future, Resolution.Second, 1, false)] + [TestCase(SecurityType.Future, Resolution.Second, 120, false)] [TestCase(SecurityType.Option, Resolution.Tick, 14, false)] - [TestCase(SecurityType.Future, Resolution.Tick, 1, false)] + [TestCase(SecurityType.Future, Resolution.Tick, 120, false)] public void LiveChainSelection(SecurityType securityType, Resolution resolution, int expirationDatesFilter, bool strictEndTimes) { _startDate = securityType == SecurityType.IndexOption ? new DateTime(2021, 1, 4) : new DateTime(2014, 6, 9); @@ -257,13 +258,8 @@ public void LiveChainSelection(SecurityType securityType, Resolution resolution, chainAsset.SetFilter(x => { selectionHappened++; - var symbols = x.Expiration(0, expirationDatesFilter).IncludeWeeklys().OnlyApplyFilterAtMarketOpen().ToList(); - - Assert.AreEqual(expirationDatesFilter + 1, symbols.Count); - for (var i = 0; i < expirationDatesFilter; i++) - { - Assert.AreEqual(1, symbols.Count(s => s.ID.Date.Date == x.LocalTime.Date.AddDays(i))); - } + var symbols = x.Expiration(0, expirationDatesFilter).IncludeWeeklys().ToList(); + Assert.AreEqual(expirationDatesFilter < 30 ? 1 : 2, symbols.Count); return x; }); } @@ -289,7 +285,7 @@ public void LiveChainSelection(SecurityType securityType, Resolution resolution, [Test] public void ContinuousFuturesImmediateSelection() { - _startDate = new DateTime(2014, 6, 9); + _startDate = new DateTime(2013, 10, 7, 12, 0, 0); var startDateUtc = _startDate.ConvertToUtc(_algorithm.TimeZone); _manualTimeProvider.SetCurrentTimeUtc(startDateUtc); var endDate = _startDate.AddDays(5); @@ -529,7 +525,7 @@ IEnumerable CoarseFilter(IEnumerable coarse) [Test] public void FutureChainsImmediateSelection() { - _startDate = new DateTime(2014, 6, 9); + _startDate = new DateTime(2014, 6, 9, 12, 0, 0); var startDateUtc = _startDate.ConvertToUtc(_algorithm.TimeZone); _manualTimeProvider.SetCurrentTimeUtc(startDateUtc); var endDate = _startDate.AddDays(5); @@ -542,12 +538,12 @@ public void FutureChainsImmediateSelection() List selectedSymbols = null; var future = _algorithm.AddFuture("ES"); - future.SetFilter(x => + future.SetFilter(universe => { - firstSelectionTimeUtc = x.LocalTime.ConvertToUtc(future.Exchange.TimeZone); - selectedSymbols = x.ToList(); + firstSelectionTimeUtc = universe.LocalTime.ConvertToUtc(future.Exchange.TimeZone); + selectedSymbols = universe.Data.Select(x => x.Symbol).ToList(); - return x; + return universe; }); _algorithm.PostInitialize(); @@ -579,8 +575,8 @@ public void FutureChainsImmediateSelection() public void OptionChainImmediateSelection(SecurityType securityType) { _startDate = securityType == SecurityType.Option - ? new DateTime(2015, 12, 24) - : new DateTime(2021, 01, 04); + ? new DateTime(2015, 12, 24, 12, 0, 0) + : new DateTime(2021, 01, 04, 12, 0, 0); var startDateUtc = _startDate.ConvertToUtc(_algorithm.TimeZone); _manualTimeProvider.SetCurrentTimeUtc(startDateUtc); var endDate = _startDate.AddDays(5); @@ -592,14 +588,12 @@ public void OptionChainImmediateSelection(SecurityType securityType) var firstSelectionTimeUtc = DateTime.MinValue; List selectedSymbols = null; - var selectionDone = false; - var option = securityType == SecurityType.Option ? _algorithm.AddOption("GOOG") : _algorithm.AddIndexOption("SPX"); option.SetFilter(universe => { - selectionDone = true; + firstSelectionTimeUtc = universe.LocalTime.ConvertToUtc(option.Exchange.TimeZone); selectedSymbols = (List)universe; return universe; @@ -614,7 +608,7 @@ public void OptionChainImmediateSelection(SecurityType securityType) ConsumeBridge(feed, TimeSpan.FromSeconds(10), true, ts => { timeSliceCount++; - if (selectionDone) + if (firstSelectionTimeUtc != default) { // we got what we wanted shortcut unit test _manualTimeProvider.SetCurrentTimeUtc(Time.EndOfTime); @@ -623,9 +617,7 @@ public void OptionChainImmediateSelection(SecurityType securityType) endDate: endDate, secondsTimeStep: 60); - var expectedSelectionTimeUtc = startDateUtc.Add(option.Resolution.ToTimeSpan()); - - Assert.IsTrue(selectionDone); + Assert.AreEqual(startDateUtc, firstSelectionTimeUtc); Assert.GreaterOrEqual(timeSliceCount, 1); Assert.IsNotNull(selectedSymbols); Assert.IsNotEmpty(selectedSymbols); @@ -1037,7 +1029,9 @@ public void WarmupExpiredContinuousFuture(bool useWarmupResolution) _manualTimeProvider.SetCurrentTimeUtc(_startDate); var endDate = _startDate.AddDays(30); - _algorithm.SetFutureChainProvider(new BacktestingFutureChainProvider(TestGlobals.DataCacheProvider)); + var futureChainProvider = new BacktestingFutureChainProvider(); + futureChainProvider.Initialize(new(TestGlobals.MapFileProvider, TestGlobals.HistoryProvider)); + _algorithm.SetFutureChainProvider(futureChainProvider); _algorithm.UniverseSettings.Resolution = Resolution.Daily; if (useWarmupResolution) { @@ -3485,7 +3479,7 @@ public void HandlesFutureAndOptionChainUniverse(SecurityType securityType, int e { SecurityType.Option => new DateTime(2015, 12, 24), SecurityType.IndexOption => new DateTime(2021, 01, 04), - SecurityType.Future => new DateTime(2019, 11, 19), + SecurityType.Future => new DateTime(2013, 07, 11), _ => throw new ArgumentOutOfRangeException(nameof(securityType), securityType, null) }; var endDate = startDate.AddDays(2.3); @@ -3500,10 +3494,9 @@ public void HandlesFutureAndOptionChainUniverse(SecurityType securityType, int e var timeAdvanceStep = TimeSpan.FromMinutes(180); using var timeAdvanced = new AutoResetEvent(true); using var started = new ManualResetEvent(false); - var lookupCount = 0; + var futureSelectionCount = 0; - var futureSymbol1 = Symbol.CreateFuture(Futures.Indices.SP500EMini, Market.CME, new DateTime(2019, 12, 19)); - var futureSymbol2 = Symbol.CreateFuture(Futures.Indices.SP500EMini, Market.CME, new DateTime(2020, 3, 19)); + var selectedFutureSymbols = new HashSet(); Symbol canonicalOptionSymbol = null; Exception lookupSymbolsException = null; @@ -3573,17 +3566,23 @@ public void HandlesFutureAndOptionChainUniverse(SecurityType securityType, int e } else if (securityType == SecurityType.Future) { - dataPoints.AddRange( - futureSymbols.Select( - symbol => new Tick - { - Symbol = symbol, - Time = exchangeTime, - EndTime = exchangeTime, - TickType = TickType.Trade, - Value = 100, - Quantity = 1 - })); + if (selectedFutureSymbols.Count > 0) + { + var canonicalFutureSymbol = selectedFutureSymbols.First().Canonical; + var mappedSymbol = (algorithm.Securities[canonicalFutureSymbol] as Future).Mapped; + + dataPoints.AddRange( + selectedFutureSymbols.Union(new[] { canonicalFutureSymbol, mappedSymbol }).Select( + symbol => new Tick + { + Symbol = symbol, + Time = exchangeTime, + EndTime = exchangeTime, + TickType = TickType.Trade, + Value = 100, + Quantity = 1 + })); + } } Log.Debug($"DQH: Emitting data point(s) at {utcTime.ConvertFromUtc(algorithmTimeZone)} ({algorithmTimeZone})"); @@ -3592,34 +3591,7 @@ public void HandlesFutureAndOptionChainUniverse(SecurityType securityType, int e }, // LookupSymbols - (symbol, includeExpired, securityCurrency) => - { - // option chain selection is file-based - if (symbol.SecurityType.IsOption()) - { - return Enumerable.Empty(); - } - - lookupCount++; - - var utcTime = timeProvider.GetUtcNow(); - var time = utcTime.ConvertFromUtc(algorithmTimeZone); - - var isValidTime = time.Hour >= 1 && time.Hour < 23; - - Log.Trace($"LookupSymbols() called at {time} ({algorithmTimeZone}) - valid: {isValidTime}"); - - if (!isValidTime) - { - lookupSymbolsException = new RegressionTestException($"Invalid LookupSymbols call time: {time} ({algorithmTimeZone})"); - } - - time = utcTime.ConvertFromUtc(exchangeTimeZone); - - return time.Day == 19 - ? new List { futureSymbol1 } - : new List { futureSymbol1, futureSymbol2 }; - }, + (symbol, includeExpired, securityCurrency) => Enumerable.Empty(), // CanAdvanceTime () => @@ -3694,8 +3666,13 @@ public void HandlesFutureAndOptionChainUniverse(SecurityType securityType, int e else if (securityType == SecurityType.Future) { var future = algorithm.AddFuture(Futures.Indices.SP500EMini, Resolution.Minute, extendedMarketHours: true, fillForward: false); - // Must include weeklys because the contracts returned by the lookup, futureSymbol1 & futureSymbol2, are non-standard - future.SetFilter(x => x.IncludeWeeklys()); + future.SetFilter(u => + { + futureSelectionCount++; + var result = u.IncludeWeeklys().Contracts(x => x.Take(2)); + selectedFutureSymbols.UnionWith(result.Take(2).Select(x => x.Symbol)); + return result; + }); exchangeTimeZone = future.Exchange.TimeZone; } else @@ -3743,10 +3720,25 @@ public void HandlesFutureAndOptionChainUniverse(SecurityType securityType, int e // We should wait for the base exchange to pick up the universe and push a selection data point Thread.Sleep(100); + bool IsPastEndTime(out DateTime currentTime) + { + currentTime = timeProvider.GetUtcNow(); + if (currentTime.ConvertFromUtc(algorithmTimeZone) > endDate) + { + _feed.Exit(); + cancellationTokenSource.Cancel(); + return true; + } + + return false; + } + foreach (var timeSlice in _synchronizer.StreamData(cancellationTokenSource.Token)) { if (timeSlice.IsTimePulse || !timeSlice.Slice.HasData && timeSlice.SecurityChanges == SecurityChanges.None) { + if (IsPastEndTime(out _)) break; + continue; } @@ -3848,17 +3840,11 @@ public void HandlesFutureAndOptionChainUniverse(SecurityType securityType, int e Log.Debug($"{timeSlice.Time} - universe data: {symbols}"); } - var currentTime = timeProvider.GetUtcNow(); + // Get current time and check if we should stop the algorithm + IsPastEndTime(out var currentTime); algorithm.SetDateTime(currentTime); Log.Debug($"{timeSlice.Time} - Algorithm time set to {currentTime.ConvertFromUtc(algorithmTimeZone)} ({algorithmTimeZone})"); - - if (currentTime.ConvertFromUtc(algorithmTimeZone) > endDate) - { - _feed.Exit(); - cancellationTokenSource.Cancel(); - break; - } } if (lookupSymbolsException != null) @@ -3868,7 +3854,7 @@ public void HandlesFutureAndOptionChainUniverse(SecurityType securityType, int e if (securityType == SecurityType.Future) { - Assert.AreEqual(2, lookupCount, "LookupSymbols call count mismatch"); + Assert.AreEqual(2, futureSelectionCount); // we add 2 symbols + 1 continuous future + 1 continuous future mapped symbol Assert.AreEqual(4, futureSymbols.Count, "Future symbols count mismatch"); } diff --git a/Tests/Engine/DataFeeds/TimeSliceTests.cs b/Tests/Engine/DataFeeds/TimeSliceTests.cs index 9d867b5621e9..95ef83abccbf 100644 --- a/Tests/Engine/DataFeeds/TimeSliceTests.cs +++ b/Tests/Engine/DataFeeds/TimeSliceTests.cs @@ -219,7 +219,8 @@ public void SuspiciousTicksAreNotAddedToConsolidatorUpdateData() private IEnumerable GetSlices(Symbol symbol, int initialVolume) { - var subscriptionDataConfig = new SubscriptionDataConfig(typeof(ZipEntryName), symbol, Resolution.Second, TimeZones.Utc, TimeZones.Utc, true, true, false); + var dataType = symbol.SecurityType.IsOption() ? typeof(OptionUniverse) : typeof(FutureUniverse); + var subscriptionDataConfig = new SubscriptionDataConfig(dataType, symbol, Resolution.Second, TimeZones.Utc, TimeZones.Utc, true, true, false); var security = GetSecurity(subscriptionDataConfig); var refTime = DateTime.UtcNow; @@ -271,7 +272,7 @@ private Security GetSecurity(SubscriptionDataConfig config) new OptionSymbolProperties(SymbolProperties.GetDefault(Currencies.USD)), ErrorCurrencyConverter.Instance, RegisteredSecurityDataTypesProvider.Null); - var underlyingConfig = new SubscriptionDataConfig(typeof(ZipEntryName), config.Symbol.Underlying, Resolution.Second, + var underlyingConfig = new SubscriptionDataConfig(typeof(TradeBar), config.Symbol.Underlying, Resolution.Second, TimeZones.Utc, TimeZones.Utc, true, true, false); var equity = new Equity( SecurityExchangeHours.AlwaysOpen(TimeZones.Utc), diff --git a/Tests/Engine/DataFeeds/ZipEntryNameSubscriptionFactoryTests.cs b/Tests/Engine/DataFeeds/ZipEntryNameSubscriptionFactoryTests.cs index f1eb0a2dfcdf..60cb66e1b04b 100644 --- a/Tests/Engine/DataFeeds/ZipEntryNameSubscriptionFactoryTests.cs +++ b/Tests/Engine/DataFeeds/ZipEntryNameSubscriptionFactoryTests.cs @@ -20,6 +20,7 @@ using QuantConnect.Data; using QuantConnect.Data.Auxiliary; using QuantConnect.Lean.Engine.DataFeeds; +using QuantConnect.Util; namespace QuantConnect.Tests.Engine.DataFeeds { @@ -31,7 +32,7 @@ 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, + var config = new SubscriptionDataConfig(typeof (CustomData), Symbol.Create("XLRE", SecurityType.Option, Market.USA), Resolution.Tick, TimeZones.NewYork, TimeZones.NewYork, false, false, false); using var cacheProvider = new ZipDataCacheProvider(TestGlobals.DataProvider); var factory = new ZipEntryNameSubscriptionDataSourceReader(cacheProvider, config, time, false); @@ -46,7 +47,22 @@ public void ReadsZipEntryNames() // we only really care about the symbols CollectionAssert.AreEqual(expected, actual.Select(x => x.Symbol)); - Assert.IsTrue(actual.All(x => x is ZipEntryName)); + Assert.IsTrue(actual.All(x => x is CustomData)); + } + + private class CustomData : BaseData + { + public override BaseData Reader(SubscriptionDataConfig config, string line, DateTime date, bool isLiveMode) + { + var symbol = LeanData.ReadSymbolFromZipEntry(config.Symbol, config.Resolution, line); + return new CustomData { Time = date, Symbol = symbol }; + } + + public override SubscriptionDataSource GetSource(SubscriptionDataConfig config, DateTime date, bool isLiveMode) + { + var source = LeanData.GenerateZipFilePath(Globals.DataFolder, config.Symbol, date, config.Resolution, config.TickType); + return new SubscriptionDataSource(source, SubscriptionTransportMedium.LocalFile, FileFormat.ZipEntryName); + } } } } diff --git a/Tests/TestGlobals.cs b/Tests/TestGlobals.cs index 4fba17c1db55..91dba9dcd565 100644 --- a/Tests/TestGlobals.cs +++ b/Tests/TestGlobals.cs @@ -19,6 +19,7 @@ using QuantConnect.Lean.Engine.DataFeeds; using QuantConnect.Data.UniverseSelection; using QuantConnect.Tests.Common.Data.Fundamental; +using QuantConnect.Data; namespace QuantConnect.Tests { @@ -38,6 +39,9 @@ public static IFactorFileProvider FactorFileProvider public static IDataCacheProvider DataCacheProvider = new ZipDataCacheProvider(DataProvider); + public static IHistoryProvider HistoryProvider + = Composer.Instance.GetExportedValueByTypeName("SubscriptionDataReaderHistoryProvider"); + /// /// Initialize our providers, called by AssemblyInitialize.cs so all tests /// can access initialized providers @@ -52,6 +56,16 @@ public static void Initialize() } _initialized = true; + var initializeParameters = new HistoryProviderInitializeParameters(null, null, DataProvider, DataCacheProvider, + MapFileProvider, FactorFileProvider, (_) => { }, true, new DataPermissionManager(), null, new AlgorithmSettings()); + try + { + HistoryProvider.Initialize(initializeParameters); + } + catch + { + // Already initialized + } MapFileProvider.Initialize(DataProvider); FactorFileProvider.Initialize(MapFileProvider, DataProvider); FundamentalService.Initialize(DataProvider, new NullFundamentalDataProvider(), false); diff --git a/Tests/ToolBox/LeanDataReaderTests.cs b/Tests/ToolBox/LeanDataReaderTests.cs index 80c975b3221d..c5b34b9a3710 100644 --- a/Tests/ToolBox/LeanDataReaderTests.cs +++ b/Tests/ToolBox/LeanDataReaderTests.cs @@ -177,7 +177,7 @@ private List LoadFutureChain(Symbol baseFuture, DateTime date, TickType var filePath = LeanData.GenerateZipFilePath(_dataDirectory, baseFuture, date, res, tickType); //load future chain first - var config = new SubscriptionDataConfig(typeof(ZipEntryName), baseFuture, res, + var config = new SubscriptionDataConfig(typeof(ZipEntryNameData), baseFuture, res, TimeZones.NewYork, TimeZones.NewYork, false, false, false, false, tickType); var factory = new ZipEntryNameSubscriptionDataSourceReader(TestGlobals.DataCacheProvider, config, date, false); @@ -499,5 +499,20 @@ public static string GenerateFilepathForTesting(string dataDirectory, string sec return filepath; } + private class ZipEntryNameData : BaseData + { + public override BaseData Reader(SubscriptionDataConfig config, string line, DateTime date, bool isLiveMode) + { + var symbol = LeanData.ReadSymbolFromZipEntry(config.Symbol, config.Resolution, line); + return new ZipEntryNameData { Time = date, Symbol = symbol }; + } + + public override SubscriptionDataSource GetSource(SubscriptionDataConfig config, DateTime date, bool isLiveMode) + { + var source = LeanData.GenerateZipFilePath(Globals.DataFolder, config.Symbol, date, config.Resolution, config.TickType); + return new SubscriptionDataSource(source, SubscriptionTransportMedium.LocalFile, FileFormat.ZipEntryName); + } + } + } }