diff --git a/Algorithm.CSharp/DefaultSchedulingSymbolRegressionAlgorithm.cs b/Algorithm.CSharp/DefaultSchedulingSymbolRegressionAlgorithm.cs
new file mode 100644
index 000000000000..2de8cc538c17
--- /dev/null
+++ b/Algorithm.CSharp/DefaultSchedulingSymbolRegressionAlgorithm.cs
@@ -0,0 +1,128 @@
+/*
+ * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
+ * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+using System;
+using QuantConnect.Interfaces;
+using System.Collections.Generic;
+
+namespace QuantConnect.Algorithm.CSharp
+{
+ ///
+ /// Regression algorithm asserting a default symbol is created using equity market when scheduling if none found
+ ///
+ public class DefaultSchedulingSymbolRegressionAlgorithm : QCAlgorithm, IRegressionAlgorithmDefinition
+ {
+ private bool _implicitChecked;
+ private bool _explicitChecked;
+
+ ///
+ /// 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(2013, 10, 07);
+ SetEndDate(2013, 10, 11);
+
+ // implicitly figured usa equity
+ Schedule.On(DateRules.Tomorrow, TimeRules.AfterMarketOpen("AAPL"), () =>
+ {
+ _implicitChecked = true;
+ if (Time.TimeOfDay != new TimeSpan(9, 30, 0))
+ {
+ throw new RegressionTestException($"Unexpected time of day {Time.TimeOfDay}");
+ }
+ });
+
+ // picked up from cache
+ AddIndex("SPX");
+ Schedule.On(DateRules.Tomorrow, TimeRules.BeforeMarketClose("SPX", extendedMarketClose: true), () =>
+ {
+ _explicitChecked = true;
+ if (Time.TimeOfDay != new TimeSpan(16, 15, 0))
+ {
+ throw new RegressionTestException($"Unexpected time of day {Time.TimeOfDay}");
+ }
+ });
+ }
+
+ public override void OnEndOfAlgorithm()
+ {
+ if (!_explicitChecked || !_implicitChecked)
+ {
+ throw new RegressionTestException("Failed to run expected checks!");
+ }
+ }
+
+ ///
+ /// This is used by the regression test system to indicate if the open source Lean repository has the required data to run this algorithm.
+ ///
+ public bool CanRunLocally { get; } = true;
+
+ ///
+ /// This is used by the regression test system to indicate which languages this algorithm is written in.
+ ///
+ public List Languages { get; } = new() { Language.CSharp, Language.Python };
+
+ ///
+ /// Data Points count of all timeslices of algorithm
+ ///
+ public long DataPoints => 43;
+
+ ///
+ /// Data Points count of the algorithm history
+ ///
+ public int AlgorithmHistoryDataPoints => 0;
+
+ ///
+ /// Final status of the algorithm
+ ///
+ public AlgorithmStatus AlgorithmStatus => AlgorithmStatus.Completed;
+
+ ///
+ /// This is used by the regression test system to indicate what the expected statistics are from running the algorithm
+ ///
+ public Dictionary ExpectedStatistics => new Dictionary
+ {
+ {"Total Orders", "0"},
+ {"Average Win", "0%"},
+ {"Average Loss", "0%"},
+ {"Compounding Annual Return", "0%"},
+ {"Drawdown", "0%"},
+ {"Expectancy", "0"},
+ {"Start Equity", "100000"},
+ {"End Equity", "100000"},
+ {"Net Profit", "0%"},
+ {"Sharpe Ratio", "0"},
+ {"Sortino Ratio", "0"},
+ {"Probabilistic Sharpe Ratio", "0%"},
+ {"Loss Rate", "0%"},
+ {"Win Rate", "0%"},
+ {"Profit-Loss Ratio", "0"},
+ {"Alpha", "0"},
+ {"Beta", "0"},
+ {"Annual Standard Deviation", "0"},
+ {"Annual Variance", "0"},
+ {"Information Ratio", "-8.91"},
+ {"Tracking Error", "0.223"},
+ {"Treynor Ratio", "0"},
+ {"Total Fees", "$0.00"},
+ {"Estimated Strategy Capacity", "$0"},
+ {"Lowest Capacity Asset", ""},
+ {"Portfolio Turnover", "0%"},
+ {"Drawdown Recovery", "0"},
+ {"OrderListHash", "d41d8cd98f00b204e9800998ecf8427e"}
+ };
+ }
+}
diff --git a/Algorithm.Python/DefaultSchedulingSymbolRegressionAlgorithm.py b/Algorithm.Python/DefaultSchedulingSymbolRegressionAlgorithm.py
new file mode 100644
index 000000000000..38dd2247df99
--- /dev/null
+++ b/Algorithm.Python/DefaultSchedulingSymbolRegressionAlgorithm.py
@@ -0,0 +1,44 @@
+# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
+# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from AlgorithmImports import *
+
+###
+### Regression algorithm asserting a default symbol is created using equity market when scheduling if none found
+###
+class DefaultSchedulingSymbolRegressionAlgorithm(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.set_start_date(2013, 10, 7)
+ self.set_end_date(2013, 10, 11)
+
+ # implicitly figured usa equity
+ self.schedule.on(self.date_rules.tomorrow, self.time_rules.after_market_open("AAPL"), self._implicit_check)
+
+ # picked up from cache
+ self.add_index("SPX")
+ self.schedule.on(self.date_rules.tomorrow, self.time_rules.before_market_close("SPX", extended_market_close = True), self._explicit_check)
+
+ def _implicit_check(self):
+ self._implicitChecked = True
+ if self.time.time() != time(9, 30, 0):
+ raise RegressionTestException(f"Unexpected time of day {self.time.time()}")
+
+ def _explicit_check(self):
+ self._explicitChecked = True
+ if self.time.time() != time(16, 15, 0):
+ raise RegressionTestException(f"Unexpected time of day {self.time.time()}")
+
+ def on_end_of_algorithm(self):
+ if not self._explicitChecked or not self._implicitChecked:
+ raise RegressionTestException("Failed to run expected checks!")
diff --git a/Algorithm/QCAlgorithm.cs b/Algorithm/QCAlgorithm.cs
index c8357c2ad0f6..f64adeeafb42 100644
--- a/Algorithm/QCAlgorithm.cs
+++ b/Algorithm/QCAlgorithm.cs
@@ -58,7 +58,6 @@
using Newtonsoft.Json;
using QuantConnect.Securities.Index;
using QuantConnect.Api;
-using System.Threading.Tasks;
namespace QuantConnect.Algorithm
{
@@ -224,7 +223,7 @@ public QCAlgorithm()
UniverseSettings = new UniverseSettings(Resolution.Minute, Security.NullLeverage, true, false, TimeSpan.FromDays(1));
// initialize our scheduler, this acts as a liason to the real time handler
- Schedule = new ScheduleManager(Securities, TimeZone, MarketHoursDatabase);
+ Schedule = new ScheduleManager(this, Securities, TimeZone, MarketHoursDatabase);
// initialize the trade builder
SetTradeBuilder(new TradeBuilder(FillGroupingMethod.FillToFill, FillMatchingMethod.FIFO));
diff --git a/Common/Scheduling/BaseScheduleRules.cs b/Common/Scheduling/BaseScheduleRules.cs
index fa71b9ed4419..ffe4e3999df2 100644
--- a/Common/Scheduling/BaseScheduleRules.cs
+++ b/Common/Scheduling/BaseScheduleRules.cs
@@ -15,6 +15,7 @@
*/
using NodaTime;
+using QuantConnect.Interfaces;
using QuantConnect.Securities;
namespace QuantConnect.Scheduling
@@ -24,6 +25,9 @@ namespace QuantConnect.Scheduling
///
public class BaseScheduleRules
{
+ private bool _sentImplicitWarning;
+ private readonly IAlgorithm _algorithm;
+
///
/// The algorithm's default time zone
///
@@ -42,13 +46,15 @@ public class BaseScheduleRules
///
/// Initializes a new instance of the helper class
///
+ /// The algorithm instance
/// The security manager
/// The algorithm's default time zone
/// The market hours database instance to use
- public BaseScheduleRules(SecurityManager securities, DateTimeZone timeZone, MarketHoursDatabase marketHoursDatabase)
+ public BaseScheduleRules(IAlgorithm algorithm, SecurityManager securities, DateTimeZone timeZone, MarketHoursDatabase marketHoursDatabase)
{
- Securities = securities;
TimeZone = timeZone;
+ _algorithm = algorithm;
+ Securities = securities;
MarketHoursDatabase = marketHoursDatabase;
}
@@ -63,5 +69,22 @@ protected SecurityExchangeHours GetSecurityExchangeHours(Symbol symbol)
}
return security.Exchange.Hours;
}
+
+ protected Symbol GetSymbol(string ticker)
+ {
+ if (SymbolCache.TryGetSymbol(ticker, out var symbolCache))
+ {
+ return symbolCache;
+ }
+
+ if (!_sentImplicitWarning)
+ {
+ _sentImplicitWarning = true;
+ _algorithm?.Debug($"Warning: no existing symbol found for ticker {ticker}, it will be created with {SecurityType.Equity} type.");
+ }
+ symbolCache = Symbol.Create(ticker, SecurityType.Equity, Market.USA);
+ SymbolCache.Set(ticker, symbolCache);
+ return symbolCache;
+ }
}
}
diff --git a/Common/Scheduling/DateRules.cs b/Common/Scheduling/DateRules.cs
index 266071044f8a..b3a3c7aff6e4 100644
--- a/Common/Scheduling/DateRules.cs
+++ b/Common/Scheduling/DateRules.cs
@@ -18,6 +18,7 @@
using NodaTime;
using System.Linq;
using System.Globalization;
+using QuantConnect.Interfaces;
using QuantConnect.Securities;
using System.Collections.Generic;
@@ -31,11 +32,12 @@ public class DateRules : BaseScheduleRules
///
/// Initializes a new instance of the helper class
///
+ /// The algorithm instance
/// The security manager
/// The algorithm's default time zone
/// The market hours database instance to use
- public DateRules(SecurityManager securities, DateTimeZone timeZone, MarketHoursDatabase marketHoursDatabase)
- : base(securities, timeZone, marketHoursDatabase)
+ public DateRules(IAlgorithm algorithm, SecurityManager securities, DateTimeZone timeZone, MarketHoursDatabase marketHoursDatabase)
+ : base(algorithm, securities, timeZone, marketHoursDatabase)
{
}
@@ -118,6 +120,14 @@ public IDateRule EveryDay()
return new FuncDateRule("EveryDay", Time.EachDay);
}
+ ///
+ /// Specifies an event should fire every day the symbol is trading
+ ///
+ /// The symbol whose exchange is used to determine tradable dates
+ /// True to include days with extended market hours only, like sunday for futures
+ /// A date rule that fires every day the specified symbol trades
+ public IDateRule EveryDay(string symbol, bool extendedMarketHours = false) => EveryDay(GetSymbol(symbol), extendedMarketHours);
+
///
/// Specifies an event should fire every day the symbol is trading
///
@@ -137,9 +147,19 @@ public IDateRule EveryDay(Symbol symbol, bool extendedMarketHours = false)
/// A date rule that fires on the first of each year + offset
public IDateRule YearStart(int daysOffset = 0)
{
- return YearStart(null, daysOffset, false);
+ return YearStart((Symbol)null, daysOffset, false);
}
+ ///
+ /// Specifies an event should fire on the first tradable date + offset for the specified symbol of each year
+ ///
+ /// The symbol whose exchange is used to determine the first tradable date of the year
+ /// The amount of tradable days to offset the schedule by; must be between 0 and 365
+ /// True to include days with extended market hours only, like sunday for futures
+ /// A date rule that fires on the first tradable date + offset for the
+ /// specified security each year
+ public IDateRule YearStart(string symbol, int daysOffset = 0, bool extendedMarketHours = true) => YearStart(GetSymbol(symbol), daysOffset, extendedMarketHours);
+
///
/// Specifies an event should fire on the first tradable date + offset for the specified symbol of each year
///
@@ -173,9 +193,18 @@ public IDateRule YearStart(Symbol symbol, int daysOffset = 0, bool extendedMarke
/// A date rule that fires on the last of each year - offset
public IDateRule YearEnd(int daysOffset = 0)
{
- return YearEnd(null, daysOffset, false);
+ return YearEnd((Symbol)null, daysOffset, false);
}
+ ///
+ /// Specifies an event should fire on the last tradable date - offset for the specified symbol of each year
+ ///
+ /// The symbol whose exchange is used to determine the last tradable date of the year
+ /// The amount of tradable days to offset the schedule by; must be between 0 and 365.
+ /// True to include days with extended market hours only, like sunday for futures
+ /// A date rule that fires on the last tradable date - offset for the specified security each year
+ public IDateRule YearEnd(string symbol, int daysOffset = 0, bool extendedMarketHours = true) => YearEnd(GetSymbol(symbol), daysOffset, extendedMarketHours);
+
///
/// Specifies an event should fire on the last tradable date - offset for the specified symbol of each year
///
@@ -211,6 +240,16 @@ public IDateRule MonthStart(int daysOffset = 0)
return new FuncDateRule(GetName(null, "MonthStart", daysOffset), (start, end) => MonthIterator(null, start, end, daysOffset, true, false));
}
+ ///
+ /// Specifies an event should fire on the first tradable date + offset for the specified symbol of each month
+ ///
+ /// The symbol whose exchange is used to determine the first tradable date of the month
+ /// The amount of tradable days to offset the schedule by; must be between 0 and 30
+ /// True to include days with extended market hours only, like sunday for futures
+ /// A date rule that fires on the first tradable date + offset for the
+ /// specified security each month
+ public IDateRule MonthStart(string symbol, int daysOffset = 0, bool extendedMarketHours = true) => MonthStart(GetSymbol(symbol), daysOffset, extendedMarketHours);
+
///
/// Specifies an event should fire on the first tradable date + offset for the specified symbol of each month
///
@@ -241,6 +280,15 @@ public IDateRule MonthEnd(int daysOffset = 0)
return new FuncDateRule(GetName(null, "MonthEnd", -daysOffset), (start, end) => MonthIterator(null, start, end, daysOffset, false, false));
}
+ ///
+ /// Specifies an event should fire on the last tradable date - offset for the specified symbol of each month
+ ///
+ /// The symbol whose exchange is used to determine the last tradable date of the month
+ /// The amount of tradable days to offset the schedule by; must be between 0 and 30.
+ /// True to include days with extended market hours only, like sunday for futures
+ /// A date rule that fires on the last tradable date - offset for the specified security each month
+ public IDateRule MonthEnd(string symbol, int daysOffset = 0, bool extendedMarketHours = true) => MonthEnd(GetSymbol(symbol), daysOffset, extendedMarketHours);
+
///
/// Specifies an event should fire on the last tradable date - offset for the specified symbol of each month
///
@@ -276,6 +324,18 @@ public IDateRule WeekStart(int daysOffset = 0)
return new FuncDateRule(GetName(null, "WeekStart", daysOffset), (start, end) => WeekIterator(null, start, end, daysOffset, true, false));
}
+ ///
+ /// Specifies an event should fire on the first tradable date + offset for the specified
+ /// symbol each week
+ ///
+ /// The symbol whose exchange is used to determine the first
+ /// tradeable date of the week
+ /// The amount of tradable days to offset the first tradable day by
+ /// True to include extended market hours, false otherwise
+ /// A date rule that fires on the first + offset tradable date for the specified
+ /// security each week
+ public IDateRule WeekStart(string symbol, int daysOffset = 0, bool extendedMarketHours = true) => WeekStart(GetSymbol(symbol), daysOffset, extendedMarketHours);
+
///
/// Specifies an event should fire on the first tradable date + offset for the specified
/// symbol each week
@@ -320,6 +380,17 @@ public IDateRule WeekEnd(int daysOffset = 0)
return new FuncDateRule(GetName(null, "WeekEnd", -daysOffset), (start, end) => WeekIterator(null, start, end, daysOffset, false, false));
}
+ ///
+ /// Specifies an event should fire on the last - offset tradable date for the specified
+ /// symbol of each week
+ ///
+ /// The symbol whose exchange is used to determine the last
+ /// tradable date of the week
+ /// The amount of tradable days to offset the last tradable day by each week
+ /// True to include extended market hours, false otherwise
+ /// A date rule that fires on the last - offset tradable date for the specified security each week
+ public IDateRule WeekEnd(string symbol, int daysOffset = 0, bool extendedMarketHours = true) => WeekEnd(GetSymbol(symbol), daysOffset, extendedMarketHours);
+
///
/// Specifies an event should fire on the last - offset tradable date for the specified
/// symbol of each week
diff --git a/Common/Scheduling/ScheduleManager.cs b/Common/Scheduling/ScheduleManager.cs
index 4dbeeae63f99..61b0448769d6 100644
--- a/Common/Scheduling/ScheduleManager.cs
+++ b/Common/Scheduling/ScheduleManager.cs
@@ -15,11 +15,12 @@
*/
using System;
-using System.Collections.Generic;
using NodaTime;
-using QuantConnect.Securities;
-using QuantConnect.Logging;
using Python.Runtime;
+using QuantConnect.Logging;
+using QuantConnect.Interfaces;
+using QuantConnect.Securities;
+using System.Collections.Generic;
namespace QuantConnect.Scheduling
{
@@ -47,14 +48,15 @@ public class ScheduleManager : IEventSchedule
///
/// Initializes a new instance of the class
///
+ /// The algorithm instance
/// Securities manager containing the algorithm's securities
/// The algorithm's time zone
/// The market hours database instance to use
- public ScheduleManager(SecurityManager securities, DateTimeZone timeZone, MarketHoursDatabase marketHoursDatabase)
+ public ScheduleManager(IAlgorithm algorithm, SecurityManager securities, DateTimeZone timeZone, MarketHoursDatabase marketHoursDatabase)
{
_securities = securities;
- DateRules = new DateRules(securities, timeZone, marketHoursDatabase);
- TimeRules = new TimeRules(securities, timeZone, marketHoursDatabase);
+ DateRules = new DateRules(algorithm, securities, timeZone, marketHoursDatabase);
+ TimeRules = new TimeRules(algorithm, securities, timeZone, marketHoursDatabase);
// used for storing any events before the event schedule is set
_preInitializedEvents = new List();
diff --git a/Common/Scheduling/TimeRules.cs b/Common/Scheduling/TimeRules.cs
index ab8511ba6f8f..b67f39c154e5 100644
--- a/Common/Scheduling/TimeRules.cs
+++ b/Common/Scheduling/TimeRules.cs
@@ -17,6 +17,7 @@
using System;
using NodaTime;
using System.Linq;
+using QuantConnect.Interfaces;
using QuantConnect.Securities;
using System.Collections.Generic;
using static QuantConnect.StringExtensions;
@@ -31,11 +32,12 @@ public class TimeRules : BaseScheduleRules
///
/// Initializes a new instance of the helper class
///
+ /// The algorithm instance
/// The security manager
/// The algorithm's default time zone
/// The market hours database instance to use
- public TimeRules(SecurityManager securities, DateTimeZone timeZone, MarketHoursDatabase marketHoursDatabase)
- : base(securities, timeZone, marketHoursDatabase)
+ public TimeRules(IAlgorithm algorithm, SecurityManager securities, DateTimeZone timeZone, MarketHoursDatabase marketHoursDatabase)
+ : base(algorithm, securities, timeZone, marketHoursDatabase)
{
}
@@ -153,6 +155,15 @@ public ITimeRule Every(TimeSpan interval)
return new FuncTimeRule(name, applicator);
}
+ ///
+ /// Specifies an event should fire at market open +-
+ ///
+ /// The symbol whose market open we want an event for
+ /// The minutes before market open that the event should fire
+ /// True to use extended market open, false to use regular market open
+ /// A time rule that fires the specified number of minutes before the symbol's market open
+ public ITimeRule BeforeMarketOpen(string symbol, double minutesBeforeOpen = 0, bool extendedMarketOpen = false) => BeforeMarketOpen(GetSymbol(symbol), minutesBeforeOpen, extendedMarketOpen);
+
///
/// Specifies an event should fire at market open +-
///
@@ -165,6 +176,15 @@ public ITimeRule BeforeMarketOpen(Symbol symbol, double minutesBeforeOpen = 0, b
return AfterMarketOpen(symbol, minutesBeforeOpen * (-1), extendedMarketOpen);
}
+ ///
+ /// Specifies an event should fire at market open +-
+ ///
+ /// The symbol whose market open we want an event for
+ /// The minutes after market open that the event should fire
+ /// True to use extended market open, false to use regular market open
+ /// A time rule that fires the specified number of minutes after the symbol's market open
+ public ITimeRule AfterMarketOpen(string symbol, double minutesAfterOpen = 0, bool extendedMarketOpen = false) => AfterMarketOpen(GetSymbol(symbol), minutesAfterOpen, extendedMarketOpen);
+
///
/// Specifies an event should fire at market open +-
///
@@ -192,6 +212,15 @@ where exchangeHours.IsDateOpen(date, extendedMarketOpen) && marketOpen.Date == d
return new FuncTimeRule(name, applicator);
}
+ ///
+ /// Specifies an event should fire at the market close +-
+ ///
+ /// The symbol whose market close we want an event for
+ /// The time after market close that the event should fire
+ /// True to use extended market close, false to use regular market close
+ /// A time rule that fires the specified number of minutes after the symbol's market close
+ public ITimeRule AfterMarketClose(string symbol, double minutesAfterClose = 0, bool extendedMarketClose = false) => AfterMarketClose(GetSymbol(symbol), minutesAfterClose, extendedMarketClose);
+
///
/// Specifies an event should fire at the market close +-
///
@@ -204,6 +233,15 @@ public ITimeRule AfterMarketClose(Symbol symbol, double minutesAfterClose = 0, b
return BeforeMarketClose(symbol, minutesAfterClose * (-1), extendedMarketClose);
}
+ ///
+ /// Specifies an event should fire at the market close +-
+ ///
+ /// The symbol whose market close we want an event for
+ /// The time before market close that the event should fire
+ /// True to use extended market close, false to use regular market close
+ /// A time rule that fires the specified number of minutes before the symbol's market close
+ public ITimeRule BeforeMarketClose(string symbol, double minutesBeforeClose = 0, bool extendedMarketClose = false) => BeforeMarketClose(GetSymbol(symbol), minutesBeforeClose, extendedMarketClose);
+
///
/// Specifies an event should fire at the market close +-
///
diff --git a/Common/SecurityIdentifier.cs b/Common/SecurityIdentifier.cs
index 7f12f83f84d8..5cd1ea6989b3 100644
--- a/Common/SecurityIdentifier.cs
+++ b/Common/SecurityIdentifier.cs
@@ -846,16 +846,12 @@ private static bool TryParse(string value, out SecurityIdentifier identifier, ou
private static void CacheSid(string key, SecurityIdentifier identifier)
{
- lock (SecurityIdentifierCache)
+ // limit the cache size to help with memory usage
+ if (SecurityIdentifierCache.Count >= 600000)
{
- // limit the cache size to help with memory usage
- if (SecurityIdentifierCache.Count >= 600000)
- {
- SecurityIdentifierCache.Clear();
- }
-
- SecurityIdentifierCache[key] = identifier;
+ SecurityIdentifierCache.Clear();
}
+ SecurityIdentifierCache[key] = identifier;
}
///
diff --git a/Engine/Results/IResultHandler.cs b/Engine/Results/IResultHandler.cs
index 993ce32dc485..32cf6017f2ea 100644
--- a/Engine/Results/IResultHandler.cs
+++ b/Engine/Results/IResultHandler.cs
@@ -21,7 +21,6 @@
using QuantConnect.Brokerages;
using QuantConnect.Data.UniverseSelection;
using QuantConnect.Interfaces;
-using QuantConnect.Lean.Engine.TransactionHandlers;
using QuantConnect.Orders;
using QuantConnect.Packets;
using QuantConnect.Statistics;
diff --git a/Tests/Algorithm/Framework/Portfolio/PortfolioConstructionModelTests.cs b/Tests/Algorithm/Framework/Portfolio/PortfolioConstructionModelTests.cs
index 54886ef907c3..0e803d92bc35 100644
--- a/Tests/Algorithm/Framework/Portfolio/PortfolioConstructionModelTests.cs
+++ b/Tests/Algorithm/Framework/Portfolio/PortfolioConstructionModelTests.cs
@@ -303,7 +303,7 @@ def RebalanceFunc(time):
public void RebalanceFunctionDateRules(Language language)
{
var mhdb = MarketHoursDatabase.FromDataFolder();
- var dateRules = new DateRules(new SecurityManager(
+ var dateRules = new DateRules(null, new SecurityManager(
new TimeKeeper(new DateTime(2015, 1, 1), DateTimeZone.Utc)), DateTimeZone.Utc, mhdb);
TestPortfolioConstructionModel constructionModel;
diff --git a/Tests/Common/Data/UniverseSelection/ScheduledUniverseTests.cs b/Tests/Common/Data/UniverseSelection/ScheduledUniverseTests.cs
index 6fe022d0827f..12d98119ccc7 100644
--- a/Tests/Common/Data/UniverseSelection/ScheduledUniverseTests.cs
+++ b/Tests/Common/Data/UniverseSelection/ScheduledUniverseTests.cs
@@ -41,8 +41,8 @@ public void Setup()
_securities = new SecurityManager(_timekeeper);
var mhdb = MarketHoursDatabase.FromDataFolder();
- _dateRules = new DateRules(_securities, _timezone, mhdb);
- _timeRules = new TimeRules(_securities, _timezone, mhdb);
+ _dateRules = new DateRules(null, _securities, _timezone, mhdb);
+ _timeRules = new TimeRules(null, _securities, _timezone, mhdb);
}
[Test]
diff --git a/Tests/Common/Scheduling/DateRulesTests.cs b/Tests/Common/Scheduling/DateRulesTests.cs
index 91971730b954..46798f99078a 100644
--- a/Tests/Common/Scheduling/DateRulesTests.cs
+++ b/Tests/Common/Scheduling/DateRulesTests.cs
@@ -1047,7 +1047,7 @@ private static DateRules GetDateRules()
)
);
- var rules = new DateRules(manager, TimeZones.NewYork, mhdb);
+ var rules = new DateRules(null, manager, TimeZones.NewYork, mhdb);
return rules;
}
}
diff --git a/Tests/Common/Scheduling/TimeRulesTests.cs b/Tests/Common/Scheduling/TimeRulesTests.cs
index 5d9c4b30876b..a36c8ef69aec 100644
--- a/Tests/Common/Scheduling/TimeRulesTests.cs
+++ b/Tests/Common/Scheduling/TimeRulesTests.cs
@@ -492,7 +492,7 @@ private static TimeRules GetTimeRules(DateTimeZone dateTimeZone)
new SecurityCache()
)
);
- var rules = new TimeRules(manager, dateTimeZone, mhdb);
+ var rules = new TimeRules(null, manager, dateTimeZone, mhdb);
return rules;
}
@@ -517,7 +517,7 @@ private static TimeRules GetFutureTimeRules(DateTimeZone dateTimeZone, bool exte
new SecurityCache()
)
);
- var rules = new TimeRules(manager, dateTimeZone, mhdb);
+ var rules = new TimeRules(null, manager, dateTimeZone, mhdb);
return rules;
}
}
diff --git a/Tests/Common/Util/ExtensionsTests.cs b/Tests/Common/Util/ExtensionsTests.cs
index 0960d0f6d6e3..a4894e46d403 100644
--- a/Tests/Common/Util/ExtensionsTests.cs
+++ b/Tests/Common/Util/ExtensionsTests.cs
@@ -1720,7 +1720,7 @@ public void DecimalAllowExponentTests()
public void DateRulesToFunc()
{
var mhdb = MarketHoursDatabase.FromDataFolder();
- var dateRules = new DateRules(new SecurityManager(
+ var dateRules = new DateRules(null, new SecurityManager(
new TimeKeeper(new DateTime(2015, 1, 1), DateTimeZone.Utc)), DateTimeZone.Utc, mhdb);
var first = new DateTime(2015, 1, 10);
var second = new DateTime(2015, 1, 30);