From 09db45c91d00485e68384d9069598462520f80f2 Mon Sep 17 00:00:00 2001 From: Jhonathan Abreu Date: Wed, 21 Feb 2024 08:59:58 -0400 Subject: [PATCH] Universes immediate selection (#7785) * Make sure continuous futures universe selection is performed right away on the start of the algorithm. This ensures the Future.Mapped is not null * Minor changes * Minor fixes * Update regression algorithms stats * Add DC futures map file * Update DC futures map file * Update regression algorithms stats * Include ETFs for immediate universe selection * Include Coarse Fundamentals for immediate universe selection * Include Futures Chain Universe for immediate selection * Add Option Chain Universe test * Include custom universes for immediate selection * Minor updates * Include constituents universes for immediate selection * Minor update * Minor changes, docs and stats updates * Minor changes * Minor changes and clean up * Minor regression algorithm stat update --- ...ntractWithContinuousRegressionAlgorithm.cs | 2 +- ...tractFromFutureChainRegressionAlgorithm.cs | 4 +- ...ctedInUniverseFilterRegressionAlgorithm.cs | 4 +- .../BasicTemplateContinuousFutureAlgorithm.cs | 2 +- ...inuousFutureWithExtendedMarketAlgorithm.cs | 2 +- .../BasicTemplateFutureRolloverAlgorithm.cs | 2 +- .../BasicTemplateFuturesAlgorithm.cs | 2 +- .../BasicTemplateFuturesDailyAlgorithm.cs | 2 +- .../BasicTemplateFuturesFrameworkAlgorithm.cs | 2 +- ...resFrameworkWithExtendedMarketAlgorithm.cs | 2 +- .../BasicTemplateFuturesHistoryAlgorithm.cs | 2 +- ...HistoryWithExtendedMarketHoursAlgorithm.cs | 2 +- .../BasicTemplateFuturesHourlyAlgorithm.cs | 2 +- ...plateFuturesWithExtendedMarketAlgorithm.cs | 2 +- ...FuturesWithExtendedMarketDailyAlgorithm.cs | 2 +- ...uturesWithExtendedMarketHourlyAlgorithm.cs | 2 +- ...alImmediateSelectionRegressionAlgorithm.cs | 153 ++++++ ...seImmediateSelectionRegressionAlgorithm.cs | 142 +++++ ...ConstituentsUniverseRegressionAlgorithm.cs | 4 +- ...usBackMonthRawFutureRegressionAlgorithm.cs | 2 +- ...nuousFutureBackMonthRegressionAlgorithm.cs | 2 +- ...tinuousFutureHistoryRegressionAlgorithm.cs | 2 +- ...istoryTimeSpanWarmupRegressionAlgorithm.cs | 2 +- ...ateUniverseSelectionRegressionAlgorithm.cs | 226 ++++++++ ...eLimitIfTouchedOrderRegressionAlgorithm.cs | 2 +- .../ContinuousFutureRegressionAlgorithm.cs | 2 +- ...ntinuousFuturesDailyRegressionAlgorithm.cs | 2 +- ...seImmediateSelectionRegressionAlgorithm.cs | 198 +++++++ ...seImmediateSelectionRegressionAlgorithm.cs | 165 ++++++ .../DefaultFutureChainRegressionAlgorithm.cs | 2 +- ...FutureLiquidateDailyRegressionAlgorithm.cs | 2 +- ...istedFutureLiquidateRegressionAlgorithm.cs | 2 +- ...ingFutureOptionDailyRegressionAlgorithm.cs | 2 +- ...elistingFutureOptionRegressionAlgorithm.cs | 2 +- .../ETFConstituentsFrameworkAlgorithm.cs | 40 +- ...structionModelFutureRegressionAlgorithm.cs | 2 +- ...ntalFilteredUniverseRegressionAlgorithm.cs | 34 +- ...nternalSubscriptionsRegressionAlgorithm.cs | 2 +- ...reMarketOpenAndCloseRegressionAlgorithm.cs | 2 +- ...seWithExtendedMarketRegressionAlgorithm.cs | 2 +- ...rketOpenConsolidatorRegressionAlgorithm.cs | 2 +- ...orWithExtendedMarketRegressionAlgorithm.cs | 2 +- ...tureNoTimeInUniverseRegressionAlgorithm.cs | 2 +- ...SameUnderlyingFutureRegressionAlgorithm.cs | 2 +- .../FutureSharingTickerRegressionAlgorithm.cs | 2 +- ...OrderOnExtendedHoursRegressionAlgorithm.cs | 2 +- .../FuturesExpiredContractRegression.cs | 2 +- ...sExtendedMarketHoursRegressionAlgorithm.cs | 2 +- .../FuturesFrameworkRegressionAlgorithm.cs | 2 +- ...ContractDepthOffsetsRegressionAlgorithm.cs | 2 +- ...erentDataMappingModeRegressionAlgorithm.cs | 2 +- ...AfterHoursForFuturesRegressionAlgorithm.cs | 2 +- ...endedHoursForFuturesRegressionAlgorithm.cs | 2 +- .../OpenInterestFuturesRegressionAlgorithm.cs | 2 +- ...seImmediateSelectionRegressionAlgorithm.cs | 209 ++++++++ ...seCompositeDelistingRegressionAlgorithm.cs | 65 ++- ...istingRegressionAlgorithmNoAddEquityETF.cs | 10 +- ...iverseFilterFunctionRegressionAlgorithm.cs | 28 +- ...entUniverseFrameworkRegressionAlgorithm.cs | 28 +- ...seImmediateSelectionRegressionAlgorithm.cs | 186 +++++++ ...verseMappedCompositeRegressionAlgorithm.cs | 12 +- ...nstituentUniverseRSIAlphaModelAlgorithm.cs | 38 +- ...NormalizationModeOnAddSecurityAlgorithm.cs | 2 +- .../SetHoldingsFutureRegressionAlgorithm.cs | 2 +- .../UniverseOnlyRegressionAlgorithm.cs | 6 +- .../WarmupFutureRegressionAlgorithm.cs | 2 +- ...FutureTimeSpanWarmupRegressionAlgorithm.cs | 2 +- ...seCompositeDelistingRegressionAlgorithm.py | 21 +- ...istingRegressionAlgorithmNoAddEquityETF.py | 16 +- ...iverseFilterFunctionRegressionAlgorithm.py | 10 +- ...ntalFilteredUniverseRegressionAlgorithm.py | 4 +- .../equity/usa/universes/etf/spy/20201130.csv | 503 ++++++++++++++++++ Data/future/cme/map_files/dc.csv | 341 ++++++++++++ .../cme/minute/dc/20131007_openinterest.zip | Bin 0 -> 3228 bytes Data/future/cme/minute/dc/20131007_quote.zip | Bin 0 -> 15865 bytes Data/future/cme/minute/dc/20131007_trade.zip | Bin 0 -> 4675 bytes Engine/DataFeeds/DataManager.cs | 25 + ...CollectionSubscriptionEnumeratorFactory.cs | 15 +- ...ctionSubscriptionEnumeratorFactoryTests.cs | 3 +- .../DataFeeds/LiveTradingDataFeedTests.cs | 458 +++++++++++++++- 80 files changed, 2828 insertions(+), 216 deletions(-) create mode 100644 Algorithm.CSharp/CoarseFundamentalImmediateSelectionRegressionAlgorithm.cs create mode 100644 Algorithm.CSharp/ConstituentsUniverseImmediateSelectionRegressionAlgorithm.cs create mode 100644 Algorithm.CSharp/ContinuousFutureImmediateUniverseSelectionRegressionAlgorithm.cs create mode 100644 Algorithm.CSharp/CustomDataUniverseImmediateSelectionRegressionAlgorithm.cs create mode 100644 Algorithm.CSharp/CustomUniverseImmediateSelectionRegressionAlgorithm.cs create mode 100644 Algorithm.CSharp/OptionChainUniverseImmediateSelectionRegressionAlgorithm.cs create mode 100644 Algorithm.CSharp/RegressionTests/Universes/ETFConstituentUniverseImmediateSelectionRegressionAlgorithm.cs create mode 100644 Data/equity/usa/universes/etf/spy/20201130.csv create mode 100644 Data/future/cme/map_files/dc.csv create mode 100644 Data/future/cme/minute/dc/20131007_openinterest.zip create mode 100644 Data/future/cme/minute/dc/20131007_quote.zip create mode 100644 Data/future/cme/minute/dc/20131007_trade.zip diff --git a/Algorithm.CSharp/AddFutureContractWithContinuousRegressionAlgorithm.cs b/Algorithm.CSharp/AddFutureContractWithContinuousRegressionAlgorithm.cs index 837032ae5699..6aba08cec14f 100644 --- a/Algorithm.CSharp/AddFutureContractWithContinuousRegressionAlgorithm.cs +++ b/Algorithm.CSharp/AddFutureContractWithContinuousRegressionAlgorithm.cs @@ -116,7 +116,7 @@ public override void OnSecuritiesChanged(SecurityChanges changes) /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 63; + public long DataPoints => 74; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/AddFutureOptionContractFromFutureChainRegressionAlgorithm.cs b/Algorithm.CSharp/AddFutureOptionContractFromFutureChainRegressionAlgorithm.cs index 380ac8b47823..9ba0cd0b714f 100644 --- a/Algorithm.CSharp/AddFutureOptionContractFromFutureChainRegressionAlgorithm.cs +++ b/Algorithm.CSharp/AddFutureOptionContractFromFutureChainRegressionAlgorithm.cs @@ -93,7 +93,7 @@ public override void OnData(Slice data) /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 12164; + public long DataPoints => 12170; /// /// Data Points count of the algorithm history @@ -129,7 +129,7 @@ public override void OnData(Slice data) {"Estimated Strategy Capacity", "$2600000.00"}, {"Lowest Capacity Asset", "ES 31C3JQS9D84PW|ES XCZJLC9NOB29"}, {"Portfolio Turnover", "495.15%"}, - {"OrderListHash", "39179b5e977b8bf5411fbd31896a7953"} + {"OrderListHash", "51ae811a9f7a26ae8eb96cdcefe1ab59"} }; } } diff --git a/Algorithm.CSharp/AddFutureOptionSingleOptionChainSelectedInUniverseFilterRegressionAlgorithm.cs b/Algorithm.CSharp/AddFutureOptionSingleOptionChainSelectedInUniverseFilterRegressionAlgorithm.cs index 41c72ce5c296..7f16f1b5ffa0 100644 --- a/Algorithm.CSharp/AddFutureOptionSingleOptionChainSelectedInUniverseFilterRegressionAlgorithm.cs +++ b/Algorithm.CSharp/AddFutureOptionSingleOptionChainSelectedInUniverseFilterRegressionAlgorithm.cs @@ -220,7 +220,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 608372; + public long DataPoints => 608378; /// /// Data Points count of the algorithm history @@ -256,7 +256,7 @@ public override void OnEndOfAlgorithm() {"Estimated Strategy Capacity", "$760000.00"}, {"Lowest Capacity Asset", "ES XCZJLDQX2SRO|ES XCZJLC9NOB29"}, {"Portfolio Turnover", "32.31%"}, - {"OrderListHash", "b508146aff4ac449e9c6f502928e2115"} + {"OrderListHash", "8d248c2234fec09fbe09f86735fefd99"} }; } } diff --git a/Algorithm.CSharp/BasicTemplateContinuousFutureAlgorithm.cs b/Algorithm.CSharp/BasicTemplateContinuousFutureAlgorithm.cs index 3c2478e6b3b0..3fcf4b397266 100644 --- a/Algorithm.CSharp/BasicTemplateContinuousFutureAlgorithm.cs +++ b/Algorithm.CSharp/BasicTemplateContinuousFutureAlgorithm.cs @@ -118,7 +118,7 @@ public override void OnSecuritiesChanged(SecurityChanges changes) /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 713394; + public long DataPoints => 713395; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/BasicTemplateContinuousFutureWithExtendedMarketAlgorithm.cs b/Algorithm.CSharp/BasicTemplateContinuousFutureWithExtendedMarketAlgorithm.cs index cdd87e1a9dad..79e36fb5c83b 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 => 2217324; + public long DataPoints => 2217325; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/BasicTemplateFutureRolloverAlgorithm.cs b/Algorithm.CSharp/BasicTemplateFutureRolloverAlgorithm.cs index 437c1430d599..321309d91ac1 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 => 1333; + public long DataPoints => 1334; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/BasicTemplateFuturesAlgorithm.cs b/Algorithm.CSharp/BasicTemplateFuturesAlgorithm.cs index 34ffb8238a36..43c50f2f6bc2 100644 --- a/Algorithm.CSharp/BasicTemplateFuturesAlgorithm.cs +++ b/Algorithm.CSharp/BasicTemplateFuturesAlgorithm.cs @@ -151,7 +151,7 @@ public override void OnSecuritiesChanged(SecurityChanges changes) /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 75401; + public long DataPoints => 75403; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/BasicTemplateFuturesDailyAlgorithm.cs b/Algorithm.CSharp/BasicTemplateFuturesDailyAlgorithm.cs index a2011f415213..7ee1f1473a18 100644 --- a/Algorithm.CSharp/BasicTemplateFuturesDailyAlgorithm.cs +++ b/Algorithm.CSharp/BasicTemplateFuturesDailyAlgorithm.cs @@ -117,7 +117,7 @@ select futuresContract /// /// Data Points count of all timeslices of algorithm /// - public virtual long DataPoints => 14036; + public virtual long DataPoints => 14038; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/BasicTemplateFuturesFrameworkAlgorithm.cs b/Algorithm.CSharp/BasicTemplateFuturesFrameworkAlgorithm.cs index f072b5a980b8..19fb98036501 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 => 57752; + public virtual long DataPoints => 57754; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/BasicTemplateFuturesFrameworkWithExtendedMarketAlgorithm.cs b/Algorithm.CSharp/BasicTemplateFuturesFrameworkWithExtendedMarketAlgorithm.cs index c2e4bb67ba95..1c7e693a5981 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 => 163392; + public override long DataPoints => 163410; /// /// 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 303661e62f35..379c7f5ac841 100644 --- a/Algorithm.CSharp/BasicTemplateFuturesHistoryAlgorithm.cs +++ b/Algorithm.CSharp/BasicTemplateFuturesHistoryAlgorithm.cs @@ -140,7 +140,7 @@ public override void OnOrderEvent(OrderEvent orderEvent) /// /// Data Points count of all timeslices of algorithm /// - public virtual long DataPoints => 48688; + public virtual long DataPoints => 48690; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/BasicTemplateFuturesHistoryWithExtendedMarketHoursAlgorithm.cs b/Algorithm.CSharp/BasicTemplateFuturesHistoryWithExtendedMarketHoursAlgorithm.cs index c9634eb4ebb0..263b46238d68 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 => 147769; + public override long DataPoints => 147771; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/BasicTemplateFuturesHourlyAlgorithm.cs b/Algorithm.CSharp/BasicTemplateFuturesHourlyAlgorithm.cs index 70109b0382b7..319b77c6c778 100644 --- a/Algorithm.CSharp/BasicTemplateFuturesHourlyAlgorithm.cs +++ b/Algorithm.CSharp/BasicTemplateFuturesHourlyAlgorithm.cs @@ -41,7 +41,7 @@ public class BasicTemplateFuturesHourlyAlgorithm : BasicTemplateFuturesDailyAlgo /// /// Data Points count of all timeslices of algorithm /// - public override long DataPoints => 87391; + public override long DataPoints => 87393; /// /// This is used by the regression test system to indicate what the expected statistics are from running the algorithm diff --git a/Algorithm.CSharp/BasicTemplateFuturesWithExtendedMarketAlgorithm.cs b/Algorithm.CSharp/BasicTemplateFuturesWithExtendedMarketAlgorithm.cs index 54b353f6ce69..e937cf196da4 100644 --- a/Algorithm.CSharp/BasicTemplateFuturesWithExtendedMarketAlgorithm.cs +++ b/Algorithm.CSharp/BasicTemplateFuturesWithExtendedMarketAlgorithm.cs @@ -151,7 +151,7 @@ public override void OnSecuritiesChanged(SecurityChanges changes) /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 224660; + public long DataPoints => 224662; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/BasicTemplateFuturesWithExtendedMarketDailyAlgorithm.cs b/Algorithm.CSharp/BasicTemplateFuturesWithExtendedMarketDailyAlgorithm.cs index 99894574d194..5fe54c40f8cb 100644 --- a/Algorithm.CSharp/BasicTemplateFuturesWithExtendedMarketDailyAlgorithm.cs +++ b/Algorithm.CSharp/BasicTemplateFuturesWithExtendedMarketDailyAlgorithm.cs @@ -43,7 +43,7 @@ public class BasicTemplateFuturesWithExtendedMarketDailyAlgorithm : BasicTemplat /// /// Data Points count of all timeslices of algorithm /// - public override long DataPoints => 16263; + public override long DataPoints => 16265; /// /// This is used by the regression test system to indicate what the expected statistics are from running the algorithm diff --git a/Algorithm.CSharp/BasicTemplateFuturesWithExtendedMarketHourlyAlgorithm.cs b/Algorithm.CSharp/BasicTemplateFuturesWithExtendedMarketHourlyAlgorithm.cs index 8acf876ea522..f52acd6c1974 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 => 228936; + public override long DataPoints => 228938; /// /// This is used by the regression test system to indicate what the expected statistics are from running the algorithm diff --git a/Algorithm.CSharp/CoarseFundamentalImmediateSelectionRegressionAlgorithm.cs b/Algorithm.CSharp/CoarseFundamentalImmediateSelectionRegressionAlgorithm.cs new file mode 100644 index 000000000000..1211b77f82d1 --- /dev/null +++ b/Algorithm.CSharp/CoarseFundamentalImmediateSelectionRegressionAlgorithm.cs @@ -0,0 +1,153 @@ +/* + * 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 QuantConnect.Interfaces; +using System.Collections.Generic; +using QuantConnect.Data.UniverseSelection; +using QuantConnect.Data; + +namespace QuantConnect.Algorithm.CSharp +{ + /// + /// Assert that CoarseFundamentals universe selection happens right away after algorithm starts + /// + public class CoarseFundamentalImmediateSelectionRegressionAlgorithm : QCAlgorithm, IRegressionAlgorithmDefinition + { + private const int NumberOfSymbols = 3; + + private bool _initialSelectionDone; + + public override void Initialize() + { + UniverseSettings.Resolution = Resolution.Daily; + + SetStartDate(2014, 03, 25); + SetEndDate(2014, 03, 30); + SetCash(100000); + + AddUniverse(CoarseSelectionFunction); + } + + // sort the data by daily dollar volume and take the top 'NumberOfSymbols' + public IEnumerable CoarseSelectionFunction(IEnumerable coarse) + { + if (!_initialSelectionDone) + { + if (Time != StartDate) + { + throw new Exception($"CoarseSelectionFunction called at unexpected time. " + + $"Expected it to be called on {StartDate} but was called on {Time}"); + } + } + + // sort descending by daily dollar volume + var sortedByDollarVolume = coarse.OrderByDescending(x => x.DollarVolume); + + // take the top entries from our sorted collection + var top = sortedByDollarVolume.Take(NumberOfSymbols); + + // we need to return only the symbol objects + return top.Select(x => x.Symbol); + } + + public void OnData(Slice data) + { + Log($"OnData({UtcTime:o}): Keys: {string.Join(", ", data.Keys.OrderBy(x => x))}"); + } + + public override void OnSecuritiesChanged(SecurityChanges changes) + { + Log($"OnSecuritiesChanged({UtcTime:o}):: {changes}"); + + // This should also happen right away + if (!_initialSelectionDone) + { + _initialSelectionDone = true; + + if (Time != StartDate) + { + throw new Exception($"OnSecuritiesChanged called at unexpected time. " + + $"Expected it to be called on {StartDate} but was called on {Time}"); + } + + if (changes.AddedSecurities.Count != NumberOfSymbols) + { + throw new Exception($"Unexpected number of added securities. " + + $"Expected {NumberOfSymbols} but was {changes.AddedSecurities.Count}"); + } + + if (changes.RemovedSecurities.Count != 0) + { + throw new Exception($"Unexpected number of removed securities. " + + $"Expected 0 but was {changes.RemovedSecurities.Count}"); + } + } + } + + /// + /// 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 Language[] Languages { get; } = { Language.CSharp }; + + /// + /// Data Points count of all timeslices of algorithm + /// + public long DataPoints => 35405; + + /// + /// Data Points count of the algorithm history + /// + public int AlgorithmHistoryDataPoints => 0; + + /// + /// 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 Trades", "0"}, + {"Average Win", "0%"}, + {"Average Loss", "0%"}, + {"Compounding Annual Return", "0%"}, + {"Drawdown", "0%"}, + {"Expectancy", "0"}, + {"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", "3.134"}, + {"Tracking Error", "0.097"}, + {"Treynor Ratio", "0"}, + {"Total Fees", "$0.00"}, + {"Estimated Strategy Capacity", "$0"}, + {"Lowest Capacity Asset", ""}, + {"Portfolio Turnover", "0%"}, + {"OrderListHash", "d41d8cd98f00b204e9800998ecf8427e"} + }; + } +} diff --git a/Algorithm.CSharp/ConstituentsUniverseImmediateSelectionRegressionAlgorithm.cs b/Algorithm.CSharp/ConstituentsUniverseImmediateSelectionRegressionAlgorithm.cs new file mode 100644 index 000000000000..950abf856dcf --- /dev/null +++ b/Algorithm.CSharp/ConstituentsUniverseImmediateSelectionRegressionAlgorithm.cs @@ -0,0 +1,142 @@ +/* + * 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.UniverseSelection; +using QuantConnect.Interfaces; + +namespace QuantConnect.Algorithm.CSharp +{ + /// + /// Assert that constituents universe selection happens right away after algorithm starts + /// + public class ConstituentsUniverseImmediateSelectionRegressionAlgorithm : QCAlgorithm, IRegressionAlgorithmDefinition + { + private readonly List _expectedConstituents = new() + { + QuantConnect.Symbol.Create("AAPL", SecurityType.Equity, Market.USA), + QuantConnect.Symbol.Create("QQQ", SecurityType.Equity, Market.USA) + }; + + private bool _securitiesChanged; + + public override void Initialize() + { + SetStartDate(2013, 10, 08); + SetEndDate(2013, 10, 09); + SetCash(100000); + + UniverseSettings.Resolution = Resolution.Daily; + + var customUniverseSymbol = new Symbol( + SecurityIdentifier.GenerateConstituentIdentifier( + "constituents-universe-qctest", + SecurityType.Equity, + Market.USA), + "constituents-universe-qctest"); + + AddUniverse(new ConstituentsUniverse(customUniverseSymbol, UniverseSettings)); + } + + public override void OnSecuritiesChanged(SecurityChanges changes) + { + if (!_securitiesChanged) + { + // Selection should be happening right on algorithm start + if (Time != StartDate) + { + throw new Exception($"Universe selection should have been triggered right away on {StartDate} " + + $"but happened on {Time}"); + } + + // Constituents should have been added to the algorithm + if (changes.AddedSecurities.Count != _expectedConstituents.Count) + { + throw new Exception($"Expected {_expectedConstituents.Count} stocks to be added to the algorithm, " + + $"instead added: {changes.AddedSecurities.Count}"); + } + + if (!_expectedConstituents.All(constituent => changes.AddedSecurities.Any(security => security.Symbol == constituent))) + { + throw new Exception("Not all constituents were added to the algorithm"); + } + + _securitiesChanged = true; + } + } + + public override void OnEndOfAlgorithm() + { + if (!_securitiesChanged) + { + throw new Exception("Expected events didn't happen"); + } + } + + /// + /// 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 Language[] Languages { get; } = { Language.CSharp }; + + /// + /// Data Points count of all timeslices of algorithm + /// + public long DataPoints => 28; + + /// + /// Data Points count of the algorithm history + /// + public int AlgorithmHistoryDataPoints => 0; + + /// + /// 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 Trades", "0"}, + {"Average Win", "0%"}, + {"Average Loss", "0%"}, + {"Compounding Annual Return", "0%"}, + {"Drawdown", "0%"}, + {"Expectancy", "0"}, + {"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/ConstituentsUniverseRegressionAlgorithm.cs b/Algorithm.CSharp/ConstituentsUniverseRegressionAlgorithm.cs index 526ba7211d19..eb0af731c5da 100644 --- a/Algorithm.CSharp/ConstituentsUniverseRegressionAlgorithm.cs +++ b/Algorithm.CSharp/ConstituentsUniverseRegressionAlgorithm.cs @@ -32,7 +32,7 @@ public class ConstituentsUniverseRegressionAlgorithm : QCAlgorithm, IRegressionA private readonly Symbol _fb = QuantConnect.Symbol.Create("FB", SecurityType.Equity, Market.USA); private int _step; - /// + /// /// Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized. /// public override void Initialize() @@ -168,7 +168,7 @@ public override void OnSecuritiesChanged(SecurityChanges changes) /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 59; + public long DataPoints => 52; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/ContinuousBackMonthRawFutureRegressionAlgorithm.cs b/Algorithm.CSharp/ContinuousBackMonthRawFutureRegressionAlgorithm.cs index 64e2b9857ae7..183d0ede35fb 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 => 712042; + public long DataPoints => 712043; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/ContinuousFutureBackMonthRegressionAlgorithm.cs b/Algorithm.CSharp/ContinuousFutureBackMonthRegressionAlgorithm.cs index 96aee8e11dc3..ed579dde6b0e 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 => 723521; + public long DataPoints => 723522; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/ContinuousFutureHistoryRegressionAlgorithm.cs b/Algorithm.CSharp/ContinuousFutureHistoryRegressionAlgorithm.cs index 302786356793..c3bd45730e1f 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 => 9949; + public virtual long DataPoints => 9956; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/ContinuousFutureHistoryTimeSpanWarmupRegressionAlgorithm.cs b/Algorithm.CSharp/ContinuousFutureHistoryTimeSpanWarmupRegressionAlgorithm.cs index 92acaccae679..522324c96cc3 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 => 14915; + public override long DataPoints => 15820; } } diff --git a/Algorithm.CSharp/ContinuousFutureImmediateUniverseSelectionRegressionAlgorithm.cs b/Algorithm.CSharp/ContinuousFutureImmediateUniverseSelectionRegressionAlgorithm.cs new file mode 100644 index 000000000000..0a28a6ce5231 --- /dev/null +++ b/Algorithm.CSharp/ContinuousFutureImmediateUniverseSelectionRegressionAlgorithm.cs @@ -0,0 +1,226 @@ +/* + * 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.Data; +using QuantConnect.Interfaces; +using QuantConnect.Securities; +using System.Collections.Generic; +using QuantConnect.Securities.Future; +using System; +using QuantConnect.Data.UniverseSelection; +using System.Linq; + +namespace QuantConnect.Algorithm.CSharp +{ + /// + /// Regression algorithm asserting that continuous future universe selection happens right away for all futures. + /// An example case is ES and Milk futures, which have different time zones. ES is in New York and Milk is in Chicago. + /// ES selection would happen first just because of this, but all futures should have a mapped contract right away. + /// + public class ContinuousFutureImmediateUniverseSelectionRegressionAlgorithm : QCAlgorithm, IRegressionAlgorithmDefinition + { + private Future _es; + private Future _milk; + + private bool _dataReceived; + + private DateTime _startDateUtc; + + private DateTime _esSelectionTimeUtc; + private DateTime _milkSelectionTimeUtc; + + private bool _securitiesChangedEventReceived; + + public override void Initialize() + { + SetStartDate(2013, 10, 7); + SetEndDate(2013, 10, 11); + + _startDateUtc = StartDate.ConvertToUtc(TimeZone); + + // ES time zone is New York + _es = AddFuture(Futures.Indices.SP500EMini, + dataNormalizationMode: DataNormalizationMode.BackwardsRatio, + dataMappingMode: DataMappingMode.OpenInterestAnnual, + contractDepthOffset: 0, + extendedMarketHours: true); + + // Milk time zone is Chicago, so market open will be after ES + _milk = AddFuture(Futures.Dairy.ClassIIIMilk, + dataNormalizationMode: DataNormalizationMode.BackwardsRatio, + dataMappingMode: DataMappingMode.OpenInterestAnnual, + contractDepthOffset: 0, + extendedMarketHours: true); + + _es.SetFilter(universe => + { + if (_esSelectionTimeUtc == DateTime.MinValue) + { + _esSelectionTimeUtc = universe.LocalTime.ConvertToUtc(_es.Exchange.TimeZone); + + if (_esSelectionTimeUtc != _startDateUtc) + { + throw new Exception($"Expected ES universe selection to happen on algorithm start ({_startDateUtc}), " + + $"but happened on {_esSelectionTimeUtc}"); + } + + } + + return universe.Select(x => x); + }); + + _milk.SetFilter(universe => + { + if (_milkSelectionTimeUtc == DateTime.MinValue) + { + _milkSelectionTimeUtc = universe.LocalTime.ConvertToUtc(_milk.Exchange.TimeZone); + + if (_milkSelectionTimeUtc != _startDateUtc) + { + throw new Exception($"Expected DC universe selection to happen on algorithm start ({_startDateUtc}), " + + $"but happened on {_milkSelectionTimeUtc}"); + } + } + + return universe.Select(x => x); + }); + } + + public override void OnData(Slice data) + { + _dataReceived = true; + + if (_es.Mapped == null) + { + throw new Exception("ES mapped contract is null"); + } + + // This is what we actually want to assert: even though Milk future time zone is 1 hour behind, + // we should have a mapped contract right away. + if (_milk.Mapped == null) + { + throw new Exception("DC mapped contract is null"); + } + + Log($"{data.Time} :: ES Mapped Contract: {_es.Mapped}. DC Mapped Contract: {_milk.Mapped}"); + } + + public override void OnSecuritiesChanged(SecurityChanges changes) + { + if (!_securitiesChangedEventReceived) + { + _securitiesChangedEventReceived = true; + + if (Time != StartDate) + { + throw new Exception($"Expected OnSecuritiesChanged to be called on algorithm start ({StartDate}), " + + $"but happened on {Time}"); + } + + if (_esSelectionTimeUtc == DateTime.MinValue) + { + throw new Exception("ES universe selection time was not set"); + } + + if (_milkSelectionTimeUtc == DateTime.MinValue) + { + throw new Exception("DC universe selection time was not set"); + } + + if (changes.AddedSecurities.Count == 0 || changes.RemovedSecurities.Count != 0) + { + throw new Exception($"Unexpected securities changes. Expected multiple securities added and none removed " + + $"but got {changes.AddedSecurities.Count} securities added and {changes.RemovedSecurities.Count} removed."); + } + + if (!changes.AddedSecurities.Any(x => !x.Symbol.IsCanonical() && x.Symbol.Canonical == _es.Symbol)) + { + throw new Exception($"Expected to find a multiple futures for ES"); + } + + if (!changes.AddedSecurities.Any(x => !x.Symbol.IsCanonical() && x.Symbol.Canonical == _milk.Symbol)) + { + throw new Exception($"Expected to find a multiple futures for DC"); + } + } + } + + public override void OnEndOfAlgorithm() + { + // Just a protection in case data is changed to make sure assertions in OnData were done. + if (!_dataReceived) + { + throw new Exception("No data was received so no checks were done"); + } + + if (!_securitiesChangedEventReceived) + { + throw new Exception("OnSecuritiesChanged was not called"); + } + } + + /// + /// 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 Language[] Languages { get; } = { Language.CSharp }; + + /// + /// Data Points count of all timeslices of algorithm + /// + public long DataPoints => 596351; + + /// + /// Data Points count of the algorithm history + /// + public int AlgorithmHistoryDataPoints => 0; + + /// + /// 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 Trades", "0"}, + {"Average Win", "0%"}, + {"Average Loss", "0%"}, + {"Compounding Annual Return", "0%"}, + {"Drawdown", "0%"}, + {"Expectancy", "0"}, + {"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", "-8.91"}, + {"Tracking Error", "0.223"}, + {"Treynor Ratio", "0"}, + {"Total Fees", "$0.00"}, + {"Estimated Strategy Capacity", "$0"}, + {"Lowest Capacity Asset", ""}, + {"Portfolio Turnover", "0%"}, + {"OrderListHash", "d41d8cd98f00b204e9800998ecf8427e"} + }; + } +} diff --git a/Algorithm.CSharp/ContinuousFutureLimitIfTouchedOrderRegressionAlgorithm.cs b/Algorithm.CSharp/ContinuousFutureLimitIfTouchedOrderRegressionAlgorithm.cs index 4f06b9fba112..10a887e36bb0 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 => 19876; + public long DataPoints => 19887; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/ContinuousFutureRegressionAlgorithm.cs b/Algorithm.CSharp/ContinuousFutureRegressionAlgorithm.cs index fb92ac275afc..c8540693dd1a 100644 --- a/Algorithm.CSharp/ContinuousFutureRegressionAlgorithm.cs +++ b/Algorithm.CSharp/ContinuousFutureRegressionAlgorithm.cs @@ -169,7 +169,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 713394; + public long DataPoints => 713395; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/ContinuousFuturesDailyRegressionAlgorithm.cs b/Algorithm.CSharp/ContinuousFuturesDailyRegressionAlgorithm.cs index 32fdc8634165..1b03099ad27c 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 => 1370; + public long DataPoints => 1371; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/CustomDataUniverseImmediateSelectionRegressionAlgorithm.cs b/Algorithm.CSharp/CustomDataUniverseImmediateSelectionRegressionAlgorithm.cs new file mode 100644 index 000000000000..0da55cc9b505 --- /dev/null +++ b/Algorithm.CSharp/CustomDataUniverseImmediateSelectionRegressionAlgorithm.cs @@ -0,0 +1,198 @@ +/* + * 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; + +namespace QuantConnect.Algorithm.CSharp +{ + /// + /// Assert that custom data universe selection happens right away after algorithm starts + /// + public class CustomDataUniverseImmediateSelectionRegressionAlgorithm : QCAlgorithm, IRegressionAlgorithmDefinition + { + private bool _selected; + private bool _securitiesChanged; + + private bool _firstOnData = true; + + public override void Initialize() + { + SetStartDate(2017, 07, 04); + SetEndDate(2018, 07, 04); + + UniverseSettings.Resolution = Resolution.Daily; + + AddUniverse("my-stock-data-source", stockDataSource => + { + _selected = true; + return stockDataSource.SelectMany(x => x.Symbols); + }); + } + + public override void OnData(Slice data) + { + if (_firstOnData) + { + if (!_selected) + { + throw new Exception("Universe selection should have been triggered right away. " + + "The first OnData call should have had happened after the universe selection"); + } + + _firstOnData = false; + } + } + + public override void OnSecuritiesChanged(SecurityChanges changes) + { + if (!_selected) + { + throw new Exception("Universe selection should have been triggered right away"); + } + + if (!_securitiesChanged) + { + // Selection should be happening right on algorithm start + if (Time != StartDate) + { + throw new Exception("Universe selection should have been triggered right away"); + } + + if (changes.AddedSecurities.Count == 0) + { + throw new Exception($"Expected multiple stocks to be added to the algorithm, " + + $"but found {changes.AddedSecurities.Count}"); + } + + _securitiesChanged = true; + } + } + + public override void OnEndOfAlgorithm() + { + if (_firstOnData || !_selected || !_securitiesChanged) + { + throw new Exception("Expected events didn't happen"); + } + } + + /// + /// Our custom data type that defines where to get and how to read our backtest and live data. + /// + class StockDataSource : BaseData + { + private const string Url = @"https://www.dropbox.com/s/ae1couew5ir3z9y/daily-stock-picker-backtest.csv?dl=1"; + + public List Symbols { get; set; } + + public StockDataSource() + { + Symbols = new List(); + } + + public override SubscriptionDataSource GetSource(SubscriptionDataConfig config, DateTime date, bool isLiveMode) + { + return new SubscriptionDataSource(Url, SubscriptionTransportMedium.RemoteFile); + } + + public override BaseData Reader(SubscriptionDataConfig config, string line, DateTime date, bool isLiveMode) + { + try + { + // create a new StockDataSource and set the symbol using config.Symbol + var stocks = new StockDataSource { Symbol = config.Symbol }; + // break our line into csv pieces + var csv = line.ToCsv(); + if (isLiveMode) + { + // our live mode format does not have a date in the first column, so use date parameter + stocks.Time = date; + stocks.Symbols.AddRange(csv); + } + else + { + // our backtest mode format has the first column as date, parse it + stocks.Time = DateTime.ParseExact(csv[0], "yyyyMMdd", null); + // any following comma separated values are symbols, save them off + stocks.Symbols.AddRange(csv.Skip(1)); + } + return stocks; + } + // return null if we encounter any errors + catch + { + return null; + } + } + } + + /// + /// 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 Language[] Languages { get; } = { Language.CSharp }; + + /// + /// Data Points count of all timeslices of algorithm + /// + public long DataPoints => 3287; + + /// + /// Data Points count of the algorithm history + /// + public int AlgorithmHistoryDataPoints => 0; + + /// + /// 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 Trades", "0"}, + {"Average Win", "0%"}, + {"Average Loss", "0%"}, + {"Compounding Annual Return", "0%"}, + {"Drawdown", "0%"}, + {"Expectancy", "0"}, + {"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.97"}, + {"Tracking Error", "0.104"}, + {"Treynor Ratio", "0"}, + {"Total Fees", "$0.00"}, + {"Estimated Strategy Capacity", "$0"}, + {"Lowest Capacity Asset", ""}, + {"Portfolio Turnover", "0%"}, + {"OrderListHash", "d41d8cd98f00b204e9800998ecf8427e"} + }; + } +} diff --git a/Algorithm.CSharp/CustomUniverseImmediateSelectionRegressionAlgorithm.cs b/Algorithm.CSharp/CustomUniverseImmediateSelectionRegressionAlgorithm.cs new file mode 100644 index 000000000000..1fc4e24e4670 --- /dev/null +++ b/Algorithm.CSharp/CustomUniverseImmediateSelectionRegressionAlgorithm.cs @@ -0,0 +1,165 @@ +/* + * 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; + +namespace QuantConnect.Algorithm.CSharp +{ + /// + /// Assert that custom universe selection happens right away after algorithm starts + /// + public class CustomUniverseImmediateSelectionRegressionAlgorithm : QCAlgorithm, IRegressionAlgorithmDefinition + { + private static readonly List ExpectedSymbols = new List() + { + QuantConnect.Symbol.Create("SPY", SecurityType.Equity, Market.USA), + QuantConnect.Symbol.Create("GOOG", SecurityType.Equity, Market.USA), + QuantConnect.Symbol.Create("APPL", SecurityType.Equity, Market.USA) + }; + + private bool _selected; + private bool _securitiesChanged; + + private bool _firstOnData = true; + + public override void Initialize() + { + SetStartDate(2013, 10, 07); + SetEndDate(2013, 10, 11); + + UniverseSettings.Resolution = Resolution.Daily; + + AddUniverse(SecurityType.Equity, + "my-custom-universe", + Resolution.Daily, + Market.USA, + UniverseSettings, + time => + { + _selected = true; + return new[] { "SPY", "GOOG", "APPL" }; + }); + } + + public override void OnData(Slice data) + { + if (_firstOnData) + { + if (!_selected) + { + throw new Exception("Universe selection should have been triggered right away. " + + "The first OnData call should have had happened after the universe selection"); + } + + _firstOnData = false; + } + } + + public override void OnSecuritiesChanged(SecurityChanges changes) + { + if (!_selected) + { + throw new Exception("Universe selection should have been triggered right away"); + } + + if (!_securitiesChanged) + { + // Selection should be happening right on algorithm start + if (Time != StartDate) + { + throw new Exception("Universe selection should have been triggered right away"); + } + + if (changes.AddedSecurities.Count != ExpectedSymbols.Count) + { + throw new Exception($"Expected {ExpectedSymbols.Count} stocks to be added to the algorithm, " + + $"but found {changes.AddedSecurities.Count}"); + } + + if (!ExpectedSymbols.All(x => changes.AddedSecurities.Any(security => security.Symbol == x))) + { + throw new Exception("Expected symbols were not added to the algorithm"); + } + + _securitiesChanged = true; + } + } + + public override void OnEndOfAlgorithm() + { + if (_firstOnData || !_selected || !_securitiesChanged) + { + throw new Exception("Expected events didn't happen"); + } + } + + /// + /// 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 Language[] Languages { get; } = { Language.CSharp }; + + /// + /// Data Points count of all timeslices of algorithm + /// + public long DataPoints => 52; + + /// + /// Data Points count of the algorithm history + /// + public int AlgorithmHistoryDataPoints => 0; + + /// + /// 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 Trades", "0"}, + {"Average Win", "0%"}, + {"Average Loss", "0%"}, + {"Compounding Annual Return", "0%"}, + {"Drawdown", "0%"}, + {"Expectancy", "0"}, + {"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", "-8.91"}, + {"Tracking Error", "0.223"}, + {"Treynor Ratio", "0"}, + {"Total Fees", "$0.00"}, + {"Estimated Strategy Capacity", "$0"}, + {"Lowest Capacity Asset", ""}, + {"Portfolio Turnover", "0%"}, + {"OrderListHash", "d41d8cd98f00b204e9800998ecf8427e"} + }; + } +} diff --git a/Algorithm.CSharp/DefaultFutureChainRegressionAlgorithm.cs b/Algorithm.CSharp/DefaultFutureChainRegressionAlgorithm.cs index 605e3338b011..c8c502c29be2 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 => 516630; + public long DataPoints => 516631; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/DelistedFutureLiquidateDailyRegressionAlgorithm.cs b/Algorithm.CSharp/DelistedFutureLiquidateDailyRegressionAlgorithm.cs index e0b1144bc001..b9d4e03f6b11 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 => 1817; + public override long DataPoints => 1818; /// /// This is used by the regression test system to indicate what the expected statistics are from running the algorithm diff --git a/Algorithm.CSharp/DelistedFutureLiquidateRegressionAlgorithm.cs b/Algorithm.CSharp/DelistedFutureLiquidateRegressionAlgorithm.cs index 4df18bfb86b4..7ddc3a73239c 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 => 525820; + public virtual long DataPoints => 525821; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/DelistingFutureOptionDailyRegressionAlgorithm.cs b/Algorithm.CSharp/DelistingFutureOptionDailyRegressionAlgorithm.cs index 1a2c9079ded5..0a8a85e742b7 100644 --- a/Algorithm.CSharp/DelistingFutureOptionDailyRegressionAlgorithm.cs +++ b/Algorithm.CSharp/DelistingFutureOptionDailyRegressionAlgorithm.cs @@ -29,7 +29,7 @@ public class DelistingFutureOptionDailyRegressionAlgorithm : DelistingFutureOpti /// /// Data Points count of all timeslices of algorithm /// - public override long DataPoints => 12061; + public override long DataPoints => 13091; /// /// 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 07c1a82d9f22..2ed57f7893cb 100644 --- a/Algorithm.CSharp/DelistingFutureOptionRegressionAlgorithm.cs +++ b/Algorithm.CSharp/DelistingFutureOptionRegressionAlgorithm.cs @@ -107,7 +107,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of all timeslices of algorithm /// - public virtual long DataPoints => 4180329; + public virtual long DataPoints => 4632713; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/ETFConstituentsFrameworkAlgorithm.cs b/Algorithm.CSharp/ETFConstituentsFrameworkAlgorithm.cs index 0f5d6a4600f8..42285ded7456 100644 --- a/Algorithm.CSharp/ETFConstituentsFrameworkAlgorithm.cs +++ b/Algorithm.CSharp/ETFConstituentsFrameworkAlgorithm.cs @@ -63,7 +63,7 @@ private protected IEnumerable ETFConstituentsFilter(IEnumerable /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 565; + public long DataPoints => 1072; /// /// Data Points count of the algorithm history @@ -75,31 +75,31 @@ private protected IEnumerable ETFConstituentsFilter(IEnumerable public Dictionary ExpectedStatistics => new Dictionary { - {"Total Trades", "7"}, - {"Average Win", "0%"}, + {"Total Trades", "9"}, + {"Average Win", "0.01%"}, {"Average Loss", "0%"}, - {"Compounding Annual Return", "61.105%"}, + {"Compounding Annual Return", "250.805%"}, {"Drawdown", "0.900%"}, {"Expectancy", "0"}, - {"Net Profit", "0.919%"}, - {"Sharpe Ratio", "4.7"}, - {"Sortino Ratio", "14.706"}, - {"Probabilistic Sharpe Ratio", "67.449%"}, + {"Net Profit", "2.436%"}, + {"Sharpe Ratio", "3.837"}, + {"Sortino Ratio", "10.614"}, + {"Probabilistic Sharpe Ratio", "63.620%"}, {"Loss Rate", "0%"}, - {"Win Rate", "0%"}, + {"Win Rate", "100%"}, {"Profit-Loss Ratio", "0"}, - {"Alpha", "0.618"}, - {"Beta", "-0.348"}, - {"Annual Standard Deviation", "0.1"}, - {"Annual Variance", "0.01"}, - {"Information Ratio", "0.41"}, - {"Tracking Error", "0.127"}, - {"Treynor Ratio", "-1.358"}, - {"Total Fees", "$7.02"}, - {"Estimated Strategy Capacity", "$350000000.00"}, + {"Alpha", "0.5"}, + {"Beta", "-0.357"}, + {"Annual Standard Deviation", "0.091"}, + {"Annual Variance", "0.008"}, + {"Information Ratio", "-0.581"}, + {"Tracking Error", "0.12"}, + {"Treynor Ratio", "-0.981"}, + {"Total Fees", "$9.05"}, + {"Estimated Strategy Capacity", "$400000000.00"}, {"Lowest Capacity Asset", "GOOCV VP83T1ZUHROL"}, - {"Portfolio Turnover", "13.71%"}, - {"OrderListHash", "908b83ae2348045279404245da2c80fb"} + {"Portfolio Turnover", "14.29%"}, + {"OrderListHash", "a63eaf2714dff836ee782737910949ea"} }; } } diff --git a/Algorithm.CSharp/EqualWeightingPortfolioConstructionModelFutureRegressionAlgorithm.cs b/Algorithm.CSharp/EqualWeightingPortfolioConstructionModelFutureRegressionAlgorithm.cs index 4779552efebe..92cb092a7d3d 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 => 94722; + public long DataPoints => 94724; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/FineFundamentalFilteredUniverseRegressionAlgorithm.cs b/Algorithm.CSharp/FineFundamentalFilteredUniverseRegressionAlgorithm.cs index 2ddad3073c41..e711161cd8ec 100644 --- a/Algorithm.CSharp/FineFundamentalFilteredUniverseRegressionAlgorithm.cs +++ b/Algorithm.CSharp/FineFundamentalFilteredUniverseRegressionAlgorithm.cs @@ -33,8 +33,8 @@ public class FineFundamentalFilteredUniverseRegressionAlgorithm : QCAlgorithm, I /// public override void Initialize() { - SetStartDate(2014, 10, 07); - SetEndDate(2014, 10, 11); + SetStartDate(2014, 10, 08); + SetEndDate(2014, 10, 13); UniverseSettings.Resolution = Resolution.Daily; @@ -83,7 +83,7 @@ public override void OnData(Slice data) /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 41; + public long DataPoints => 42; /// /// Data Points count of the algorithm history @@ -98,27 +98,27 @@ public override void OnData(Slice data) {"Total Trades", "1"}, {"Average Win", "0%"}, {"Average Loss", "0%"}, - {"Compounding Annual Return", "480.907%"}, - {"Drawdown", "0.300%"}, + {"Compounding Annual Return", "85.158%"}, + {"Drawdown", "1.200%"}, {"Expectancy", "0"}, - {"Net Profit", "1.947%"}, - {"Sharpe Ratio", "21.352"}, - {"Sortino Ratio", "0"}, - {"Probabilistic Sharpe Ratio", "0%"}, + {"Net Profit", "1.018%"}, + {"Sharpe Ratio", "-5.716"}, + {"Sortino Ratio", "-5.668"}, + {"Probabilistic Sharpe Ratio", "5.905%"}, {"Loss Rate", "0%"}, {"Win Rate", "0%"}, {"Profit-Loss Ratio", "0"}, - {"Alpha", "4.502"}, - {"Beta", "0.567"}, - {"Annual Standard Deviation", "0.192"}, - {"Annual Variance", "0.037"}, - {"Information Ratio", "30.843"}, - {"Tracking Error", "0.156"}, - {"Treynor Ratio", "7.237"}, + {"Alpha", "-0.278"}, + {"Beta", "0.13"}, + {"Annual Standard Deviation", "0.07"}, + {"Annual Variance", "0.005"}, + {"Information Ratio", "3.623"}, + {"Tracking Error", "0.143"}, + {"Treynor Ratio", "-3.05"}, {"Total Fees", "$22.30"}, {"Estimated Strategy Capacity", "$250000000.00"}, {"Lowest Capacity Asset", "AAPL R735QTJ8XC9X"}, - {"Portfolio Turnover", "24.44%"}, + {"Portfolio Turnover", "16.30%"}, {"OrderListHash", "daa236f8a387b8a6249285f1c3708ea4"} }; } diff --git a/Algorithm.CSharp/FutureChainInternalSubscriptionsRegressionAlgorithm.cs b/Algorithm.CSharp/FutureChainInternalSubscriptionsRegressionAlgorithm.cs index d175d069cda0..cbe555aefe2b 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 => 54136; + public long DataPoints => 54138; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/FutureMarketOpenAndCloseRegressionAlgorithm.cs b/Algorithm.CSharp/FutureMarketOpenAndCloseRegressionAlgorithm.cs index e6d49a05106e..b11b4102fa84 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 => 13587; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/FutureMarketOpenAndCloseWithExtendedMarketRegressionAlgorithm.cs b/Algorithm.CSharp/FutureMarketOpenAndCloseWithExtendedMarketRegressionAlgorithm.cs index 1a3e14535011..e9473eaef8a2 100644 --- a/Algorithm.CSharp/FutureMarketOpenAndCloseWithExtendedMarketRegressionAlgorithm.cs +++ b/Algorithm.CSharp/FutureMarketOpenAndCloseWithExtendedMarketRegressionAlgorithm.cs @@ -50,7 +50,7 @@ public class FutureMarketOpenAndCloseWithExtendedMarketRegressionAlgorithm : Fut /// /// Data Points count of all timeslices of algorithm /// - public override long DataPoints => 41466; + public override long DataPoints => 41467; /// /// 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 637d38f96fd6..2d73ff294f56 100644 --- a/Algorithm.CSharp/FutureMarketOpenConsolidatorRegressionAlgorithm.cs +++ b/Algorithm.CSharp/FutureMarketOpenConsolidatorRegressionAlgorithm.cs @@ -118,7 +118,7 @@ public void Assert(BaseData bar) /// /// Data Points count of all timeslices of algorithm /// - public virtual long DataPoints => 32062; + public virtual long DataPoints => 32073; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/FutureMarketOpenConsolidatorWithExtendedMarketRegressionAlgorithm.cs b/Algorithm.CSharp/FutureMarketOpenConsolidatorWithExtendedMarketRegressionAlgorithm.cs index 24b074938ce1..7f095d2b628c 100644 --- a/Algorithm.CSharp/FutureMarketOpenConsolidatorWithExtendedMarketRegressionAlgorithm.cs +++ b/Algorithm.CSharp/FutureMarketOpenConsolidatorWithExtendedMarketRegressionAlgorithm.cs @@ -52,7 +52,7 @@ public class FutureMarketOpenConsolidatorWithExtendedMarketRegressionAlgorithm : /// /// Data Points count of all timeslices of algorithm /// - public override long DataPoints => 103812; + public override long DataPoints => 103818; /// /// 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 b2f818b95af0..d550edd8016b 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 => 18491; + public long DataPoints => 18492; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/FutureOptionMultipleContractsInDifferentContractMonthsWithSameUnderlyingFutureRegressionAlgorithm.cs b/Algorithm.CSharp/FutureOptionMultipleContractsInDifferentContractMonthsWithSameUnderlyingFutureRegressionAlgorithm.cs index 405c67a8c1c0..2c527cc53d89 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 => 24376; + public long DataPoints => 24379; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/FutureSharingTickerRegressionAlgorithm.cs b/Algorithm.CSharp/FutureSharingTickerRegressionAlgorithm.cs index 5102665d6636..ed6736e90e48 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 => 51427; + public long DataPoints => 51429; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/FutureStopMarketOrderOnExtendedHoursRegressionAlgorithm.cs b/Algorithm.CSharp/FutureStopMarketOrderOnExtendedHoursRegressionAlgorithm.cs index 864e941eb076..27e65e162f90 100644 --- a/Algorithm.CSharp/FutureStopMarketOrderOnExtendedHoursRegressionAlgorithm.cs +++ b/Algorithm.CSharp/FutureStopMarketOrderOnExtendedHoursRegressionAlgorithm.cs @@ -113,7 +113,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of all time slices of algorithm /// - public long DataPoints => 75955; + public long DataPoints => 75961; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/FuturesExpiredContractRegression.cs b/Algorithm.CSharp/FuturesExpiredContractRegression.cs index 27c247ef5219..ff37012e68a6 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 => 268284; + public long DataPoints => 268285; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/FuturesExtendedMarketHoursRegressionAlgorithm.cs b/Algorithm.CSharp/FuturesExtendedMarketHoursRegressionAlgorithm.cs index 39ca0d9373bd..2b3000779dd4 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 => 3602; + public long DataPoints => 3632; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/FuturesFrameworkRegressionAlgorithm.cs b/Algorithm.CSharp/FuturesFrameworkRegressionAlgorithm.cs index eba08d7ec41c..3396d3a6c22b 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 => 126804; + public virtual long DataPoints => 126806; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/HistoryWithDifferentContinuousContractDepthOffsetsRegressionAlgorithm.cs b/Algorithm.CSharp/HistoryWithDifferentContinuousContractDepthOffsetsRegressionAlgorithm.cs index 68a0c8463869..4f12e8485fab 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 => 1567; + public long DataPoints => 1578; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/HistoryWithDifferentDataMappingModeRegressionAlgorithm.cs b/Algorithm.CSharp/HistoryWithDifferentDataMappingModeRegressionAlgorithm.cs index a0a41c072567..b309f4dbe4e7 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 => 1567; + public long DataPoints => 1578; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/LimitOrdersAreFilledAfterHoursForFuturesRegressionAlgorithm.cs b/Algorithm.CSharp/LimitOrdersAreFilledAfterHoursForFuturesRegressionAlgorithm.cs index 4bd6bc051b66..c642ff188dfe 100644 --- a/Algorithm.CSharp/LimitOrdersAreFilledAfterHoursForFuturesRegressionAlgorithm.cs +++ b/Algorithm.CSharp/LimitOrdersAreFilledAfterHoursForFuturesRegressionAlgorithm.cs @@ -113,7 +113,7 @@ public override void OnOrderEvent(OrderEvent orderEvent) /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 82366; + public long DataPoints => 82372; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/MarketOrdersAreSupportedOnExtendedHoursForFuturesRegressionAlgorithm.cs b/Algorithm.CSharp/MarketOrdersAreSupportedOnExtendedHoursForFuturesRegressionAlgorithm.cs index d50f56267d49..ef57c395a09d 100644 --- a/Algorithm.CSharp/MarketOrdersAreSupportedOnExtendedHoursForFuturesRegressionAlgorithm.cs +++ b/Algorithm.CSharp/MarketOrdersAreSupportedOnExtendedHoursForFuturesRegressionAlgorithm.cs @@ -90,7 +90,7 @@ public override void OnOrderEvent(OrderEvent orderEvent) /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 82366; + public long DataPoints => 82372; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/OpenInterestFuturesRegressionAlgorithm.cs b/Algorithm.CSharp/OpenInterestFuturesRegressionAlgorithm.cs index 855304f94710..b64712b9a6c3 100644 --- a/Algorithm.CSharp/OpenInterestFuturesRegressionAlgorithm.cs +++ b/Algorithm.CSharp/OpenInterestFuturesRegressionAlgorithm.cs @@ -92,7 +92,7 @@ public override void OnData(Slice slice) /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 2794075; + public long DataPoints => 2794076; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/OptionChainUniverseImmediateSelectionRegressionAlgorithm.cs b/Algorithm.CSharp/OptionChainUniverseImmediateSelectionRegressionAlgorithm.cs new file mode 100644 index 000000000000..23202a96f031 --- /dev/null +++ b/Algorithm.CSharp/OptionChainUniverseImmediateSelectionRegressionAlgorithm.cs @@ -0,0 +1,209 @@ +/* + * 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; + +namespace QuantConnect.Algorithm.CSharp +{ + /// + /// Asserts that Option Chain universe selection happens right away after algorithm starts and a bar of the underlying is received + /// + public class OptionChainUniverseImmediateSelectionRegressionAlgorithm : QCAlgorithm, IRegressionAlgorithmDefinition + { + private Symbol _optionSymbol; + + private bool _firstOnDataCallDone; + private int _securityChangesCallCount; + + private DateTime _selectionTimeUtc; + + private int _selectedOptionsCount; + + public override void Initialize() + { + SetStartDate(2015, 12, 24); + SetEndDate(2015, 12, 24); + SetCash(10000); + + var option = AddOption("GOOG", Resolution.Minute); + + _optionSymbol = option.Symbol; + + option.SetFilter(universe => + { + if (_selectionTimeUtc == DateTime.MinValue) + { + _selectionTimeUtc = universe.LocalTime.ConvertToUtc(option.Exchange.TimeZone); + + if (_firstOnDataCallDone) + { + throw new Exception("Option chain universe selection time was set after OnData was called"); + } + } + + var selection = universe + .IncludeWeeklys() + .Strikes(-2, +2) + .Expiration(TimeSpan.Zero, TimeSpan.FromDays(10)); + + _selectedOptionsCount = selection.Count(); + + return selection; + }); + + SetBenchmark(x => 0); + } + + public override void OnData(Slice slice) + { + if (!_firstOnDataCallDone) + { + _firstOnDataCallDone = true; + + if (!slice.ContainsKey(_optionSymbol.Underlying)) + { + throw new Exception($"Expected to find {_optionSymbol.Underlying} in first slice"); + } + + if (!slice.OptionChains.ContainsKey(_optionSymbol)) + { + throw new Exception($"Expected to find {_optionSymbol} in first slice's Option Chain"); + } + } + } + + public override void OnSecuritiesChanged(SecurityChanges changes) + { + Log($"{Time} :: {changes}"); + _securityChangesCallCount++; + + if (_securityChangesCallCount <= 2 && _firstOnDataCallDone) + { + throw new Exception("Expected 2 OnSecuritiesChanged calls (Underlying addition + Options additions) " + + "before the first data is sent to the algorithm"); + } + + if (_securityChangesCallCount == 1) + { + // The first time, only the underlying should have been added + if (changes.AddedSecurities.Count != 1 || changes.RemovedSecurities.Count != 0) + { + throw new Exception($"Unexpected securities changes on first OnSecuritiesChanged event. " + + $"Expected one security added and none removed but got {changes.AddedSecurities.Count} securities added " + + $"and {changes.RemovedSecurities.Count} removed."); + } + + var addedSecuritySymbol = changes.AddedSecurities.Single().Symbol; + if (addedSecuritySymbol != _optionSymbol.Underlying) + { + throw new Exception($"Expected to find {_optionSymbol.Underlying} in first OnSecuritiesChanged event, " + + $"but found {addedSecuritySymbol}"); + } + } + else if (_securityChangesCallCount == 2) + { + var expectedSelectionTime = StartDate.Add(Securities[_optionSymbol].Resolution.ToTimeSpan()); + + if (_selectionTimeUtc == DateTime.MinValue) + { + throw new Exception("Option chain universe selection time was not set"); + } + + if (changes.AddedSecurities.Count != _selectedOptionsCount || changes.RemovedSecurities.Count != 0) + { + throw new Exception($"Unexpected securities changes on second OnSecuritiesChanged event. " + + $"Expected {_selectedOptionsCount} options added and none removed but got {changes.AddedSecurities.Count} " + + $"securities added and {changes.RemovedSecurities.Count} removed."); + } + + if (!changes.AddedSecurities.All(x => x.Type.IsOption() && !x.Symbol.IsCanonical() && x.Symbol.Canonical == _optionSymbol)) + { + throw new Exception($"Expected to find a multiple option contracts"); + } + } + } + + public override void OnEndOfAlgorithm() + { + if (!_firstOnDataCallDone) + { + throw new Exception("OnData was never called"); + } + + if (_securityChangesCallCount < 2) + { + throw new Exception("OnSecuritiesChanged was not called at least twice"); + } + } + + /// + /// 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 Language[] Languages { get; } = { Language.CSharp }; + + /// + /// Data Points count of all timeslices of algorithm + /// + public long DataPoints => 470437; + + /// + /// Data Points count of the algorithm history + /// + public int AlgorithmHistoryDataPoints => 0; + + /// + /// 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 Trades", "0"}, + {"Average Win", "0%"}, + {"Average Loss", "0%"}, + {"Compounding Annual Return", "0%"}, + {"Drawdown", "0%"}, + {"Expectancy", "0"}, + {"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/RegressionTests/Universes/ETFConstituentUniverseCompositeDelistingRegressionAlgorithm.cs b/Algorithm.CSharp/RegressionTests/Universes/ETFConstituentUniverseCompositeDelistingRegressionAlgorithm.cs index 5e8040a8836c..55a32dc3991f 100644 --- a/Algorithm.CSharp/RegressionTests/Universes/ETFConstituentUniverseCompositeDelistingRegressionAlgorithm.cs +++ b/Algorithm.CSharp/RegressionTests/Universes/ETFConstituentUniverseCompositeDelistingRegressionAlgorithm.cs @@ -34,9 +34,10 @@ public class ETFConstituentUniverseCompositeDelistingRegressionAlgorithm : QCAlg private Symbol _aapl; private DateTime _delistingDate; private int _universeSymbolCount; + private bool _universeSelectionDone; private bool _universeAdded; private bool _universeRemoved; - + /// /// Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized. /// @@ -45,9 +46,9 @@ public override void Initialize() SetStartDate(2020, 12, 1); SetEndDate(2021, 1, 31); SetCash(100000); - + UniverseSettings.Resolution = Resolution.Hour; - + _delistingDate = new DateTime(2021, 1, 21); _aapl = AddEquity("AAPL", Resolution.Hour).Symbol; @@ -61,19 +62,21 @@ public override void Initialize() Log("Adding ETF constituent universe Symbol by using Symbol.Create(...)"); _gdvd = QuantConnect.Symbol.Create("GDVD", SecurityType.Equity, Market.USA); } - + AddUniverse(Universe.ETF(_gdvd, universeFilterFunc: FilterETFs)); } private IEnumerable FilterETFs(IEnumerable constituents) { + _universeSelectionDone = true; + if (UtcTime.Date > _delistingDate) { throw new Exception($"Performing constituent universe selection on {UtcTime:yyyy-MM-dd HH:mm:ss.fff} after composite ETF has been delisted"); } - var constituentSymbols = constituents.Select(x => x.Symbol).ToList(); - _universeSymbolCount = constituentSymbols.Count; + var constituentSymbols = constituents.Select(x => x.Symbol); + _universeSymbolCount = constituentSymbols.Distinct().Count(); return constituentSymbols; } @@ -102,11 +105,21 @@ public override void OnSecuritiesChanged(SecurityChanges changes) throw new Exception("New securities added after ETF constituents were delisted"); } - _universeAdded |= changes.AddedSecurities.Count >= _universeSymbolCount; - // TODO: shouldn't be sending AAPL as a removed security since it was added by another unvierse - // if we added the etf subscription it will get delisted and send us a removal event - var adjusment = AddETFSubscription ? 0 : -1; - _universeRemoved |= changes.RemovedSecurities.Count == _universeSymbolCount + adjusment && UtcTime.Date >= _delistingDate && UtcTime.Date < EndDate; + // if we added the etf subscription it will get added and delisted and send us a addition/removal event + var adjusment = AddETFSubscription ? 1 : 0; + var expectedChangesCount = _universeSymbolCount + adjusment; + + if (_universeSelectionDone) + { + // "_universeSymbolCount + 1" because selection is done right away, + // so AddedSecurities includes all ETF constituents (including APPL) plus GDVD + _universeAdded |= changes.AddedSecurities.Count == expectedChangesCount; + } + + // TODO: shouldn't be sending AAPL as a removed security since it was added by another universe + _universeRemoved |= changes.RemovedSecurities.Count == expectedChangesCount && + UtcTime.Date >= _delistingDate && + UtcTime.Date < EndDate; } public override void OnEndOfAlgorithm() @@ -138,7 +151,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of all timeslices of algorithm /// - public virtual long DataPoints => 825; + public virtual long DataPoints => 692; /// /// Data Points count of the algorithm history @@ -153,28 +166,28 @@ public override void OnEndOfAlgorithm() {"Total Trades", "1"}, {"Average Win", "0%"}, {"Average Loss", "0%"}, - {"Compounding Annual Return", "26.315%"}, + {"Compounding Annual Return", "30.084%"}, {"Drawdown", "5.400%"}, {"Expectancy", "0"}, - {"Net Profit", "3.893%"}, - {"Sharpe Ratio", "1.291"}, - {"Sortino Ratio", "1.876"}, - {"Probabilistic Sharpe Ratio", "53.929%"}, + {"Net Profit", "4.393%"}, + {"Sharpe Ratio", "1.543"}, + {"Sortino Ratio", "2.111"}, + {"Probabilistic Sharpe Ratio", "58.028%"}, {"Loss Rate", "0%"}, {"Win Rate", "0%"}, {"Profit-Loss Ratio", "0"}, - {"Alpha", "0.13"}, - {"Beta", "0.697"}, - {"Annual Standard Deviation", "0.139"}, + {"Alpha", "0.166"}, + {"Beta", "0.717"}, + {"Annual Standard Deviation", "0.136"}, {"Annual Variance", "0.019"}, - {"Information Ratio", "0.889"}, - {"Tracking Error", "0.122"}, - {"Treynor Ratio", "0.257"}, - {"Total Fees", "$2.04"}, - {"Estimated Strategy Capacity", "$260000000.00"}, + {"Information Ratio", "1.254"}, + {"Tracking Error", "0.118"}, + {"Treynor Ratio", "0.293"}, + {"Total Fees", "$2.06"}, + {"Estimated Strategy Capacity", "$160000000.00"}, {"Lowest Capacity Asset", "AAPL R735QTJ8XC9X"}, {"Portfolio Turnover", "0.83%"}, - {"OrderListHash", "d125adb907e6ca8b4c6ec06fbdcf986a"} + {"OrderListHash", "8a541d0d9c3e9b7e39733dbccc19eea5"} }; } } diff --git a/Algorithm.CSharp/RegressionTests/Universes/ETFConstituentUniverseCompositeDelistingRegressionAlgorithmNoAddEquityETF.cs b/Algorithm.CSharp/RegressionTests/Universes/ETFConstituentUniverseCompositeDelistingRegressionAlgorithmNoAddEquityETF.cs index 4258ce56538e..fb03ef7ce50d 100644 --- a/Algorithm.CSharp/RegressionTests/Universes/ETFConstituentUniverseCompositeDelistingRegressionAlgorithmNoAddEquityETF.cs +++ b/Algorithm.CSharp/RegressionTests/Universes/ETFConstituentUniverseCompositeDelistingRegressionAlgorithmNoAddEquityETF.cs @@ -13,14 +13,6 @@ * limitations under the License. */ -using System; -using System.Collections.Generic; -using System.Linq; -using QuantConnect.Data; -using QuantConnect.Data.Custom.IconicTypes; -using QuantConnect.Data.UniverseSelection; -using QuantConnect.Interfaces; - namespace QuantConnect.Algorithm.CSharp { /// @@ -34,7 +26,7 @@ public class ETFConstituentUniverseCompositeDelistingRegressionAlgorithmNoAddEqu /// /// Data Points count of all timeslices of algorithm /// - public override long DataPoints => 623; + public override long DataPoints => 511; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/RegressionTests/Universes/ETFConstituentUniverseFilterFunctionRegressionAlgorithm.cs b/Algorithm.CSharp/RegressionTests/Universes/ETFConstituentUniverseFilterFunctionRegressionAlgorithm.cs index 65d1978764a6..e371951b23e8 100644 --- a/Algorithm.CSharp/RegressionTests/Universes/ETFConstituentUniverseFilterFunctionRegressionAlgorithm.cs +++ b/Algorithm.CSharp/RegressionTests/Universes/ETFConstituentUniverseFilterFunctionRegressionAlgorithm.cs @@ -159,13 +159,13 @@ public override void OnSecuritiesChanged(SecurityChanges changes) /// An expected event didn't happen public override void OnEndOfAlgorithm() { - if (_rebalanceCount != 1) + if (_rebalanceCount != 2) { - throw new Exception($"Expected 1 rebalance, instead rebalanced: {_rebalanceCount}"); + throw new Exception($"Expected 2 rebalances, instead rebalanced: {_rebalanceCount}"); } - if (_rebalanceAssetCount != 4) + if (_rebalanceAssetCount != 8) { - throw new Exception($"Invested in {_rebalanceAssetCount} assets (expected 4)"); + throw new Exception($"Invested in {_rebalanceAssetCount} assets (expected 8)"); } if (!_filtered) { @@ -194,7 +194,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 2191; + public long DataPoints => 2722; /// /// Data Points count of the algorithm history @@ -209,13 +209,13 @@ public override void OnEndOfAlgorithm() {"Total Trades", "4"}, {"Average Win", "0%"}, {"Average Loss", "0%"}, - {"Compounding Annual Return", "2.118%"}, + {"Compounding Annual Return", "1.989%"}, {"Drawdown", "0.600%"}, {"Expectancy", "0"}, - {"Net Profit", "0.343%"}, - {"Sharpe Ratio", "0.856"}, - {"Sortino Ratio", "1.148"}, - {"Probabilistic Sharpe Ratio", "50.428%"}, + {"Net Profit", "0.323%"}, + {"Sharpe Ratio", "0.838"}, + {"Sortino Ratio", "1.122"}, + {"Probabilistic Sharpe Ratio", "50.081%"}, {"Loss Rate", "0%"}, {"Win Rate", "0%"}, {"Profit-Loss Ratio", "0"}, @@ -223,14 +223,14 @@ public override void OnEndOfAlgorithm() {"Beta", "0.098"}, {"Annual Standard Deviation", "0.014"}, {"Annual Variance", "0"}, - {"Information Ratio", "-0.611"}, + {"Information Ratio", "-0.614"}, {"Tracking Error", "0.096"}, - {"Treynor Ratio", "0.125"}, + {"Treynor Ratio", "0.123"}, {"Total Fees", "$4.00"}, - {"Estimated Strategy Capacity", "$100000000.00"}, + {"Estimated Strategy Capacity", "$130000000.00"}, {"Lowest Capacity Asset", "AIG R735QTJ8XC9X"}, {"Portfolio Turnover", "0.13%"}, - {"OrderListHash", "5ed612b5a5ec43f4e53f064cc0cec044"} + {"OrderListHash", "1294267a5fcce8d828a8ccfa6f2cf5a2"} }; } } diff --git a/Algorithm.CSharp/RegressionTests/Universes/ETFConstituentUniverseFrameworkRegressionAlgorithm.cs b/Algorithm.CSharp/RegressionTests/Universes/ETFConstituentUniverseFrameworkRegressionAlgorithm.cs index fe59a8360e0f..56480b876a55 100644 --- a/Algorithm.CSharp/RegressionTests/Universes/ETFConstituentUniverseFrameworkRegressionAlgorithm.cs +++ b/Algorithm.CSharp/RegressionTests/Universes/ETFConstituentUniverseFrameworkRegressionAlgorithm.cs @@ -205,7 +205,7 @@ public void Execute(QCAlgorithm algorithm, IPortfolioTarget[] targets) /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 1905; + public long DataPoints => 2436; /// /// Data Points count of the algorithm history @@ -220,28 +220,28 @@ public void Execute(QCAlgorithm algorithm, IPortfolioTarget[] targets) {"Total Trades", "3"}, {"Average Win", "0%"}, {"Average Loss", "0%"}, - {"Compounding Annual Return", "3.252%"}, - {"Drawdown", "0.800%"}, + {"Compounding Annual Return", "3.006%"}, + {"Drawdown", "0.700%"}, {"Expectancy", "0"}, - {"Net Profit", "0.525%"}, - {"Sharpe Ratio", "1.118"}, - {"Sortino Ratio", "1.623"}, - {"Probabilistic Sharpe Ratio", "54.664%"}, + {"Net Profit", "0.485%"}, + {"Sharpe Ratio", "1.055"}, + {"Sortino Ratio", "1.53"}, + {"Probabilistic Sharpe Ratio", "53.609%"}, {"Loss Rate", "0%"}, {"Win Rate", "0%"}, {"Profit-Loss Ratio", "0"}, - {"Alpha", "0.013"}, - {"Beta", "0.1"}, - {"Annual Standard Deviation", "0.018"}, + {"Alpha", "0.012"}, + {"Beta", "0.096"}, + {"Annual Standard Deviation", "0.017"}, {"Annual Variance", "0"}, - {"Information Ratio", "-0.526"}, + {"Information Ratio", "-0.544"}, {"Tracking Error", "0.096"}, - {"Treynor Ratio", "0.203"}, + {"Treynor Ratio", "0.191"}, {"Total Fees", "$3.00"}, - {"Estimated Strategy Capacity", "$1200000000.00"}, + {"Estimated Strategy Capacity", "$1400000000.00"}, {"Lowest Capacity Asset", "IBM R735QTJ8XC9X"}, {"Portfolio Turnover", "0.12%"}, - {"OrderListHash", "8e078b6ebb55270f9faa460ee56029a7"} + {"OrderListHash", "6ab770c88a53e1f488512a41c104a744"} }; } } diff --git a/Algorithm.CSharp/RegressionTests/Universes/ETFConstituentUniverseImmediateSelectionRegressionAlgorithm.cs b/Algorithm.CSharp/RegressionTests/Universes/ETFConstituentUniverseImmediateSelectionRegressionAlgorithm.cs new file mode 100644 index 000000000000..e482e9eef10c --- /dev/null +++ b/Algorithm.CSharp/RegressionTests/Universes/ETFConstituentUniverseImmediateSelectionRegressionAlgorithm.cs @@ -0,0 +1,186 @@ +/* + * 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; + +namespace QuantConnect.Algorithm.CSharp +{ + /// + /// Assert that ETF universe selection happens right away after algorithm starts + /// + public class ETFConstituentUniverseImmediateSelectionRegressionAlgorithm : QCAlgorithm, IRegressionAlgorithmDefinition + { + private List _constituents = new(); + + private Symbol _spy; + private bool _filtered; + private bool _securitiesChanged; + + private bool _firstOnData = true; + + /// + /// Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized. + /// + public override void Initialize() + { + SetStartDate(2020, 12, 1); + SetEndDate(2021, 1, 31); + SetCash(100000); + + UniverseSettings.Resolution = Resolution.Hour; + + _spy = AddEquity("SPY", Resolution.Hour).Symbol; + AddUniverse(Universe.ETF(_spy, universeFilterFunc: FilterETFs)); + } + + /// + /// Filters ETFs, performing some sanity checks + /// + /// Constituents of the ETF universe added above + /// Constituent Symbols to add to algorithm + /// Constituents collection was not structured as expected + private IEnumerable FilterETFs(IEnumerable constituents) + { + _filtered = true; + _constituents = constituents.Select(x => x.Symbol).Distinct().ToList(); + + return _constituents; + } + + /// + /// OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here. + /// + /// Slice object keyed by symbol containing the stock data + public override void OnData(Slice data) + { + if (_firstOnData) + { + if (!_filtered) + { + throw new Exception("Universe selection should have been triggered right away. " + + "The first OnData call should have had happened after the universe selection"); + } + + _firstOnData = false; + } + } + + /// + /// Checks if new securities have been added to the algorithm after universe selection has occurred + /// + /// Security changes + /// Expected number of stocks were not added to the algorithm + public override void OnSecuritiesChanged(SecurityChanges changes) + { + if (!_filtered) + { + throw new Exception("Universe selection should have been triggered right away"); + } + + if (!_securitiesChanged) + { + // Selection should be happening right on algorithm start + if (Time != StartDate) + { + throw new Exception("Universe selection should have been triggered right away"); + } + + // All constituents should have been added to the algorithm. + // Plus the ETF itself. + if (changes.AddedSecurities.Count != _constituents.Count + 1) + { + throw new Exception($"Expected {_constituents.Count + 1} stocks to be added to the algorithm, " + + $"instead added: {changes.AddedSecurities.Count}"); + } + + if (!_constituents.All(constituent => changes.AddedSecurities.Any(security => security.Symbol == constituent))) + { + throw new Exception("Not all constituents were added to the algorithm"); + } + + _securitiesChanged = true; + } + } + + /// + /// Ensures that all expected events were triggered by the end of the algorithm + /// + /// An expected event didn't happen + public override void OnEndOfAlgorithm() + { + if (_firstOnData || !_filtered || !_securitiesChanged) + { + throw new Exception("Expected events didn't happen"); + } + } + + /// + /// 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 Language[] Languages { get; } = { Language.CSharp }; + + /// + /// Data Points count of all timeslices of algorithm + /// + public long DataPoints => 2722; + + /// + /// Data Points count of the algorithm history + /// + public int AlgorithmHistoryDataPoints => 0; + + /// + /// 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 Trades", "0"}, + {"Average Win", "0%"}, + {"Average Loss", "0%"}, + {"Compounding Annual Return", "0%"}, + {"Drawdown", "0%"}, + {"Expectancy", "0"}, + {"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.695"}, + {"Tracking Error", "0.105"}, + {"Treynor Ratio", "0"}, + {"Total Fees", "$0.00"}, + {"Estimated Strategy Capacity", "$0"}, + {"Lowest Capacity Asset", ""}, + {"Portfolio Turnover", "0%"}, + {"OrderListHash", "d41d8cd98f00b204e9800998ecf8427e"} + }; + } +} diff --git a/Algorithm.CSharp/RegressionTests/Universes/ETFConstituentUniverseMappedCompositeRegressionAlgorithm.cs b/Algorithm.CSharp/RegressionTests/Universes/ETFConstituentUniverseMappedCompositeRegressionAlgorithm.cs index 089ecda92e48..119110f0e1b1 100644 --- a/Algorithm.CSharp/RegressionTests/Universes/ETFConstituentUniverseMappedCompositeRegressionAlgorithm.cs +++ b/Algorithm.CSharp/RegressionTests/Universes/ETFConstituentUniverseMappedCompositeRegressionAlgorithm.cs @@ -157,7 +157,7 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 759; + public long DataPoints => 626; /// /// Data Points count of the algorithm history @@ -182,13 +182,13 @@ public override void OnEndOfAlgorithm() {"Loss Rate", "0%"}, {"Win Rate", "0%"}, {"Profit-Loss Ratio", "0"}, - {"Alpha", "-0.118"}, - {"Beta", "0.445"}, + {"Alpha", "-0.084"}, + {"Beta", "0.591"}, {"Annual Standard Deviation", "0.078"}, {"Annual Variance", "0.006"}, - {"Information Ratio", "-2.01"}, - {"Tracking Error", "0.086"}, - {"Treynor Ratio", "-0.166"}, + {"Information Ratio", "-1.408"}, + {"Tracking Error", "0.065"}, + {"Treynor Ratio", "-0.125"}, {"Total Fees", "$22.93"}, {"Estimated Strategy Capacity", "$75000000.00"}, {"Lowest Capacity Asset", "AAPL R735QTJ8XC9X"}, diff --git a/Algorithm.CSharp/RegressionTests/Universes/ETFConstituentUniverseRSIAlphaModelAlgorithm.cs b/Algorithm.CSharp/RegressionTests/Universes/ETFConstituentUniverseRSIAlphaModelAlgorithm.cs index 107a7f9aac7f..52df54ab4e8d 100644 --- a/Algorithm.CSharp/RegressionTests/Universes/ETFConstituentUniverseRSIAlphaModelAlgorithm.cs +++ b/Algorithm.CSharp/RegressionTests/Universes/ETFConstituentUniverseRSIAlphaModelAlgorithm.cs @@ -201,7 +201,7 @@ public SymbolData(Symbol symbol, QCAlgorithm algorithm, ETFConstituentData const /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 2191; + public long DataPoints => 2722; /// /// Data Points count of the algorithm history @@ -213,31 +213,31 @@ public SymbolData(Symbol symbol, QCAlgorithm algorithm, ETFConstituentData const /// public Dictionary ExpectedStatistics => new Dictionary { - {"Total Trades", "50"}, - {"Average Win", "0.10%"}, + {"Total Trades", "55"}, + {"Average Win", "0.09%"}, {"Average Loss", "-0.05%"}, - {"Compounding Annual Return", "4.184%"}, + {"Compounding Annual Return", "3.321%"}, {"Drawdown", "0.500%"}, - {"Expectancy", "0.100"}, - {"Net Profit", "0.672%"}, - {"Sharpe Ratio", "1.754"}, - {"Sortino Ratio", "2.447"}, - {"Probabilistic Sharpe Ratio", "66.775%"}, - {"Loss Rate", "61%"}, - {"Win Rate", "39%"}, - {"Profit-Loss Ratio", "1.84"}, - {"Alpha", "0.028"}, + {"Expectancy", "0.047"}, + {"Net Profit", "0.535%"}, + {"Sharpe Ratio", "1.377"}, + {"Sortino Ratio", "1.963"}, + {"Probabilistic Sharpe Ratio", "60.081%"}, + {"Loss Rate", "63%"}, + {"Win Rate", "37%"}, + {"Profit-Loss Ratio", "1.83"}, + {"Alpha", "0.022"}, {"Beta", "-0.024"}, {"Annual Standard Deviation", "0.015"}, {"Annual Variance", "0"}, - {"Information Ratio", "-0.404"}, + {"Information Ratio", "-0.46"}, {"Tracking Error", "0.109"}, - {"Treynor Ratio", "-1.103"}, - {"Total Fees", "$50.00"}, - {"Estimated Strategy Capacity", "$430000000.00"}, + {"Treynor Ratio", "-0.878"}, + {"Total Fees", "$55.00"}, + {"Estimated Strategy Capacity", "$440000000.00"}, {"Lowest Capacity Asset", "AAPL R735QTJ8XC9X"}, - {"Portfolio Turnover", "10.40%"}, - {"OrderListHash", "9b0ce617ee9d4ecef44156cbc96d93dc"} + {"Portfolio Turnover", "11.16%"}, + {"OrderListHash", "f812bfd22719be4f329ccb2eecc527a1"} }; } } diff --git a/Algorithm.CSharp/SetDataNormalizationModeOnAddSecurityAlgorithm.cs b/Algorithm.CSharp/SetDataNormalizationModeOnAddSecurityAlgorithm.cs index 80043123e319..530522e9afe6 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 => 7316; + public long DataPoints => 7317; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/SetHoldingsFutureRegressionAlgorithm.cs b/Algorithm.CSharp/SetHoldingsFutureRegressionAlgorithm.cs index 2714b64a9333..8ad21d28e638 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 => 21664; + public long DataPoints => 21665; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/UniverseOnlyRegressionAlgorithm.cs b/Algorithm.CSharp/UniverseOnlyRegressionAlgorithm.cs index 241e9558f99a..49b4e1a5fa12 100644 --- a/Algorithm.CSharp/UniverseOnlyRegressionAlgorithm.cs +++ b/Algorithm.CSharp/UniverseOnlyRegressionAlgorithm.cs @@ -68,7 +68,7 @@ private IEnumerable FilterUniverse(IEnumerable const /// /// Data Points count of all timeslices of algorithm /// - public long DataPoints => 118; + public long DataPoints => 62; /// /// Data Points count of the algorithm history @@ -97,8 +97,8 @@ private IEnumerable FilterUniverse(IEnumerable const {"Beta", "0"}, {"Annual Standard Deviation", "0"}, {"Annual Variance", "0"}, - {"Information Ratio", "-0.311"}, - {"Tracking Error", "0.07"}, + {"Information Ratio", "4.947"}, + {"Tracking Error", "0.006"}, {"Treynor Ratio", "0"}, {"Total Fees", "$0.00"}, {"Estimated Strategy Capacity", "$0"}, diff --git a/Algorithm.CSharp/WarmupFutureRegressionAlgorithm.cs b/Algorithm.CSharp/WarmupFutureRegressionAlgorithm.cs index 9293e8ca4c29..3b96431ec1fc 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 => 21679; + public virtual long DataPoints => 21681; /// /// Data Points count of the algorithm history diff --git a/Algorithm.CSharp/WarmupFutureTimeSpanWarmupRegressionAlgorithm.cs b/Algorithm.CSharp/WarmupFutureTimeSpanWarmupRegressionAlgorithm.cs index 8f5dfa4b05a7..b58b770e66a6 100644 --- a/Algorithm.CSharp/WarmupFutureTimeSpanWarmupRegressionAlgorithm.cs +++ b/Algorithm.CSharp/WarmupFutureTimeSpanWarmupRegressionAlgorithm.cs @@ -35,6 +35,6 @@ public override void OnEndOfAlgorithm() /// /// Data Points count of all timeslices of algorithm /// - public override long DataPoints => 28883; + public override long DataPoints => 28884; } } diff --git a/Algorithm.Python/ETFConstituentUniverseCompositeDelistingRegressionAlgorithm.py b/Algorithm.Python/ETFConstituentUniverseCompositeDelistingRegressionAlgorithm.py index 8ead13a83185..14f62dfddaf5 100644 --- a/Algorithm.Python/ETFConstituentUniverseCompositeDelistingRegressionAlgorithm.py +++ b/Algorithm.Python/ETFConstituentUniverseCompositeDelistingRegressionAlgorithm.py @@ -24,6 +24,7 @@ def Initialize(self): self.SetCash(100000) self.universeSymbolCount = 0 + self.universeSelectionDone = False self.universeAdded = False self.universeRemoved = False @@ -36,11 +37,13 @@ def Initialize(self): self.AddUniverse(self.Universe.ETF(self.gdvd, self.UniverseSettings, self.FilterETFs)) def FilterETFs(self, constituents): + self.universeSelectionDone = True + if self.UtcTime.date() > self.delistingDate: raise Exception(f"Performing constituent universe selection on {self.UtcTime.strftime('%Y-%m-%d %H:%M:%S.%f')} after composite ETF has been delisted") constituentSymbols = [i.Symbol for i in constituents] - self.universeSymbolCount = len(constituentSymbols) + self.universeSymbolCount = len(set(constituentSymbols)) return constituentSymbols @@ -55,9 +58,19 @@ def OnSecuritiesChanged(self, changes): if len(changes.AddedSecurities) != 0 and self.UtcTime.date() > self.delistingDate: raise Exception("New securities added after ETF constituents were delisted") - self.universeAdded = self.universeAdded or len(changes.AddedSecurities) >= self.universeSymbolCount - # Subtract 1 from universe Symbol count for AAPL, since it was manually added to the algorithm - self.universeRemoved = self.universeRemoved or (len(changes.RemovedSecurities) == self.universeSymbolCount and self.UtcTime.date() >= self.delistingDate and self.UtcTime.date() < self.EndDate.date()) + # Since we added the etf subscription it will get delisted and send us a removal event + expectedChangesCount = self.universeSymbolCount + 1 + + if self.universeSelectionDone: + # "_universeSymbolCount + 1" because selection is done right away, + # so AddedSecurities includes all ETF constituents (including APPL) plus GDVD + self.universeAdded = self.universeAdded or len(changes.AddedSecurities) == expectedChangesCount + + # TODO: shouldn't be sending AAPL as a removed security since it was added by another universe + self.universeRemoved = self.universeRemoved or ( + len(changes.RemovedSecurities) == expectedChangesCount and + self.UtcTime.date() >= self.delistingDate and + self.UtcTime.date() < self.EndDate.date()) def OnEndOfAlgorithm(self): if not self.universeAdded: diff --git a/Algorithm.Python/ETFConstituentUniverseCompositeDelistingRegressionAlgorithmNoAddEquityETF.py b/Algorithm.Python/ETFConstituentUniverseCompositeDelistingRegressionAlgorithmNoAddEquityETF.py index 1325be36acc5..998c7703de42 100644 --- a/Algorithm.Python/ETFConstituentUniverseCompositeDelistingRegressionAlgorithmNoAddEquityETF.py +++ b/Algorithm.Python/ETFConstituentUniverseCompositeDelistingRegressionAlgorithmNoAddEquityETF.py @@ -24,6 +24,7 @@ def Initialize(self): self.SetCash(100000) self.universeSymbolCount = 0 + self.universeSelectionDone = False self.universeAdded = False self.universeRemoved = False @@ -36,11 +37,13 @@ def Initialize(self): self.AddUniverse(self.Universe.ETF(self.gdvd, self.UniverseSettings, self.FilterETFs)) def FilterETFs(self, constituents): + self.universeSelectionDone = True + if self.UtcTime.date() > self.delistingDate: raise Exception(f"Performing constituent universe selection on {self.UtcTime.strftime('%Y-%m-%d %H:%M:%S.%f')} after composite ETF has been delisted") constituentSymbols = [i.Symbol for i in constituents] - self.universeSymbolCount = len(constituentSymbols) + self.universeSymbolCount = len(set(constituentSymbols)) return constituentSymbols @@ -55,9 +58,14 @@ def OnSecuritiesChanged(self, changes): if len(changes.AddedSecurities) != 0 and self.UtcTime.date() > self.delistingDate: raise Exception("New securities added after ETF constituents were delisted") - self.universeAdded = self.universeAdded or len(changes.AddedSecurities) >= self.universeSymbolCount - # Subtract 1 from universe Symbol count for AAPL, since it was manually added to the algorithm - self.universeRemoved = self.universeRemoved or (len(changes.RemovedSecurities) == self.universeSymbolCount - 1 and self.UtcTime.date() >= self.delistingDate and self.UtcTime.date() < self.EndDate.date()) + if self.universeSelectionDone: + self.universeAdded = self.universeAdded or len(changes.AddedSecurities) == self.universeSymbolCount + + # TODO: shouldn't be sending AAPL as a removed security since it was added by another universe + self.universeRemoved = self.universeRemoved or ( + len(changes.RemovedSecurities) == self.universeSymbolCount and + self.UtcTime.date() >= self.delistingDate and + self.UtcTime.date() < self.EndDate.date()) def OnEndOfAlgorithm(self): if not self.universeAdded: diff --git a/Algorithm.Python/ETFConstituentUniverseFilterFunctionRegressionAlgorithm.py b/Algorithm.Python/ETFConstituentUniverseFilterFunctionRegressionAlgorithm.py index 31ba74d73ae3..c76841212b2b 100644 --- a/Algorithm.Python/ETFConstituentUniverseFilterFunctionRegressionAlgorithm.py +++ b/Algorithm.Python/ETFConstituentUniverseFilterFunctionRegressionAlgorithm.py @@ -59,7 +59,7 @@ def FilterETFs(self, constituents): def OnData(self, data): if not self.filtered and len(data.Bars) != 0 and self.aapl in data.Bars: raise Exception("AAPL TradeBar data added to algorithm before constituent universe selection took place") - + if len(data.Bars) == 1 and self.spy in data.Bars: return @@ -95,11 +95,11 @@ def OnSecuritiesChanged(self, changes): self.securitiesChanged = True def OnEndOfAlgorithm(self): - if self.rebalanceCount != 1: - raise Exception(f"Expected 1 rebalance, instead rebalanced: {self.rebalanceCount}") + if self.rebalanceCount != 2: + raise Exception(f"Expected 2 rebalance, instead rebalanced: {self.rebalanceCount}") - if self.rebalanceAssetCount != 4: - raise Exception(f"Invested in {self.rebalanceAssetCount} assets (expected 4)") + if self.rebalanceAssetCount != 8: + raise Exception(f"Invested in {self.rebalanceAssetCount} assets (expected 8)") if not self.filtered: raise Exception("Universe selection was never triggered") diff --git a/Algorithm.Python/FineFundamentalFilteredUniverseRegressionAlgorithm.py b/Algorithm.Python/FineFundamentalFilteredUniverseRegressionAlgorithm.py index 11f2c872004e..73402938cf1b 100644 --- a/Algorithm.Python/FineFundamentalFilteredUniverseRegressionAlgorithm.py +++ b/Algorithm.Python/FineFundamentalFilteredUniverseRegressionAlgorithm.py @@ -21,8 +21,8 @@ class FineFundamentalFilteredUniverseRegressionAlgorithm(QCAlgorithm): def Initialize(self): '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.''' - self.SetStartDate(2014,10, 7) - self.SetEndDate(2014,10,11) + self.SetStartDate(2014, 10, 8) + self.SetEndDate(2014, 10, 13) self.UniverseSettings.Resolution = Resolution.Daily diff --git a/Data/equity/usa/universes/etf/spy/20201130.csv b/Data/equity/usa/universes/etf/spy/20201130.csv new file mode 100644 index 000000000000..2e306c52323a --- /dev/null +++ b/Data/equity/usa/universes/etf/spy/20201130.csv @@ -0,0 +1,503 @@ +A,A RPTMYV3VC57P,20201127,0.00117008,3313891, +AAL,AAL VM9RIYHM8ACL,20201127,0.00024714,5331000, +AAP,AAP SA48O8J43YAT,20201127,0.00034427,741951, +AAPL,AAPL R735QTJ8XC9X,20201127,0.06213795,172212400, +ABBV,ABBV VCY032R250MD,20201127,0.00613882,18911224, +ABC,AAS R735QTJ8XC9X,20201127,0.00050311,1575257, +ABMD,ABMD R735QTJ8XC9X,20201127,0.00040431,480480, +ABT,ABT R735QTJ8XC9X,20201127,0.00631957,18974188, +ACN,ACN S6HA7SVNXLYD,20201127,0.00527772,6818158, +ADBE,ADBE R735QTJ8XC9X,20201127,0.00758913,5140614, +ADI,ADI R735QTJ8XC9X,20201127,0.00167876,3937902, +ADM,ADM R735QTJ8XC9X,20201127,0.00092865,5947830, +ADP,AUD R735QTJ8XC9X,20201127,0.00249878,4607220, +ADSK,ADSK R735QTJ8XC9X,20201127,0.00198429,2350246, +AEE,AEE R735QTJ8XC9X,20201127,0.00063622,2602587, +AEP,AEP R735QTJ8XC9X,20201127,0.00138806,5281633, +AES,AES R735QTJ8XC9X,20201127,0.00045953,7057345, +AFL,AFL R735QTJ8XC9X,20201127,0.00099563,7104918, +AIG,AIG R735QTJ8XC9X,20201127,0.00113401,9227547, +AIV,AIV R735QTJ8XC9X,20201127,0.00015163,1591824, +AIZ,AIZ SVXZEUFT60DH,20201127,0.00026844,648318, +AJG,AJG R735QTJ8XC9X,20201127,0.00073079,2038125, +AKAM,AKAM RP9Y0ZSHT205,20201127,0.00055901,1731482, +ALB,ALB R735QTJ8XC9X,20201127,0.00048654,1142039, +ALGN,ALGN S1PYFJ8AMC11,20201127,0.0011309,768499, +ALK,ALK R735QTJ8XC9X,20201127,0.00021014,1317205, +ALL,ALL R735QTJ8XC9X,20201127,0.00107867,3346881, +ALLE,ALLE VM2VEAXFP085,20201127,0.00035381,1000396, +ALXN,ALXN R735QTJ8XC9X,20201127,0.0009001,2348733, +AMAT,AMAT R735QTJ8XC9X,20201127,0.00250382,9787613, +AMCR,AMCR X58W2VQW0QXX,20201127,0.00060106,16917916, +AMD,AMD R735QTJ8XC9X,20201127,0.003395,12581758, +AME,AME R735QTJ8XC9X,20201127,0.00089833,2423566, +AMGN,AMGN R735QTJ8XC9X,20201127,0.00436708,6276886, +AMP,AMP TCIOBI43J7MT,20201127,0.00076087,1288895, +AMT,AMT RBASL7V8PIZP,20201127,0.00344324,4752846, +AMZN,AMZN R735QTJ8XC9X,20201127,0.04510291,4560960, +ANET,ANET VR60JOYTXC2T,20201127,0.00049128,582419, +ANSS,ANSS R735QTJ8XC9X,20201127,0.00093564,915007, +ANTM,ATH S9AP9FK1TBHH,20201127,0.00260926,2695374, +AON,AOC R735QTJ8XC9X,20201127,0.00158719,2482615, +AOS,AOS R735QTJ8XC9X,20201127,0.00025615,1450019, +APA,APA R735QTJ8XC9X,20201127,0.00017241,4002071, +APD,APD R735QTJ8XC9X,20201127,0.00202796,2358568, +APH,APH R735QTJ8XC9X,20201127,0.00129429,3169490, +APTV,DLPH V1OBWK1IM6HX,20201127,0.00109136,2893852, +ARE,ARE R735QTJ8XC9X,20201127,0.00063047,1256440, +ATO,ATO R735QTJ8XC9X,20201127,0.00038364,1280331, +ATVI,ATVI R735QTJ8XC9X,20201127,0.00200279,8281936, +AVB,BYA R735QTJ8XC9X,20201127,0.00077509,1491921, +AVGO,AVGO UEW4IOBWVPT1,20201127,0.00525247,4297243, +AVY,AVY R735QTJ8XC9X,20201127,0.00041522,892667, +AWK,AWK U21CEQEKX4DH,20201127,0.00091646,1926308, +AXP,AXP R735QTJ8XC9X,20201127,0.00260846,6989424, +AZO,AZO R735QTJ8XC9X,20201127,0.0008689,250851, +BA,BA R735QTJ8XC9X,20201127,0.00380992,5686254, +BAC,NB R735QTJ8XC9X,20201127,0.00733069,81708150, +BAX,BAX R735QTJ8XC9X,20201127,0.00127538,5424561, +BBY,BBY R735QTJ8XC9X,20201127,0.00085078,2440802, +BDX,BDX R735QTJ8XC9X,20201127,0.00220121,3106499, +BEN,BEN R735QTJ8XC9X,20201127,0.00019757,2866558, +BF.B,BFB R735QTJ8XC9X,20201127,0.00048903,1948409, +BIIB,IDPH R735QTJ8XC9X,20201127,0.00128001,1696614, +BIO,BIOA R735QTJ8XC9X,20201127,0.00038041,229729, +BK,BK R735QTJ8XC9X,20201127,0.00107083,8661113, +BKNG,PCLN RJG7T2VJICTH,20201127,0.00278765,438821, +BKR,BHGE WLXQGVHQ03MT,20201127,0.00042592,6957743, +BLK,BLK ROIDIDJRNXID,20201127,0.00336345,1519779, +BLL,BLL R735QTJ8XC9X,20201127,0.00104556,3506086, +BMY,BMY R735QTJ8XC9X,20201127,0.00471325,24154826, +BR,BR TRGAEJU9B59H,20201127,0.00055809,1223419, +BRK.B,BRKB R735QTJ8XC9X,20201127,0.01521622,21233948, +BSX,BSX R735QTJ8XC9X,20201127,0.00159682,15356289, +BWA,BWA R735QTJ8XC9X,20201127,0.00032003,2617958, +BXP,BXP R735QTJ8XC9X,20201127,0.00048092,1517109, +C,TRV R735QTJ8XC9X,20201127,0.00391246,22308228, +CAG,CAG R735QTJ8XC9X,20201127,0.00057633,5181581, +CAH,CAH R735QTJ8XC9X,20201127,0.00052172,3134596, +CARR,CARRW XCXKP5JBIR1H,20201127,0.00101852,8704254, +CAT,CAT R735QTJ8XC9X,20201127,0.00314294,5800537, +CB,ACL R735QTJ8XC9X,20201127,0.00227067,4845508, +CBOE,CBOE UNGBFXTQTV1H,20201127,0.00033073,1165260, +CBRE,CBRE WSZRSZV9QR1H,20201127,0.00067691,3578033, +CCI,TWRS RDBNO4XQDCV9,20201127,0.00231752,4479538, +CCL,CCL R735QTJ8XC9X,20201127,0.00037067,5550181, +CDNS,CDN R735QTJ8XC9X,20201127,0.00108137,2997230, +CDW,CDW VHRARJ4RLSV9,20201127,0.00062548,1528450, +CE,CE T5JLBNU20TPH,20201127,0.00052441,1267563, +CERN,CERN R735QTJ8XC9X,20201127,0.00075009,3270865, +CF,CF TB2HMJQ5H84L,20201127,0.00027487,2290836, +CFG,CFG VU6BPZ7ECBQD,20201127,0.00048322,4573532, +CHD,CHD R735QTJ8XC9X,20201127,0.00069885,2617526, +CHRW,CHRW R735QTJ8XC9X,20201127,0.00041494,1446058, +CHTR,CHTR UPXX4G43SIN9,20201127,0.00318892,1603012, +CI,CI R735QTJ8XC9X,20201127,0.00258802,3935301, +CINF,CINF R735QTJ8XC9X,20201127,0.0003859,1602537, +CL,CL R735QTJ8XC9X,20201127,0.00240602,9157162, +CLX,CLX R735QTJ8XC9X,20201127,0.00084336,1341816, +CMA,CMA R735QTJ8XC9X,20201127,0.00023738,1489678, +CMCSA,CMCSA SJTSDFE19S9X,20201127,0.00782414,48853420, +CME,CME SKAIZ0LWKM05,20201127,0.00207177,3830395, +CMG,CMG TFNWQ96IBZ39,20201127,0.00120377,299719, +CMI,CUM R735QTJ8XC9X,20201127,0.00112401,1585794, +CMS,CMS R735QTJ8XC9X,20201127,0.00058232,3035841, +CNC,CNTE SAI0XJNH6IJP,20201127,0.00121603,6220175, +CNP,HOU R735QTJ8XC9X,20201127,0.0004361,5854286, +COF,COF R735QTJ8XC9X,20201127,0.00132909,4893591, +COG,COG R735QTJ8XC9X,20201127,0.00023479,4269391, +COO,COO R735QTJ8XC9X,20201127,0.00055318,524626, +COP,P R735QTJ8XC9X,20201127,0.00152611,11526904, +COST,COST R735QTJ8XC9X,20201127,0.00568756,4731805, +CPB,CPB R735QTJ8XC9X,20201127,0.00032888,2169660, +CPRT,CPRT R735QTJ8XC9X,20201127,0.00078247,2194547, +CRM,CRM SZQUJUA9SVOL,20201127,0.0074739,9752434, +CSCO,CSCO R735QTJ8XC9X,20201127,0.00599533,45368490, +CSX,CSX R735QTJ8XC9X,20201127,0.00231613,8198004, +CTAS,CTAS R735QTJ8XC9X,20201127,0.00104122,931746, +CTLT,CTLT VSO64U344TWL,20201127,0.00053025,1759105, +CTSH,CTSH RBOKUIZLS38L,20201127,0.00141002,5810614, +CTVA,CTVA X510I4TJEPNP,20201127,0.00095086,7999095, +CTXS,CTXS R735QTJ8XC9X,20201127,0.00050165,1323866, +CVS,CVS R735QTJ8XC9X,20201127,0.00294459,14018978, +CVX,CHV R735QTJ8XC9X,20201127,0.00582679,20619572, +CXO,CXO TUTEE1U0PY05,20201127,0.0004102,2137155, +D,D R735QTJ8XC9X,20201127,0.00220148,8999881, +DAL,DAL TSAT9G6HOJ8L,20201127,0.00086865,6835866, +DD,DOW R735QTJ8XC9X,20201127,0.00157065,7863559, +DE,DE R735QTJ8XC9X,20201127,0.00272128,3356786, +DFS,DFS TTXW324M9SV9,20201127,0.00080156,3283941, +DG,DG UHLLRXJMGEP1,20201127,0.00180067,2668872, +DGX,DGX R735QTJ8XC9X,20201127,0.00054908,1421635, +DHI,DHI R735QTJ8XC9X,20201127,0.00083405,3547002, +DHR,DHR R735QTJ8XC9X,20201127,0.00453731,6763139, +DIS,DIS R735QTJ8XC9X,20201127,0.00881791,19365692, +DISCA,DISCA TAHT8L1LVDR9,20201127,0.00014318,1683636, +DISCK,DISCK U632KKJK8S4L,20201127,0.00025194,3316041, +DISH,DISH R735QTJ8XC9X,20201127,0.00029379,2643548, +DLR,DLR T38VRT3VLG85,20201127,0.00122041,2884110, +DLTR,DLTR R735QTJ8XC9X,20201127,0.0008617,2533526, +DOV,DOV R735QTJ8XC9X,20201127,0.0005958,1554065, +DOW,DOW X3BYSC52NXPH,20201127,0.00135922,7927732, +DPZ,DPZ T0AJHPLNBYW5,20201127,0.00049926,413154, +DRE,DRE R735QTJ8XC9X,20201127,0.00046849,3943192, +DRI,DRI R735QTJ8XC9X,20201127,0.00047501,1395979, +DTE,DTE R735QTJ8XC9X,20201127,0.00081646,2052571, +DUK,DUK R735QTJ8XC9X,20201127,0.00230647,7878187, +DVA,TRL R735QTJ8XC9X,20201127,0.00027416,806219, +DVN,DVN RNB1U9GCAQG5,20201127,0.00018988,4151175, +DXC,DXC WJE5W6H0VXPH,20201127,0.00019721,2737233, +DXCM,DXCM T7TBFF72DG11,20201127,0.0010105,1026108, +EA,ERTS R735QTJ8XC9X,20201127,0.00118913,3094424, +EBAY,EBAY REC37LGZ79T1,20201127,0.00112797,7099219, +ECL,ECL R735QTJ8XC9X,20201127,0.00184881,2657330, +ED,ED R735QTJ8XC9X,20201127,0.00085604,3556731, +EFX,EFX R735QTJ8XC9X,20201127,0.00065585,1286392, +EIX,EIX R735QTJ8XC9X,20201127,0.00078943,4062501, +EL,EL R735QTJ8XC9X,20201127,0.0018385,2415475, +EMN,EMN R735QTJ8XC9X,20201127,0.00045271,1464279, +EMR,EMR R735QTJ8XC9X,20201127,0.00154847,6401576, +EOG,EOG R735QTJ8XC9X,20201127,0.00099007,6220374, +EQIX,EQIXD SKZ55CR4HH0L,20201127,0.00205649,948584, +EQR,EQR R735QTJ8XC9X,20201127,0.00067236,3669878, +ES,NU R735QTJ8XC9X,20201127,0.00098411,3616384, +ESS,ESS R735QTJ8XC9X,20201127,0.00054133,699639, +ETN,ETN R735QTJ8XC9X,20201127,0.00161683,4285786, +ETR,ETR R735QTJ8XC9X,20201127,0.00073465,2128813, +ETSY,ETSY VZR6X1TTY8H1,20201127,0.00063542,1278840, +EVRG,WR R735QTJ8XC9X,20201127,0.00042195,2444722, +EW,EW RTKJ7O7ZTI79,20201127,0.00175955,6668448, +EXC,PE R735QTJ8XC9X,20201127,0.0013421,10389656, +EXPD,EXPD R735QTJ8XC9X,20201127,0.00049451,1796177, +EXPE,EXPE TB0IQCZTBPT1,20201127,0.00055694,1454463, +EXR,EXR T142WIKPMLPH,20201127,0.00047234,1387483, +F,F R735QTJ8XC9X,20201127,0.00117403,41733508, +FANG,FANG VAP9FER7V5GL,20201127,0.00023201,1722597, +FAST,FAST R735QTJ8XC9X,20201127,0.00091685,6098295, +FB,FB V6OIPNZEM8V9,20201127,0.02214315,25754926, +FBHS,FBHS V0H08FY38ZFP,20201127,0.00038934,1479867, +FCX,FCX R735QTJ8XC9X,20201127,0.00112963,15519189, +FDX,FDX R735QTJ8XC9X,20201127,0.00229771,2583227, +FE,FE R735QTJ8XC9X,20201127,0.00047813,5781978, +FFIV,FFIV RL97B90OK5ET,20201127,0.0003256,639382, +FIS,CEY S67FQV7Z62CL,20201127,0.00304734,6640596, +FISV,FISV R735QTJ8XC9X,20201127,0.00212971,5956560, +FITB,FITB R735QTJ8XC9X,20201127,0.00061919,7613189, +FLIR,FLIR R735QTJ8XC9X,20201127,0.00017377,1434899, +FLS,FLS R735QTJ8XC9X,20201127,0.00015015,1368200, +FLT,FLT USGI91RMTXET,20201127,0.00074531,899952, +FMC,FMC R735QTJ8XC9X,20201127,0.00049724,1389040, +FOX,FOXBV X2S9UGTP4UHX,20201127,0.00015199,1709424, +FOXA,FOXAV X2S9UGTP4UHX,20201127,0.00033222,3681327, +FRC,FRC USALKHKMDEG5,20201127,0.00072668,1801489, +FRT,FRT R735QTJ8XC9X,20201127,0.00020411,746317, +FTI,FTI S5ITKJ2R97C5,20201127,0.00012482,4496242, +FTNT,FTNT UHQJ0EDGU6HX,20201127,0.00055251,1442198, +FTV,FTV WBYCAQZ42Q1X,20201127,0.00079843,3611810, +GD,GD R735QTJ8XC9X,20201127,0.00117172,2489873, +GE,GE R735QTJ8XC9X,20201127,0.00300331,93311540, +GILD,GILD R735QTJ8XC9X,20201127,0.00249608,13435641, +GIS,GIS R735QTJ8XC9X,20201127,0.0012026,6462480, +GL,TMK R735QTJ8XC9X,20201127,0.00031196,1049809, +GLW,GLW R735QTJ8XC9X,20201127,0.00093596,8154007, +GM,GM URPX6IW2RK2T,20201127,0.00187617,13453971, +GOOG,GOOCV VP83T1ZUHROL,20201127,0.01745276,3144898, +GOOGL,GOOG T1AZ164W5VTX,20201127,0.01779938,3218431, +GPC,GPC R735QTJ8XC9X,20201127,0.00047373,1556261, +GPN,GPN S1VV43FB2UZP,20201127,0.00195873,3212256, +GPS,GPS R735QTJ8XC9X,20201127,0.00014814,2200853, +GRMN,GRMN S0DPIYB0VD5X,20201127,0.0005604,1547007, +GS,GS RKEOGCOG6RFP,20201127,0.00268635,3687438, +GWW,GWW R735QTJ8XC9X,20201127,0.00061879,482282, +HAL,HAL R735QTJ8XC9X,20201127,0.00051175,9416775, +HAS,HAS R735QTJ8XC9X,20201127,0.00039,1365024, +HBAN,HBAN R735QTJ8XC9X,20201127,0.00042022,10897524, +HBI,HBI TLRHF3R5E7VP,20201127,0.00016661,3730710, +HCA,HCA UUS78ZUZC21X,20201127,0.00133954,2828084, +HD,HD R735QTJ8XC9X,20201127,0.00984918,11531224, +HES,AHC R735QTJ8XC9X,20201127,0.0004603,2929587, +HFC,HOC R735QTJ8XC9X,20201127,0.00012249,1587638, +HIG,HIG R735QTJ8XC9X,20201127,0.00054683,3855391, +HII,HII UVCVMYJIXWF9,20201127,0.00022263,437222, +HLT,HLT VMCPV8L4GJTX,20201127,0.00096029,2971879, +HOLX,HOLX R735QTJ8XC9X,20201127,0.00059687,2774604, +HON,ALD R735QTJ8XC9X,20201127,0.0048741,7520828, +HPE,HPE W584BQZL94KL,20201127,0.00048152,13867295, +HPQ,HWP R735QTJ8XC9X,20201127,0.00101446,14719225, +HRL,HRL R735QTJ8XC9X,20201127,0.00043524,2979556, +HSIC,HSIC R735QTJ8XC9X,20201127,0.00030143,1529528, +HSY,HSY R735QTJ8XC9X,20201127,0.00072653,1585677, +HUM,HUM R735QTJ8XC9X,20201127,0.0017792,1414304, +HWM,AA R735QTJ8XC9X,20201127,0.00031567,4146383, +IBM,IBM R735QTJ8XC9X,20201127,0.00367279,9543751, +ICE,ICE TDPZZM7IWEP1,20201127,0.00195437,6014878, +IDXX,IDXX R735QTJ8XC9X,20201127,0.0012807,911048, +IEX,IEX R735QTJ8XC9X,20201127,0.00047577,799192, +IFF,IFF R735QTJ8XC9X,20201127,0.00039938,1143351, +ILMN,ILMN RWQR2INKP0TH,20201127,0.00153467,1564170, +INCY,INCY R735QTJ8XC9X,20201127,0.00051327,1992187, +INFO,MRKT VRITCWQ0X55X,20201127,0.00114534,3997471, +INTC,INTC R735QTJ8XC9X,20201127,0.00668292,45509172, +INTU,INTU R735QTJ8XC9X,20201127,0.00307291,2802985, +IP,IP R735QTJ8XC9X,20201127,0.00065979,4205823, +IPG,IPG R735QTJ8XC9X,20201127,0.00029127,4127940, +IPGP,IPGP TOFZ89LOW5LX,20201127,0.00023864,378886, +IQV,IQV WPKOXB566FZ9,20201127,0.00107088,2049808, +IR,IR R735QTJ8XC9X,20201127,0.00055152,3977914, +IRM,IMTN R735QTJ8XC9X,20201127,0.00025205,3059529, +ISRG,ISRG RVIFYB6Z92LH,20201127,0.00283119,1253493, +IT,GART R735QTJ8XC9X,20201127,0.00044879,950594, +ITW,ITW R735QTJ8XC9X,20201127,0.00202436,3082120, +IVZ,AVZ R735QTJ8XC9X,20201127,0.00021001,3989348, +J,J XA83FWBLY25H,20201127,0.00045803,1398067, +JBHT,JBHT R735QTJ8XC9X,20201127,0.00037394,893105, +JCI,JCI R735QTJ8XC9X,20201127,0.00113754,7995785, +JKHY,JKHY R735QTJ8XC9X,20201127,0.00039831,815618, +JNJ,JNJ R735QTJ8XC9X,20201127,0.01256866,28203000, +JNPR,JNPR RLTVP7P85ZS5,20201127,0.00024655,3586894, +JPM,CMB R735QTJ8XC9X,20201127,0.01225245,32660106, +K,K R735QTJ8XC9X,20201127,0.00052314,2662868, +KEY,KEY R735QTJ8XC9X,20201127,0.0005335,10556483, +KEYS,KEYS VV9PLPU5EI5H,20201127,0.00073718,2000500, +KHC,KHC W1YY4MGI5CH1,20201127,0.00070571,6943717, +KIM,KIM R735QTJ8XC9X,20201127,0.00020743,4447571, +KLAC,KLAC R735QTJ8XC9X,20201127,0.00131035,1666099, +KMB,KMB R735QTJ8XC9X,20201127,0.00159842,3653439, +KMI,KMI UU1M6GZF9OPX,20201127,0.00094596,20722960, +KMX,KMX SIHJGUGRITET,20201127,0.00051959,1760422, +KO,KO R735QTJ8XC9X,20201127,0.006757,41429704, +KR,KR R735QTJ8XC9X,20201127,0.00083668,8336470, +KSU,KSU R735QTJ8XC9X,20201127,0.00059285,1010889, +L,LTR R735QTJ8XC9X,20201127,0.00034304,2553427, +LB,LTD R735QTJ8XC9X,20201127,0.00028836,2398971, +LDOS,SAI TMRWYKAE84TH,20201127,0.00045142,1426121, +LEG,LEG R735QTJ8XC9X,20201127,0.00018969,1383565, +LEN,LEN R735QTJ8XC9X,20201127,0.00070779,2943050, +LH,LH R735QTJ8XC9X,20201127,0.00064263,1038237, +LHX,HRS R735QTJ8XC9X,20201127,0.00139646,2320302, +LIN,PX R735QTJ8XC9X,20201127,0.00448563,5630319, +LKQ,LKQX SSIWJ5PPLPB9,20201127,0.00033407,3000204, +LLY,LLY R735QTJ8XC9X,20201127,0.00388211,8507888, +LMT,LMT R735QTJ8XC9X,20201127,0.00305423,2636355, +LNC,LNC R735QTJ8XC9X,20201127,0.00029618,1946733, +LNT,WPH R735QTJ8XC9X,20201127,0.00042066,2576289, +LOW,LOW R735QTJ8XC9X,20201127,0.00387636,8098168, +LRCX,LRCX R735QTJ8XC9X,20201127,0.00218594,1547138, +LUMN,CTL R735QTJ8XC9X,20201127,0.00033222,10262853, +LUV,LUV R735QTJ8XC9X,20201127,0.00093372,6321128, +LVS,LVS T4J5S7AT6WRP,20201127,0.00061644,3519795, +LW,LW WFGDIPSPVALH,20201127,0.00035371,1561581, +LYB,LYB UQRGJ93635GL,20201127,0.00074624,2744463, +LYV,LYV TEPG2ZDLNKH1,20201127,0.00031452,1511658, +MA,MA TIX2XDPLFR6T,20201127,0.00992991,9462913, +MAA,MAA R735QTJ8XC9X,20201127,0.00046583,1213881, +MAR,MAR R9GTMYCXKZ8L,20201127,0.00113211,2850107, +MAS,MAS R735QTJ8XC9X,20201127,0.00047028,2801571, +MCD,MCD R735QTJ8XC9X,20201127,0.00538828,7974532, +MCHP,MCHP R735QTJ8XC9X,20201127,0.00111368,2705495, +MCK,MCK R735QTJ8XC9X,20201127,0.00096224,1727346, +MCO,DNB R735QTJ8XC9X,20201127,0.00148352,1729168, +MDLZ,KFT S5HU4FPL6G6D,20201127,0.00272199,15307001, +MDT,MDT R735QTJ8XC9X,20201127,0.00510643,14399227, +MET,MET RTMI3UYBZ0IT,20201127,0.0012141,8267761, +MGM,MGG R735QTJ8XC9X,20201127,0.00038864,4387821, +MHK,MHK R735QTJ8XC9X,20201127,0.00025901,641081, +MKC,MCCRK R735QTJ8XC9X,20201127,0.00075284,1304490, +MKTX,MKTX T3FRWGO24QCL,20201127,0.00066598,403069, +MLM,MLM R735QTJ8XC9X,20201127,0.00055882,666274, +MMC,MMC R735QTJ8XC9X,20201127,0.00192106,5427943, +MMM,MMM R735QTJ8XC9X,20201127,0.0033779,6170380, +MNST,HANS R735QTJ8XC9X,20201127,0.00103036,3956425, +MO,MO R735QTJ8XC9X,20201127,0.00248795,19913692, +MOS,MOS T34XZFN7AFL1,20201127,0.00026185,3730633, +MPC,MPC UXVGRK71ZB6T,20201127,0.00088981,6941548, +MRK,MRK R735QTJ8XC9X,20201127,0.00669615,27093486, +MRO,MRO R735QTJ8XC9X,20201127,0.00016915,8607546, +MS,MWD R735QTJ8XC9X,20201127,0.00302372,15304425, +MSCI,MXB TXNSVRVKOEP1,20201127,0.00111584,896345, +MSFT,MSFT R735QTJ8XC9X,20201127,0.05399698,81065390, +MSI,MOT R735QTJ8XC9X,20201127,0.00097635,1818766, +MTB,FES R735QTJ8XC9X,20201127,0.00051472,1374748, +MTD,MTD R735QTJ8XC9X,20201127,0.0008959,256937, +MU,MU R735QTJ8XC9X,20201127,0.00236643,11904852, +MXIM,MXIM R735QTJ8XC9X,20201127,0.00072934,2859694, +NCLH,NCLH VDDR8KLRD36T,20201127,0.00020204,2756892, +NDAQ,NDAQ T63A9J5FJWX1,20201127,0.00048374,1229599, +NEE,FPL R735QTJ8XC9X,20201127,0.00488047,20990224, +NEM,NEM R735QTJ8XC9X,20201127,0.00155689,8602374, +NFLX,NFLX SEWJWLJNHZDX,20201127,0.00718394,4724240, +NI,NI R735QTJ8XC9X,20201127,0.00030076,3965009, +NKE,NKE R735QTJ8XC9X,20201127,0.00553111,13312714, +NLOK,SYMC R735QTJ8XC9X,20201127,0.00035499,6333793, +NLSN,NLSN UTLV0Z4Q1M5H,20201127,0.00018845,3749634, +NOC,NOC R735QTJ8XC9X,20201127,0.0015737,1661602, +NOV,NOI R735QTJ8XC9X,20201127,0.00016629,4086055, +NOW,NOW V7TVHLCHTXLX,20201127,0.00334626,2049851, +NRG,NRG SXA8BFD2WZ8L,20201127,0.00026323,2616255, +NSC,NSC R735QTJ8XC9X,20201127,0.00205367,2733971, +NTAP,NTAP R735QTJ8XC9X,20201127,0.00039208,2378726, +NTRS,NTRS R735QTJ8XC9X,20201127,0.00066353,2230096, +NUE,NUE R735QTJ8XC9X,20201127,0.00055206,3239246, +NVDA,NVDA RHM8UTD8DT2D,20201127,0.01085444,6611985, +NVR,NVR R735QTJ8XC9X,20201127,0.00047577,37312, +NWL,NWL R735QTJ8XC9X,20201127,0.00026548,4071372, +NWS,NWSVV VHJF6S7EZRL1,20201127,0.00007278,1320457, +NWSA,NWSAV VHJF6S7EZRL1,20201127,0.00021953,4005407, +O,O R735QTJ8XC9X,20201127,0.00070094,3674416, +ODFL,ODFL R735QTJ8XC9X,20201127,0.00063842,1021278, +OKE,OKE R735QTJ8XC9X,20201127,0.0005485,4760484, +OMC,OMC R735QTJ8XC9X,20201127,0.00045388,2327911, +ORCL,ORCL R735QTJ8XC9X,20201127,0.0037035,20718312, +ORLY,ORLY R735QTJ8XC9X,20201127,0.00108767,793074, +OTIS,OTISW XCXKP5JBIR1H,20201127,0.00090324,4334117, +OXY,OXY R735QTJ8XC9X,20201127,0.00045979,8971469, +PAYC,PAYC VPQTATY1Y3QD,20201127,0.00067639,524410, +PAYX,PAYX R735QTJ8XC9X,20201127,0.00098414,3405779, +PBCT,PBCT R735QTJ8XC9X,20201127,0.00018109,4550165, +PCAR,PCAR R735QTJ8XC9X,20201127,0.00099988,3682313, +PEAK,PEAK X99MSMIP9NJ9,20201127,0.00053498,5785318, +PEG,PEG R735QTJ8XC9X,20201127,0.00098811,5379658, +PEP,PEP R735QTJ8XC9X,20201127,0.00664059,14839085, +PFE,PFE R735QTJ8XC9X,20201127,0.00686143,59551184, +PFG,PFG S93T4RZVA1D1,20201127,0.00043998,2765896, +PG,PG R735QTJ8XC9X,20201127,0.01144015,26668948, +PGR,PGR R735QTJ8XC9X,20201127,0.00171195,6255472, +PH,PH R735QTJ8XC9X,20201127,0.0011588,1372312, +PHM,PHM R735QTJ8XC9X,20201127,0.00039457,2874078, +PKG,PKG RRRJPI2URPLX,20201127,0.00041413,1007883, +PKI,EGG R735QTJ8XC9X,20201127,0.00047249,1181140, +PLD,AMB R735QTJ8XC9X,20201127,0.00245753,7893496, +PM,PM U1EP4KZP5ROL,20201127,0.00392013,16688904, +PNC,PNC R735QTJ8XC9X,20201127,0.00196728,4547360, +PNR,PNR VAEFIDQD0UP1,20201127,0.00029568,1799249, +PNW,PNW R735QTJ8XC9X,20201127,0.00031196,1200893, +POOL,POOL R735QTJ8XC9X,20201127,0.00045626,429668, +PPG,PPG R735QTJ8XC9X,20201127,0.00115522,2525915, +PPL,PPL R735QTJ8XC9X,20201127,0.00074118,8227198, +PRGO,PRGO R735QTJ8XC9X,20201127,0.00021653,1456712, +PRU,PRU SAI0XJNH6IJP,20201127,0.00102305,4233202, +PSA,PSA R735QTJ8XC9X,20201127,0.00110982,1629825, +PSX,PSX V67S42RJBF51,20201127,0.00094716,4691835, +PVH,PVH R735QTJ8XC9X,20201127,0.00019729,760077, +PWR,PWR R87J2NJ629UT,20201127,0.00032009,1479010, +PXD,PXD R735QTJ8XC9X,20201127,0.00060473,1775245, +PYPL,PYPL W2CQDXKV7WPX,20201127,0.00822619,12574276, +QCOM,QCOM R735QTJ8XC9X,20201127,0.00538228,12091647, +QRVO,QRVO VWWSFBS9ZRS5,20201127,0.00056878,1224344, +RCL,RCL R735QTJ8XC9X,20201127,0.00048151,1909497, +RE,RE R735QTJ8XC9X,20201127,0.00031044,429686, +REG,REG R735QTJ8XC9X,20201127,0.00024533,1690610, +REGN,REGN R735QTJ8XC9X,20201127,0.00178239,1120383, +RF,RGBK R735QTJ8XC9X,20201127,0.00050021,10347559, +RHI,RHI R735QTJ8XC9X,20201127,0.00024898,1228090, +RJF,RJF R735QTJ8XC9X,20201127,0.00037959,1322990, +RL,RL R735QTJ8XC9X,20201127,0.0001451,532909, +RMD,RESM R735QTJ8XC9X,20201127,0.00098987,1525707, +ROK,ROK R735QTJ8XC9X,20201127,0.00097786,1234590, +ROL,ROL R735QTJ8XC9X,20201127,0.00026595,1506848, +ROP,ROP R735QTJ8XC9X,20201127,0.00143962,1110731, +ROST,ROST R735QTJ8XC9X,20201127,0.00129462,3818908, +RSG,RSG RC0E7NDMP55X,20201127,0.00067637,2252175, +RTX,UTX R735QTJ8XC9X,20201127,0.00374481,16371757, +SBAC,SBAC RLL0ODEPH7C5,20201127,0.00106021,1198957, +SBUX,SBUX R735QTJ8XC9X,20201127,0.00382471,12526408, +SCHW,SCH R735QTJ8XC9X,20201127,0.00243911,15857811, +SEE,SEE R9PONSNG9ROL,20201127,0.00023027,1670919, +SHW,SHW R735QTJ8XC9X,20201127,0.00199974,878165, +SIVB,SIVB R735QTJ8XC9X,20201127,0.00060603,553499, +SJM,SJMA R735QTJ8XC9X,20201127,0.00043713,1212418, +SLB,SLB R735QTJ8XC9X,20201127,0.00100212,14799257, +SLG,SLG R735QTJ8XC9X,20201127,0.0001471,784999, +SNA,SNA R735QTJ8XC9X,20201127,0.00032122,586411, +SNPS,SNPS R735QTJ8XC9X,20201127,0.00113077,1620873, +SO,SO R735QTJ8XC9X,20201127,0.00212349,11313265, +SPG,SPG R735QTJ8XC9X,20201127,0.00092199,3482354, +SPGI,MHP R735QTJ8XC9X,20201127,0.00272998,2582547, +SRE,SRE RBYFBGNAJMUD,20201127,0.0012516,3099973, +STE,STRL R735QTJ8XC9X,20201127,0.00053955,909495, +STT,STT R735QTJ8XC9X,20201127,0.00083817,3783087, +STX,STX SKFG7HFQYDT1,20201127,0.00043289,2391877, +STZ,CBRNA R735QTJ8XC9X,20201127,0.00113364,1788509, +SWK,SWK R735QTJ8XC9X,20201127,0.00099413,1711293, +SWKS,AHA R735QTJ8XC9X,20201127,0.00075546,1792786, +SYF,SYF VSO64U344TWL,20201127,0.00055539,5772244, +SYK,SYK R735QTJ8XC9X,20201127,0.00252327,3502117, +SYY,SYY R735QTJ8XC9X,20201127,0.00120175,5450773, +T,SBC R735QTJ8XC9X,20201127,0.00685993,76355690, +TAP,ACCOB R735QTJ8XC9X,20201127,0.00029005,2002576, +TDG,TDG TGZ66QQM06SL,20201127,0.00106341,580879, +TDY,TDY RQ5GBZHW9751,20201127,0.00047111,394126, +TEL,TEL TTXW324M9SV9,20201127,0.00126222,3537020, +TER,TER R735QTJ8XC9X,20201127,0.00060245,1779400, +TFC,TFC XA73ZSYFVAZP,20201127,0.00216674,14435541, +TFX,TFX R735QTJ8XC9X,20201127,0.00056695,493721, +TGT,DH R735QTJ8XC9X,20201127,0.00298363,5362858, +TIF,TIF R735QTJ8XC9X,20201127,0.00046789,1147785, +TJX,TJX R735QTJ8XC9X,20201127,0.00251303,12844371, +TMO,TMO R735QTJ8XC9X,20201127,0.0059483,4239163, +TMUS,PCS TRX10524LYZP,20201127,0.00254464,6233760, +TPR,COH RYMOWYW7Z2W5,20201127,0.00026544,2957568, +TROW,TROW R735QTJ8XC9X,20201127,0.00109578,2431315, +TRV,SPC R735QTJ8XC9X,20201127,0.0011304,2716883, +TSCO,TSCO R735QTJ8XC9X,20201127,0.00053723,1245545, +TSN,TSN R735QTJ8XC9X,20201127,0.0006347,3155160, +TTWO,TTWO R735QTJ8XC9X,20201127,0.00065331,1196636, +TWTR,TWTR VLE97YS7S57P,20201127,0.00121596,8433276, +TXN,TXN R735QTJ8XC9X,20201127,0.00482967,9815590, +TXT,TXT R735QTJ8XC9X,20201127,0.00035743,2464171, +TYL,TYL R735QTJ8XC9X,20201127,0.00056361,427392, +UA,UA TOKWGQFJ9XET,20201127,0.00009434,2072241, +UAA,UARM TDRYVSXV1X0L,20201127,0.00010033,1943567, +UAL,UAUA TFUSUWQOV97P,20201127,0.00043719,3118430, +UDR,UDR R735QTJ8XC9X,20201127,0.00038062,3135820, +UHS,UHS R735QTJ8XC9X,20201127,0.00034047,832751, +ULTA,ULTA TX34HT712KBP,20201127,0.00052532,603448, +UNH,UNH R735QTJ8XC9X,20201127,0.01065047,10183524, +UNM,UNM R735QTJ8XC9X,20201127,0.00015998,2233989, +UNP,UNP R735QTJ8XC9X,20201127,0.00463,7275150, +UPS,UPS RPLRE46IQ3XH,20201127,0.0039559,7568503, +URI,URI R735QTJ8XC9X,20201127,0.00055808,774240, +USB,USB R735QTJ8XC9X,20201127,0.00200906,14683923, +V,V U12VRGLO8PR9,20201127,0.0117938,18060936, +VAR,VAR R735QTJ8XC9X,20201127,0.00052346,972635, +VFC,VFC R735QTJ8XC9X,20201127,0.00090921,3427298, +VIAC,VIAC XA367FHRKACL,20201127,0.00065567,6041976, +VLO,VLO R735QTJ8XC9X,20201127,0.00076879,4387407, +VMC,VMC R735QTJ8XC9X,20201127,0.00062239,1412978, +VNO,VNO R735QTJ8XC9X,20201127,0.00021168,1696017, +VNT,VNTW XI4NMX1E23J9,20201127,0.00015243,1444831, +VRSK,VRSK UGL68H0DMHR9,20201127,0.00107068,1745253, +VRSN,VRSN R7UQ9FRZ2GRP,20201127,0.00067216,1083138, +VRTX,VRTX R735QTJ8XC9X,20201127,0.00195495,2786331, +VTR,VC R735QTJ8XC9X,20201127,0.00058584,3951936, +VTRS,VTRSV XJGWJHYNT2ED,20201127,0.0006794,12875675, +VZ,BEL R735QTJ8XC9X,20201127,0.00831406,44345796, +WAB,WAB R735QTJ8XC9X,20201127,0.00043772,1915980, +WAT,WAT R735QTJ8XC9X,20201127,0.00046992,665193, +WBA,WAG R735QTJ8XC9X,20201127,0.00093032,7707889, +WDC,WDC R735QTJ8XC9X,20201127,0.0004447,3133997, +WEC,WEC R735QTJ8XC9X,20201127,0.00099429,3355741, +WELL,HCN R735QTJ8XC9X,20201127,0.00089632,4487470, +WFC,NOB R735QTJ8XC9X,20201127,0.00388892,44153304, +WHR,WHR R735QTJ8XC9X,20201127,0.00041699,670486, +WLTW,WLTW W6Z4XQEE5EUD,20201127,0.00089121,1374233, +WM,UW R735QTJ8XC9X,20201127,0.00153798,4169456, +WMB,WMB R735QTJ8XC9X,20201127,0.00085592,12887597, +WMT,WMT R735QTJ8XC9X,20201127,0.00698144,14880397, +WRB,BKLY R735QTJ8XC9X,20201127,0.00030032,1506601, +WRK,WRK W1V0C8ZTUBTX,20201127,0.00037379,2741241, +WST,WST R735QTJ8XC9X,20201127,0.0006804,790956, +WU,WU TMH31J9JDU1X,20201127,0.00030685,4402770, +WY,WY R735QTJ8XC9X,20201127,0.00070429,7926626, +WYNN,WYNN SJ56738TCX9H,20201127,0.00032279,1030430, +XEL,NSP R735QTJ8XC9X,20201127,0.0011725,5602837, +XLNX,XLNX R735QTJ8XC9X,20201127,0.00111221,2613869, +XOM,XON R735QTJ8XC9X,20201127,0.00563597,45312690, +XRAY,XRAY R735QTJ8XC9X,20201127,0.00037418,2340401, +XRX,XRX R735QTJ8XC9X,20201127,0.00014277,1986757, +XYL,XYL V18KR26TE3XH,20201127,0.00057525,1913504, +YUM,YUM R735QTJ8XC9X,20201127,0.0010719,3231552, +ZBH,ZMH S6ZZPKTVDY05,20201127,0.00102092,2198929, +ZBRA,ZBRA R735QTJ8XC9X,20201127,0.0006666,571340, +ZION,ZION R735QTJ8XC9X,20201127,0.00021447,1756233, +ZTS,ZTS VDRJHVQ4FNFP,20201127,0.00254275,5088396, diff --git a/Data/future/cme/map_files/dc.csv b/Data/future/cme/map_files/dc.csv new file mode 100644 index 000000000000..24f8664d767a --- /dev/null +++ b/Data/future/cme/map_files/dc.csv @@ -0,0 +1,341 @@ +18991230,dc,CME +20130115,dc vdol5lmm7fnl,CME,2 +20130115,dc vdol5lmm7fnl,CME,3 +20130128,dc vdol5lmm7fnl,CME,0 +20130131,dc veg5o7vcck5d,CME,1 +20130201,dc veg5o7vcck5d,CME,2 +20130201,dc veg5o7vcck5d,CME,3 +20130225,dc veg5o7vcck5d,CME,0 +20130331,dc vfembho90yrl,CME,1 +20130401,dc vfembho90yrl,CME,0 +20130401,dc vfembho90yrl,CME,2 +20130401,dc vfembho90yrl,CME,3 +20130531,dc vh4nhdpvuhvl,CME,1 +20130602,dc vh4nhdpvuhvl,CME,2 +20130602,dc vh4nhdpvuhvl,CME,3 +20130603,dc vh4nhdpvuhvl,CME,0 +20130630,dc vinsim7c4qv5,CME,1 +20130707,dc vinsim7c4qv5,CME,2 +20130707,dc vinsim7c4qv5,CME,3 +20130729,dc vinsim7c4qv5,CME,0 +20130812,dc vjn8lzdevwn5,CME,2 +20130812,dc vjn8lzdevwn5,CME,3 +20130831,dc vjn8lzdevwn5,CME,1 +20130903,dc vjn8lzdevwn5,CME,0 +20130930,dc vl5e74hp3egx,CME,1 +20131004,dc vl5e74hp3egx,CME,2 +20131004,dc vl5e74hp3egx,CME,3 +20131028,dc vl5e74hp3egx,CME,0 +20131130,dc vm3uuealrt35,CME,1 +20131201,dc vm3uuealrt35,CME,2 +20131201,dc vm3uuealrt35,CME,3 +20131202,dc vm3uuealrt35,CME,0 +20140131,dc vntw0ac8lc75,CME,1 +20140202,dc vntw0ac8lc75,CME,2 +20140202,dc vntw0ac8lc75,CME,3 +20140203,dc vntw0ac8lc75,CME,0 +20140223,dc vpd11itovl6p,CME,2 +20140223,dc vpd11itovl6p,CME,3 +20140331,dc vpd11itovl6p,CME,0 +20140331,dc vpd11itovl6p,CME,1 +20140413,dc vr327evbp4ap,CME,3 +20140531,dc vr327evbp4ap,CME,1 +20140601,dc vr327evbp4ap,CME,2 +20140602,dc vr327evbp4ap,CME,0 +20140629,dc vsm78ncrzda9,CME,2 +20140630,dc vsm78ncrzda9,CME,1 +20140728,dc vsm78ncrzda9,CME,0 +20140812,dc vtlnc0iuqj29,CME,2 +20140831,dc vtlnc0iuqj29,CME,1 +20140902,dc vtlnc0iuqj29,CME,0 +20141031,dc vvap1t7bhb0h,CME,1 +20141102,dc vvap1t7bhb0h,CME,2 +20141103,dc vvap1t7bhb0h,CME,0 +20141130,dc vwtu31orrk01,CME,1 +20141209,dc vwtu31orrk01,CME,2 +20141229,dc vwtu31orrk01,CME,0 +20150130,dc vxsaqbhofym9,CME,2 +20150130,dc vxsaqbhofym9,CME,3 +20150131,dc vxsaqbhofym9,CME,1 +20150202,dc vxsaqbhofym9,CME,0 +20150228,dc vzbfrjz4q7lt,CME,1 +20150301,dc vzbfrjz4q7lt,CME,2 +20150301,dc vzbfrjz4q7lt,CME,3 +20150318,dc w030a67uvc3l,CME,2 +20150318,dc w030a67uvc3l,CME,3 +20150330,dc vzbfrjz4q7lt,CME,0 +20150331,dc w030a67uvc3l,CME,1 +20150427,dc w030a67uvc3l,CME,0 +20150531,dc w11gxg0rjqpt,CME,1 +20150601,dc w11gxg0rjqpt,CME,0 +20150601,dc w11gxg0rjqpt,CME,2 +20150601,dc w11gxg0rjqpt,CME,3 +20150731,dc w2ri3c2ed9tt,CME,2 +20150731,dc w2ri3c2ed9tt,CME,1 +20150731,dc w2ri3c2ed9tt,CME,3 +20150803,dc w2ri3c2ed9tt,CME,0 +20150831,dc w4an4kjunitd,CME,1 +20150923,dc w4an4kjunitd,CME,2 +20150923,dc w4an4kjunitd,CME,3 +20150928,dc w4an4kjunitd,CME,0 +20151031,dc w593rucrbxfl,CME,1 +20151101,dc w593rucrbxfl,CME,2 +20151101,dc w593rucrbxfl,CME,3 +20151102,dc w593rucrbxfl,CME,0 +20151130,dc w6s8t2u7m6f5,CME,1 +20151223,dc w6s8t2u7m6f5,CME,2 +20151223,dc w6s8t2u7m6f5,CME,3 +20151228,dc w6s8t2u7m6f5,CME,0 +20160110,dc w7qpgcn4al1d,CME,2 +20160110,dc w7qpgcn4al1d,CME,3 +20160131,dc w7qpgcn4al1d,CME,1 +20160201,dc w7qpgcn4al1d,CME,0 +20160229,dc w99uhl4kku0x,CME,1 +20160302,dc w99uhl4kku0x,CME,2 +20160302,dc w99uhl4kku0x,CME,3 +20160328,dc w99uhl4kku0x,CME,0 +20160412,dc wa8b4uxh98n5,CME,2 +20160412,dc wa8b4uxh98n5,CME,3 +20160430,dc wa8b4uxh98n5,CME,1 +20160502,dc wa8b4uxh98n5,CME,0 +20160529,dc wbrg63exjhmp,CME,2 +20160529,dc wbrg63exjhmp,CME,3 +20160531,dc wbrg63exjhmp,CME,1 +20160627,dc wbrg63exjhmp,CME,0 +20160731,dc wcpwtd7u7w8x,CME,1 +20160801,dc wcpwtd7u7w8x,CME,0 +20160801,dc wcpwtd7u7w8x,CME,2 +20160801,dc wcpwtd7u7w8x,CME,3 +20160930,dc wefxz99h1fcx,CME,1 +20161002,dc wefxz99h1fcx,CME,2 +20161002,dc wefxz99h1fcx,CME,3 +20161003,dc wefxz99h1fcx,CME,0 +20161031,dc wfz30hqxboch,CME,1 +20161110,dc wfz30hqxboch,CME,2 +20161110,dc wfz30hqxboch,CME,3 +20161128,dc wfz30hqxboch,CME,0 +20161231,dc wgyj3ux02u4h,CME,1 +20170103,dc wgyj3ux02u4h,CME,0 +20170103,dc wgyj3ux02u4h,CME,2 +20170103,dc wgyj3ux02u4h,CME,3 +20170131,dc wigop01aaby9,CME,1 +20170202,dc wigop01aaby9,CME,2 +20170202,dc wigop01aaby9,CME,3 +20170227,dc wigop01aaby9,CME,0 +20170331,dc wjf5c9u6yqkh,CME,1 +20170402,dc wjf5c9u6yqkh,CME,2 +20170402,dc wjf5c9u6yqkh,CME,3 +20170403,dc wjf5c9u6yqkh,CME,0 +20170403,dc wkz9tlotbqpt,CME,2 +20170430,dc wkz9tlotbqpt,CME,1 +20170530,dc wkz9tlotbqpt,CME,0 +20170531,dc wlpuw4kde41t,CME,1 +20170626,dc wlpuw4kde41t,CME,0 +20170626,dc wlpuw4kde41t,CME,2 +20170626,dc wlpuw4kde41t,CME,3 +20170731,dc wmobjeda2io1,CME,0 +20170731,dc wmobjeda2io1,CME,2 +20170731,dc wmobjeda2io1,CME,1 +20170731,dc wmobjeda2io1,CME,3 +20170930,dc woecpaeww1s1,CME,1 +20171002,dc woecpaeww1s1,CME,0 +20171002,dc woecpaeww1s1,CME,2 +20171002,dc woecpaeww1s1,CME,3 +20171031,dc wpxhqiwd6arl,CME,1 +20171109,dc wpxhqiwd6arl,CME,2 +20171109,dc wpxhqiwd6arl,CME,3 +20171127,dc wpxhqiwd6arl,CME,0 +20171220,dc wqwxtw2fxgjl,CME,2 +20171220,dc wqwxtw2fxgjl,CME,3 +20171231,dc wqwxtw2fxgjl,CME,1 +20180102,dc wqwxtw2fxgjl,CME,0 +20180118,dc wsf3f16q4ydd,CME,2 +20180118,dc wsf3f16q4ydd,CME,3 +20180131,dc wsf3f16q4ydd,CME,1 +20180226,dc wsf3f16q4ydd,CME,0 +20180331,dc wtdk2azmtczl,CME,1 +20180401,dc wtdk2azmtczl,CME,2 +20180401,dc wtdk2azmtczl,CME,3 +20180402,dc wtdk2azmtczl,CME,0 +20180430,dc wuxojmu96d4x,CME,1 +20180523,dc wuxojmu96d4x,CME,2 +20180523,dc wuxojmu96d4x,CME,3 +20180529,dc wuxojmu96d4x,CME,0 +20180619,dc wvv5qt9zs0ld,CME,2 +20180619,dc wvv5qt9zs0ld,CME,3 +20180630,dc wvv5qt9zs0ld,CME,1 +20180702,dc wvv5qt9zs0ld,CME,0 +20180731,dc wxeas1rg29kx,CME,1 +20180827,dc wxeas1rg29kx,CME,0 +20180827,dc wxeas1rg29kx,CME,2 +20180827,dc wxeas1rg29kx,CME,3 +20180913,dc wycrfbkcqo75,CME,2 +20180913,dc wycrfbkcqo75,CME,3 +20180930,dc wycrfbkcqo75,CME,1 +20181001,dc wycrfbkcqo75,CME,0 +20181116,dc x02sl7lzk7b5,CME,2 +20181116,dc x02sl7lzk7b5,CME,3 +20181130,dc x02sl7lzk7b5,CME,1 +20181203,dc x02sl7lzk7b5,CME,0 +20181231,dc x1lxmg3fugap,CME,1 +20190111,dc x1lxmg3fugap,CME,2 +20190111,dc x1lxmg3fugap,CME,3 +20190125,dc x2di52c5zksh,CME,2 +20190125,dc x2di52c5zksh,CME,3 +20190128,dc x1lxmg3fugap,CME,0 +20190131,dc x2di52c5zksh,CME,1 +20190225,dc x2di52c5zksh,CME,0 +20190331,dc x3bysc52nzep,CME,1 +20190401,dc x3bysc52nzep,CME,0 +20190401,dc x3bysc52nzep,CME,2 +20190401,dc x3bysc52nzep,CME,3 +20190531,dc x51zy86phiip,CME,1 +20190603,dc x51zy86phiip,CME,0 +20190603,dc x51zy86phiip,CME,2 +20190603,dc x51zy86phiip,CME,3 +20190626,dc x6l4zgo5rri9,CME,2 +20190626,dc x6l4zgo5rri9,CME,3 +20190630,dc x6l4zgo5rri9,CME,1 +20190729,dc x6l4zgo5rri9,CME,0 +20190823,dc x7kl2tu8ixa9,CME,2 +20190823,dc x7kl2tu8ixa9,CME,3 +20190831,dc x7kl2tu8ixa9,CME,1 +20190903,dc x7kl2tu8ixa9,CME,0 +20190930,dc x92qnyyiqf41,CME,1 +20191010,dc x92qnyyiqf41,CME,2 +20191010,dc x92qnyyiqf41,CME,3 +20191028,dc x92qnyyiqf41,CME,0 +20191130,dc xa17b8rfetq9,CME,1 +20191202,dc xa17b8rfetq9,CME,0 +20191202,dc xa17b8rfetq9,CME,2 +20191202,dc xa17b8rfetq9,CME,3 +20200124,dc xbr8h4t28cu9,CME,2 +20200124,dc xbr8h4t28cu9,CME,3 +20200131,dc xbr8h4t28cu9,CME,1 +20200203,dc xbr8h4t28cu9,CME,0 +20200229,dc xdadidaiiltt,CME,1 +20200305,dc xdadidaiiltt,CME,2 +20200305,dc xdadidaiiltt,CME,3 +20200323,dc xe1y0zj8nqbl,CME,2 +20200323,dc xe1y0zj8nqbl,CME,3 +20200330,dc xdadidaiiltt,CME,0 +20200331,dc xe1y0zj8nqbl,CME,1 +20200427,dc xe1y0zj8nqbl,CME,0 +20200531,dc xf0eo9c5c4xt,CME,1 +20200601,dc xf0eo9c5c4xt,CME,0 +20200601,dc xf0eo9c5c4xt,CME,2 +20200601,dc xf0eo9c5c4xt,CME,3 +20200731,dc xgqfu5ds5o1t,CME,1 +20200803,dc xgqfu5ds5o1t,CME,0 +20200803,dc xgqfu5ds5o1t,CME,2 +20200803,dc xgqfu5ds5o1t,CME,3 +20200831,dc xi9kvdv8fx1d,CME,1 +20200901,dc xi9kvdv8fx1d,CME,2 +20200901,dc xi9kvdv8fx1d,CME,3 +20200928,dc xi9kvdv8fx1d,CME,0 +20201031,dc xj81ino54bnl,CME,1 +20201102,dc xj81ino54bnl,CME,0 +20201102,dc xj81ino54bnl,CME,2 +20201102,dc xj81ino54bnl,CME,3 +20201130,dc xkr6jw5lekn5,CME,1 +20201228,dc xkr6jw5lekn5,CME,0 +20201228,dc xkr6jw5lekn5,CME,2 +20201228,dc xkr6jw5lekn5,CME,3 +20210121,dc xlpn75yi2z9d,CME,2 +20210121,dc xlpn75yi2z9d,CME,3 +20210131,dc xlpn75yi2z9d,CME,1 +20210201,dc xlpn75yi2z9d,CME,0 +20210228,dc xn8s8efyd88x,CME,1 +20210329,dc xn8s8efyd88x,CME,0 +20210329,dc xn8s8efyd88x,CME,2 +20210329,dc xn8s8efyd88x,CME,3 +20210409,dc xo78vo8v1mv5,CME,2 +20210409,dc xo78vo8v1mv5,CME,3 +20210430,dc xo78vo8v1mv5,CME,1 +20210503,dc xo78vo8v1mv5,CME,0 +20210531,dc xpqdwwqbbvup,CME,1 +20210622,dc xpqdwwqbbvup,CME,2 +20210622,dc xpqdwwqbbvup,CME,3 +20210628,dc xpqdwwqbbvup,CME,0 +20210704,dc xqouk6j80agx,CME,2 +20210704,dc xqouk6j80agx,CME,3 +20210731,dc xqouk6j80agx,CME,1 +20210802,dc xqouk6j80agx,CME,0 +20210826,dc xs7zlf0oajgh,CME,2 +20210826,dc xs7zlf0oajgh,CME,3 +20210831,dc xs7zlf0oajgh,CME,1 +20210927,dc xs7zlf0oajgh,CME,0 +20211026,dc xt6g8otkyy2p,CME,2 +20211026,dc xt6g8otkyy2p,CME,3 +20211031,dc xt6g8otkyy2p,CME,1 +20211101,dc xt6g8otkyy2p,CME,0 +20211224,dc xuwhekv7sh6p,CME,2 +20211224,dc xuwhekv7sh6p,CME,3 +20211231,dc xuwhekv7sh6p,CME,1 +20220103,dc xuwhekv7sh6p,CME,0 +20220215,dc xwfmftco2q69,CME,2 +20220215,dc xwfmftco2q69,CME,3 +20220228,dc xwfmftco2q69,CME,0 +20220228,dc xwfmftco2q69,CME,1 +20220426,dc xy5nlpeaw9a9,CME,2 +20220426,dc xy5nlpeaw9a9,CME,3 +20220430,dc xy5nlpeaw9a9,CME,1 +20220502,dc xy5nlpeaw9a9,CME,0 +20220531,dc xzosmxvr6i9t,CME,1 +20220607,dc xzosmxvr6i9t,CME,2 +20220607,dc xzosmxvr6i9t,CME,3 +20220627,dc xzosmxvr6i9t,CME,0 +20220722,dc y0n9a7onuww1,CME,2 +20220722,dc y0n9a7onuww1,CME,3 +20220731,dc y0n9a7onuww1,CME,1 +20220801,dc y0n9a7onuww1,CME,0 +20220914,dc y2dag3qaog01,CME,2 +20220914,dc y2dag3qaog01,CME,3 +20220930,dc y2dag3qaog01,CME,1 +20221003,dc y2dag3qaog01,CME,0 +20221028,dc y3wfhc7qyozl,CME,2 +20221028,dc y3wfhc7qyozl,CME,3 +20221031,dc y3wfhc7qyozl,CME,1 +20221128,dc y3wfhc7qyozl,CME,0 +20221222,dc y4vvkpdtpurl,CME,2 +20221222,dc y4vvkpdtpurl,CME,3 +20221231,dc y4vvkpdtpurl,CME,1 +20230103,dc y4vvkpdtpurl,CME,0 +20230215,dc y6f0lxva03r5,CME,2 +20230215,dc y6f0lxva03r5,CME,3 +20230228,dc y6f0lxva03r5,CME,0 +20230228,dc y6f0lxva03r5,CME,1 +20230416,dc y832vn6ko4jl,CME,2 +20230416,dc y832vn6ko4jl,CME,3 +20230430,dc y832vn6ko4jl,CME,0 +20230430,dc y832vn6ko4jl,CME,1 +20230629,dc y9r55chvc5c1,CME,2 +20230629,dc y9r55chvc5c1,CME,3 +20230630,dc y9r55chvc5c1,CME,0 +20230630,dc y9r55chvc5c1,CME,1 +20230831,dc ybg6v56c2xa9,CME,0 +20230831,dc ybg6v56c2xa9,CME,2 +20230831,dc ybg6v56c2xa9,CME,1 +20230831,dc ybg6v56c2xa9,CME,3 +20231018,dc yd494uhmqy2p,CME,2 +20231018,dc yd494uhmqy2p,CME,3 +20231031,dc yd494uhmqy2p,CME,0 +20231031,dc yd494uhmqy2p,CME,1 +20231221,dc yesbejsxeyv5,CME,2 +20231221,dc yesbejsxeyv5,CME,3 +20231231,dc yesbejsxeyv5,CME,0 +20231231,dc yesbejsxeyv5,CME,1 +20240229,dc ygfe85r208ht,CME,0 +20240229,dc ygfe85r208ht,CME,1 +20240430,dc yi3ghv2co9a9,CME,0 +20240430,dc yi3ghv2co9a9,CME,1 +20240630,dc yjrirkdnca2p,CME,0 +20240630,dc yjrirkdnca2p,CME,1 +20240831,dc ylgkhd24320x,CME,0 +20240831,dc ylgkhd24320x,CME,1 +20241031,dc yn4mr2der2td,CME,0 +20241031,dc yn4mr2der2td,CME,1 +20241231,dc yosp0ropf3lt,CME,0 +20241231,dc yosp0ropf3lt,CME,1 +20501231,dc ygfe85r208ht,CME,2 +20501231,dc ygfe85r208ht,CME,3 diff --git a/Data/future/cme/minute/dc/20131007_openinterest.zip b/Data/future/cme/minute/dc/20131007_openinterest.zip new file mode 100644 index 0000000000000000000000000000000000000000..a8c12c92bb2a00f6843df7490268a79a005d965b GIT binary patch literal 3228 zcmbW&O=uHA90l-gCMkttKir}scql6hErgk!P0}9f*WMZr!4(t~bJzwA+9=Jo*Fvua zK`$am(L*jh_aKN@p$9!w#6ypQ2zvJHY(|}(ha)ph2%8X+U*3Nv^IA<(p7A_y%zLqP z_4>K__p>L&tMlT)#UrGQGfErnm9)Lu?X72>_QOY=UbmNZ);j&HE#8k9l@~^%YTDo6 z;a+i$%uo$3|wey8Zg3NHOP-hK7>i zdYahxo4K>HGnhU;330lw?mu&M#8h)fTp$ife511#SNEMACY_LSZES&0jLw5gKfk&z z50i6aA*V$rO%vnt+<1BIxnrD&a=APaWkn_q($pAd{_-AmbhwNoE?jfcAT~Se-+#=2p5lmAP&MT9-~kU!P`RJ`66rsho0U zm>e4mX;|C_X~K=W?cnW~TdoXUkZBh6KTkr;%+viRH=P%!CYid<#AG}$Zt8D`r|;zF z_N@KcR+F2pM&T@ob7bM;!PvVp9Bj8g?`|J?X8J*pkRkK84n|5d#N0a~RN;1n7HTzh z02@br`(5$W27vxS0J}y3A8Y}=c@V&oQ9ymfDgjmw0@yAJ*s%rlu0a56MFFEFs{|30 z3<6jv3RtxSpk5HbCQ-mAI{#j}m!t6y}K=;Z(a literal 0 HcmV?d00001 diff --git a/Data/future/cme/minute/dc/20131007_quote.zip b/Data/future/cme/minute/dc/20131007_quote.zip new file mode 100644 index 0000000000000000000000000000000000000000..099ff7325f79544e22dfc6eb877afc028e7c2ccf GIT binary patch literal 15865 zcmb801yq|`_vUeTin}`m3GNh^LJJgkcX#)q1&UKB6xZOcDNx+KSaB=vHr%iOna*Xc zx%Zo}LK0Z(ck;f+p1t>Tl;xpeUO_-WAV6daDX5-FF5mY+LqL=hLO?J-|CIy4&dCk{ z@aUTu>)Tq|xw@F@JG$CG|9<`l7l7mU3nze!)!5nXbDDetH3fp`m1lA+qW_oW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IdJ@V^Y zBANBZeK-X~_yvf!n`k{d0$$<-?TZQKwi#+o5`4QoN;-j(NoYcB-Y_M^5m@0EmIffF zLj{Ghk8Z|l!iG6RwDWI=9d`Brlo|Bjar8tdTtj=d0`j5cOP!G{1A{AopiU$I;QW^Q z#6~16@7-IYo3jMjS+xByUkwgTEklkLT7o9{PpL8ApCKj7Ws#m8!)x< zYiH0nleVa*w*QEuN3)p18M%BI12vL!^1%-w6CZ)nCY0BHu6!mMn-R1QXNi6@;wV5G zZ&^=Lh^2q=3mBxM;ITuJr6N3P34gQ&AqHBLceD7$=Wj3K7Sgn9-2|2~lSJm&we$N$gq zyqDycXM6r&(Vr*PKa>A{(&r`lrEmHV85Q}T$uC{hFUc>h(tpS<|3ZFgoPJ4uX=M3B z2H^hlcYbMWc}afh_V`0K#rtRSOYg@^^2=JqA2KAxKa*cpE?$yfmIMBfum6?&_u{}y z^2@aNAF>?PfBT((Yo3?nml@?hWJ~IQCcn%tza+m5mHv?TSpJ#(GH`lHei-k6Z`CS~(U!VRL2c*$L literal 0 HcmV?d00001 diff --git a/Data/future/cme/minute/dc/20131007_trade.zip b/Data/future/cme/minute/dc/20131007_trade.zip new file mode 100644 index 0000000000000000000000000000000000000000..94e97d8d7efcb7a0add231cad349d48ceb8feefd GIT binary patch literal 4675 zcmb7{3p~^N8^1n96EGS$o-m2tCrGnzm!nP zCATsqm&!Fd5?)feaB?b#$oVlHf4|rNAOG#O*Kd36wfFOU_dK8H`TQ)YFkvJF0)ay= z>+LV#adu@ffG-Fbyx>B>V6|O* z{ld=f7OTa;g~zJ1kQR6J41o)dJf9)=k9fWcJbdh{R!W=-s(LnNYxAAd@Ilw{haH8NjT(c@0(Ys@)TYuM zSE;7byDx4xj2|>^YlCjidjNM7@zyn@bczi*i>#Yb=}n~FV7>yI&ggFshk{>N`~Jz zlfh9PiVQA01$_f6qYH7WFkjI%DfldqpUdwhQ7CYaOSR4j7S8u!ykpzLR z-{Y&!XSq3fK-YBPF%JwCeR&F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QM>qaOJ-pM3aA@;7Jy+dtth4bm05A?Uw=F`cX zu7VyR@8QxMg^wND*&|Stj!_@tT6+1Dfd^DsJ(WxD+9~C4O8ZKqzk%8{;{)oHHqfqx zE0T?%U4cqt=4FG&;O1q6*P~LkG7%Se!NpKjbhwGzu{nJxDcbkjFdJDMLxU()uuSAD zCh7e^%sSzf$VA{XFt`PoBvYm8R3wZhE@$P(26j)>*j+I`-gEI*>{=;&z6WXz01&9f0Xx5DlLq+Pf(&6DNhdblpkCheN925ugD&wwk zXu8t+74UebB3e<~u*mp+y*uNZI!=YY&;LUV^eVj;hgT zZI8=>pV*Ba76t0_D-_fT=XB&^5I{xLR?-QW?{U5xBw`8X`v5(nK38n05EAykZ*+hd z|MB>LZhOFF@D0i$HXV5TBQp4Q1xyB8;YD&1Fx!7b1{TYF8NM51Fd6K57s)W#GGveg z29v=qcaiM5EP1Kt1(U(Hc9Gn%EP1KP1(U&Ub&+ff42K{6&tUHgCW9@=BDq)e$7BL# zsUZQA!ER%bOkK4M8RR{{WUzl&B)2a|2Du3^8NAdN$rs^2&KcP4bN&49iU*UyOJtFJ zM(oFAf`ANM1Op392Cs=l^3-x<%+jR+CWFW7B3WHxnVkO}e*ZmZ@E~0z$F7(x7^{|4 V5ui^Yke`63i3kMp8u&c~@(<{M9=rem literal 0 HcmV?d00001 diff --git a/Engine/DataFeeds/DataManager.cs b/Engine/DataFeeds/DataManager.cs index 57647b73aa8a..245eef089feb 100644 --- a/Engine/DataFeeds/DataManager.cs +++ b/Engine/DataFeeds/DataManager.cs @@ -109,6 +109,31 @@ public DataManager( new SecurityCache() ); } + + // Let's adjust the start time to the previous tradable date + // 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) && + // 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 + // time to be before the algorithm start time, with the EndTime being the algorithms's start date, + // and both the Equity and the ETFs constituents first selection to happen together. + !universeType.IsAssignableTo(typeof(UserDefinedUniverse)) && + // We exclude the ScheduledUniverse because it's already scheduled to run at a specific time. + // Adjusting the start time would cause the first selection trigger time to be before the algorithm start time, + // making the selection to be triggered at the first algorithm time, which would be the exact StartDate. + universeType != typeof(ScheduledUniverse)) + { + start = Time.GetStartTimeForTradeBars(security.Exchange.Hours, start.ConvertFromUtc(security.Exchange.TimeZone), + Time.OneDay, 1, true, config.DataTimeZone); + start = start.ConvertToUtc(security.Exchange.TimeZone); + } + AddSubscription( new SubscriptionRequest(true, universe, diff --git a/Engine/DataFeeds/Enumerators/Factories/BaseDataCollectionSubscriptionEnumeratorFactory.cs b/Engine/DataFeeds/Enumerators/Factories/BaseDataCollectionSubscriptionEnumeratorFactory.cs index 3d64d08e9330..0d736e7ece3c 100644 --- a/Engine/DataFeeds/Enumerators/Factories/BaseDataCollectionSubscriptionEnumeratorFactory.cs +++ b/Engine/DataFeeds/Enumerators/Factories/BaseDataCollectionSubscriptionEnumeratorFactory.cs @@ -15,7 +15,6 @@ */ using System; -using System.Linq; using QuantConnect.Data; using QuantConnect.Interfaces; using System.Collections.Generic; @@ -55,24 +54,12 @@ public IEnumerator CreateEnumerator(SubscriptionRequest request, IData var configuration = request.Configuration; var sourceFactory = (BaseData)Activator.CreateInstance(request.Configuration.Type); - // we want the first selection to happen on the start time - // so we need the previous tradable day time, since coarse - // files are for each tradable date but emitted with next day time - var previousTradableDay = Time.GetStartTimeForTradeBars( - request.Security.Exchange.Hours, - request.StartTimeLocal, - Time.OneDay, - 1, - false, - configuration.DataTimeZone); - var tradableDays = new[] { previousTradableDay }.Concat(request.TradableDaysInDataTimeZone); - // Behaves in the same way as in live trading // (i.e. only emit coarse data on dates following a trading day) // The shifting of dates is needed to ensure we never emit coarse data on the same date, // because it would enable look-ahead bias. - foreach (var date in tradableDays) + foreach (var date in request.TradableDaysInDataTimeZone) { var source = sourceFactory.GetSource(configuration, date, false); var factory = SubscriptionDataSourceReader.ForSource(source, dataCacheProvider, configuration, date, false, sourceFactory, diff --git a/Tests/Engine/DataFeeds/Enumerators/Factories/BaseDataCollectionSubscriptionEnumeratorFactoryTests.cs b/Tests/Engine/DataFeeds/Enumerators/Factories/BaseDataCollectionSubscriptionEnumeratorFactoryTests.cs index 1e006af5d435..2f72a54317b8 100644 --- a/Tests/Engine/DataFeeds/Enumerators/Factories/BaseDataCollectionSubscriptionEnumeratorFactoryTests.cs +++ b/Tests/Engine/DataFeeds/Enumerators/Factories/BaseDataCollectionSubscriptionEnumeratorFactoryTests.cs @@ -106,8 +106,7 @@ public void ReturnsExpectedTimestamps() using (var enumerator = factory.CreateEnumerator(request, TestGlobals.DataProvider)) { - dateStart = dateStart.AddDays(-1); - for (var i = 0; i <= days; i++) + for (var i = 0; i < days; i++) { Assert.IsTrue(enumerator.MoveNext()); diff --git a/Tests/Engine/DataFeeds/LiveTradingDataFeedTests.cs b/Tests/Engine/DataFeeds/LiveTradingDataFeedTests.cs index 6ea68921fb06..bc14b9aa64fe 100644 --- a/Tests/Engine/DataFeeds/LiveTradingDataFeedTests.cs +++ b/Tests/Engine/DataFeeds/LiveTradingDataFeedTests.cs @@ -19,6 +19,7 @@ using System.Diagnostics; using System.Linq; using System.Threading; +using Microsoft.CodeAnalysis; using Moq; using NodaTime; using NUnit.Framework; @@ -165,6 +166,449 @@ public void LiveChainSelection(SecurityType securityType, Resolution resolution, Assert.AreEqual(2, selectionHappened); } + [Test] + public void ContinuousFuturesImmediateSelection() + { + _startDate = new DateTime(2014, 6, 9); + var startDateUtc = _startDate.ConvertToUtc(_algorithm.TimeZone); + _manualTimeProvider.SetCurrentTimeUtc(startDateUtc); + var endDate = _startDate.AddDays(5); + + _algorithm.SetBenchmark(x => 1); + + var feed = RunDataFeed(runPostInitialize: false); + + var esSelectionTime = DateTime.MinValue; + var esFuture = _algorithm.AddFuture("ES", Resolution.Minute, extendedMarketHours: true); + esFuture.SetFilter(x => + { + esSelectionTime = x.LocalTime.ConvertToUtc(esFuture.Exchange.TimeZone); + + Assert.IsNotEmpty(x); + + return x; + }); + + // DC future time zone is Chicago while ES is New York, we need to assert that both selection happen right away + var dcSelectionTime = DateTime.MinValue; + var dcFuture = _algorithm.AddFuture("DC", Resolution.Minute, extendedMarketHours: true); + dcFuture.SetFilter(x => + { + dcSelectionTime = x.LocalTime.ConvertToUtc(dcFuture.Exchange.TimeZone); + + Assert.IsNotEmpty(x); + + return x; + }); + + _algorithm.PostInitialize(); + + Assert.IsNull(esFuture.Mapped); + Assert.IsNull(dcFuture.Mapped); + + // allow time for the exchange to pick up the selection point + Thread.Sleep(50); + + var timeSliceCount = 0; + ConsumeBridge(feed, TimeSpan.FromSeconds(5), true, ts => + { + timeSliceCount++; + if (esFuture.Mapped != null && dcFuture.Mapped != null) + { + // we got what we wanted shortcut unit test + _manualTimeProvider.SetCurrentTimeUtc(Time.EndOfTime); + } + }, + endDate: endDate, + secondsTimeStep: 60 * 60); + + // Continuous futures should select the first contract immediately + Assert.IsNotNull(esFuture.Mapped); + Assert.IsNotNull(dcFuture.Mapped); + + Assert.AreEqual(startDateUtc, esSelectionTime); + Assert.AreEqual(startDateUtc, dcSelectionTime); + + Assert.AreEqual(1, timeSliceCount); + } + + [Test] + public void ETFsImmediateSelection() + { + _startDate = new DateTime(2020, 12, 1, 1, 0, 0); + var startDateUtc = _startDate.ConvertToUtc(_algorithm.TimeZone); + _manualTimeProvider.SetCurrentTimeUtc(startDateUtc); + var endDate = _startDate.AddDays(5); + + _algorithm.SetBenchmark(x => 1); + + var feed = RunDataFeed(runPostInitialize: false); + + var spy = _algorithm.AddEquity("SPY").Symbol; + + var selectionTime = DateTime.MinValue; + List constituents = null; + + var universe = _algorithm.AddUniverse(_algorithm.Universe.ETF(spy, constituentsData => + { + selectionTime = _algorithm.UtcTime; + constituents = constituentsData.Select(x => x.Symbol).ToList(); + return constituents; + })); + + _algorithm.PostInitialize(); + + // allow time for the exchange to pick up the selection point + Thread.Sleep(50); + + var timeSliceCount = 0; + ConsumeBridge(feed, TimeSpan.FromSeconds(5), true, ts => + { + timeSliceCount++; + if (selectionTime != DateTime.MinValue) + { + // we got what we wanted shortcut unit test + _manualTimeProvider.SetCurrentTimeUtc(Time.EndOfTime); + } + }, + endDate: endDate, + secondsTimeStep: 60 * 60); + + Assert.AreEqual(startDateUtc, selectionTime); + Assert.AreEqual(1, timeSliceCount); + + Assert.IsNotNull(constituents); + Assert.IsNotEmpty(constituents); + + CollectionAssert.AreEquivalent(constituents, universe.Members.Keys); + + // The algorithm's security collection has all constituents and SPY (added manually) + constituents.Add(spy); + CollectionAssert.AreEquivalent(constituents, _algorithm.Securities.Keys); + } + + [Test] + public void CoarseFundamentalsImmediateSelection() + { + _startDate = new DateTime(2014, 03, 26, 9, 0, 0); + var startDateUtc = _startDate.ConvertToUtc(_algorithm.TimeZone); + _manualTimeProvider.SetCurrentTimeUtc(startDateUtc); + var endDate = _startDate.AddDays(5); + + _algorithm.SetBenchmark(x => 1); + + var feed = RunDataFeed(runPostInitialize: false); + + var selectionTime = DateTime.MinValue; + List selectedSymbols = null; + + IEnumerable CoarseFilter(IEnumerable coarse) + { + selectionTime = _algorithm.UtcTime; + selectedSymbols = coarse.Select(x => x.Symbol).ToList(); + return selectedSymbols; + }; + + _algorithm.UniverseSettings.Resolution = Resolution.Daily; + var universe = _algorithm.AddUniverse(CoarseFilter); + + _algorithm.PostInitialize(); + + // allow time for the exchange to pick up the selection point + Thread.Sleep(50); + + var timeSliceCount = 0; + ConsumeBridge(feed, TimeSpan.FromSeconds(5), true, ts => + { + timeSliceCount++; + if (selectionTime != DateTime.MinValue) + { + // we got what we wanted shortcut unit test + _manualTimeProvider.SetCurrentTimeUtc(Time.EndOfTime); + } + }, + endDate: endDate, + secondsTimeStep: 60 * 60); + + Assert.AreEqual(startDateUtc, selectionTime); + Assert.AreEqual(1, timeSliceCount); + + Assert.IsNotNull(selectedSymbols); + Assert.IsNotEmpty(selectedSymbols); + CollectionAssert.AreEquivalent(selectedSymbols, universe.Members.Keys); + CollectionAssert.AreEquivalent(selectedSymbols, _algorithm.Securities.Keys); + } + + [Test] + public void FutureChainsImmediateSelection() + { + _startDate = new DateTime(2014, 6, 9); + var startDateUtc = _startDate.ConvertToUtc(_algorithm.TimeZone); + _manualTimeProvider.SetCurrentTimeUtc(startDateUtc); + var endDate = _startDate.AddDays(5); + + _algorithm.SetBenchmark(x => 1); + + var feed = RunDataFeed(runPostInitialize: false); + + var firstSelectionTimeUtc = DateTime.MinValue; + List selectedSymbols = null; + + var future = _algorithm.AddFuture("ES"); + future.SetFilter(x => + { + firstSelectionTimeUtc = x.LocalTime.ConvertToUtc(future.Exchange.TimeZone); + selectedSymbols = x.ToList(); + + return x; + }); + + _algorithm.PostInitialize(); + + // allow time for the exchange to pick up the selection point + Thread.Sleep(50); + + var timeSliceCount = 0; + ConsumeBridge(feed, TimeSpan.FromSeconds(5), true, ts => + { + timeSliceCount++; + if (firstSelectionTimeUtc != DateTime.MinValue) + { + // we got what we wanted shortcut unit test + _manualTimeProvider.SetCurrentTimeUtc(Time.EndOfTime); + } + }, + endDate: endDate, + secondsTimeStep: 60 * 60); + + Assert.AreEqual(startDateUtc, firstSelectionTimeUtc); + Assert.AreEqual(1, timeSliceCount); + Assert.IsNotNull(selectedSymbols); + Assert.IsNotEmpty(selectedSymbols); + } + + [Test] + public void OptionChainImmediateSelection() + { + _startDate = new DateTime(2015, 12, 24, 11, 0, 0); + var startDateUtc = _startDate.ConvertToUtc(_algorithm.TimeZone); + _manualTimeProvider.SetCurrentTimeUtc(startDateUtc); + var endDate = _startDate.AddDays(5); + + _algorithm.SetBenchmark(x => 1); + + var feed = RunDataFeed(runPostInitialize: false); + + var firstSelectionTimeUtc = DateTime.MinValue; + List selectedSymbols = null; + + var selectionDone = false; + + var option = _algorithm.AddOption("GOOG"); + option.SetFilter(universe => + { + selectionDone = true; + selectedSymbols = universe.ToList(); + + return universe; + }); + + _algorithm.PostInitialize(); + + // allow time for the exchange to pick up the selection point + Thread.Sleep(50); + + var timeSliceCount = 0; + ConsumeBridge(feed, TimeSpan.FromSeconds(10), true, ts => + { + timeSliceCount++; + if (selectionDone) + { + // we got what we wanted shortcut unit test + _manualTimeProvider.SetCurrentTimeUtc(Time.EndOfTime); + } + }, + endDate: endDate, + secondsTimeStep: 60); + + var expectedSelectionTimeUtc = startDateUtc.Add(option.Resolution.ToTimeSpan()); + + Assert.IsTrue(selectionDone); + Assert.AreEqual(2, timeSliceCount); + Assert.IsNotNull(selectedSymbols); + Assert.IsNotEmpty(selectedSymbols); + } + + [Test] + public void CustomUniverseImmediateSelection() + { + _startDate = new DateTime(2013, 10, 07); + var startDateUtc = _startDate.ConvertToUtc(_algorithm.TimeZone); + _manualTimeProvider.SetCurrentTimeUtc(startDateUtc); + var endDate = _startDate.AddDays(5); + + _algorithm.SetBenchmark(x => 1); + + var feed = RunDataFeed(runPostInitialize: false); + + var selectionTime = DateTime.MinValue; + + _algorithm.UniverseSettings.Resolution = Resolution.Daily; + var universe = _algorithm.AddUniverse(SecurityType.Equity, + "my-custom-universe", + Resolution.Daily, + Market.USA, + _algorithm.UniverseSettings, + time => + { + selectionTime = _algorithm.UtcTime; + return new[] { "SPY", "GOOG", "APPL" }; + }); + + _algorithm.PostInitialize(); + + // allow time for the exchange to pick up the selection point + Thread.Sleep(50); + + var timeSliceCount = 0; + ConsumeBridge(feed, TimeSpan.FromSeconds(5), true, ts => + { + timeSliceCount++; + if (selectionTime != DateTime.MinValue) + { + // we got what we wanted shortcut unit test + _manualTimeProvider.SetCurrentTimeUtc(Time.EndOfTime); + } + }, + endDate: endDate, + secondsTimeStep: 60 * 60); + + var expectedSymbols = new List() + { + Symbol.Create("SPY", SecurityType.Equity, Market.USA), + Symbol.Create("GOOG", SecurityType.Equity, Market.USA), + Symbol.Create("APPL", SecurityType.Equity, Market.USA) + }; + + Assert.AreEqual(startDateUtc, selectionTime); + Assert.AreEqual(1, timeSliceCount); + + CollectionAssert.AreEquivalent(expectedSymbols, universe.Members.Keys); + CollectionAssert.AreEquivalent(expectedSymbols, _algorithm.Securities.Keys); + } + + [Test] + public void CustomDataUniverseImmediateSelection() + { + _startDate = new DateTime(2014, 03, 26, 11, 0, 0); + var startDateUtc = _startDate.ConvertToUtc(_algorithm.TimeZone); + _manualTimeProvider.SetCurrentTimeUtc(startDateUtc); + var endDate = _startDate.AddDays(5); + + _algorithm.SetBenchmark(x => 1); + + var feed = RunDataFeed(runPostInitialize: false); + + var selectionTime = DateTime.MinValue; + List selectedSymbols = null; + + _algorithm.UniverseSettings.Resolution = Resolution.Daily; + var universe = _algorithm.AddUniverse("my-custom-coarse-universe", stockDataSource => + { + selectionTime = _algorithm.UtcTime; + selectedSymbols = stockDataSource.Select(x => x.Symbol).ToList(); + + return selectedSymbols; + }); + + _algorithm.PostInitialize(); + + // allow time for the exchange to pick up the selection point + Thread.Sleep(50); + + var timeSliceCount = 0; + ConsumeBridge(feed, TimeSpan.FromSeconds(5), true, ts => + { + timeSliceCount++; + if (selectionTime != DateTime.MinValue) + { + // we got what we wanted shortcut unit test + _manualTimeProvider.SetCurrentTimeUtc(Time.EndOfTime); + } + }, + endDate: endDate, + secondsTimeStep: 60 * 60); + + Assert.AreEqual(startDateUtc, selectionTime); + Assert.AreEqual(1, timeSliceCount); + + Assert.IsNotNull(selectedSymbols); + Assert.IsNotEmpty(selectedSymbols); + CollectionAssert.AreEquivalent(selectedSymbols, universe.Members.Keys); + CollectionAssert.AreEquivalent(selectedSymbols, _algorithm.Securities.Keys); + } + + [Test] + public void ConstituentsImmediateSelection() + { + _startDate = new DateTime(2013, 10, 08); + var startDateUtc = _startDate.ConvertToUtc(_algorithm.TimeZone); + _manualTimeProvider.SetCurrentTimeUtc(startDateUtc); + var endDate = _startDate.AddDays(5); + + _algorithm.SetBenchmark(x => 1); + + var feed = RunDataFeed(runPostInitialize: false); + + var selectionTime = DateTime.MinValue; + List constituents = null; + + _algorithm.UniverseSettings.Resolution = Resolution.Daily; + + var customUniverseSymbol = new Symbol( + SecurityIdentifier.GenerateConstituentIdentifier( + "constituents-universe-qctest", + SecurityType.Equity, + Market.USA), + "constituents-universe-qctest"); + + var universe = _algorithm.AddUniverse(new ConstituentsUniverse(customUniverseSymbol, _algorithm.UniverseSettings, x => + { + selectionTime = _algorithm.UtcTime; + constituents = x.Select(x => x.Symbol).ToList(); + + return constituents; + + })); + + _algorithm.PostInitialize(); + + // allow time for the exchange to pick up the selection point + Thread.Sleep(50); + + var timeSliceCount = 0; + ConsumeBridge(feed, TimeSpan.FromSeconds(5), true, ts => + { + timeSliceCount++; + if (selectionTime != DateTime.MinValue) + { + // we got what we wanted shortcut unit test + _manualTimeProvider.SetCurrentTimeUtc(Time.EndOfTime); + } + }, + endDate: endDate, + secondsTimeStep: 60 * 60); + + Assert.AreEqual(startDateUtc, selectionTime); + Assert.AreEqual(1, timeSliceCount); + + Assert.IsNotNull(constituents); + Assert.IsNotEmpty(constituents); + + CollectionAssert.AreEquivalent(constituents, universe.Members.Keys); + CollectionAssert.AreEquivalent(constituents, _algorithm.Securities.Keys); + } + [TestCase(false)] [TestCase(true)] public void WarmupOptionSelection(bool useWarmupResolution) @@ -392,7 +836,7 @@ public void WarmupExpiredContinuousFuture(bool useWarmupResolution) { _algorithm.SetWarmup(TimeSpan.FromDays(365)); } - var feed = RunDataFeed(); + var feed = RunDataFeed(runPostInitialize: false); var continuousContract = _algorithm.AddFuture(Futures.Indices.SP500EMini, Resolution.Daily, dataNormalizationMode: DataNormalizationMode.BackwardsRatio, @@ -402,6 +846,9 @@ public void WarmupExpiredContinuousFuture(bool useWarmupResolution) // the expiration of this option contract is before the start date of the algorithm but we should still get some data during warmup continuousContract.SetFilter(0, 182); + // Post initialize after securities are added (Initialize) + _algorithm.PostInitialize(); + var emittedChainData = false; var emittedContinuousData = false; var assertedSubscriptions = false; @@ -2063,7 +2510,8 @@ public void DoesNotAggregateTicksToTradeBar() private IDataFeed RunDataFeed(Resolution resolution = Resolution.Second, List equities = null, List forex = null, List crypto = null, Func> getNextTicksFunction = null, Func> lookupSymbolsFunction = null, - Func canPerformSelection = null, IDataQueueHandler dataQueueHandler = null) + Func canPerformSelection = null, IDataQueueHandler dataQueueHandler = null, + bool runPostInitialize = true) { _algorithm.SetStartDate(_startDate); _algorithm.SetDateTime(_manualTimeProvider.GetUtcNow()); @@ -2148,7 +2596,11 @@ private IDataFeed RunDataFeed(Resolution resolution = Resolution.Second, List