/// <summary> /// Initializes a new instance of the <see cref="ScheduledUniverseSelectionModel"/> class using the algorithm's time zone /// </summary> /// <param name="dateRule">Date rule defines what days the universe selection function will be invoked</param> /// <param name="timeRule">Time rule defines what times on each day selected by date rule the universe selection function will be invoked</param> /// <param name="selector">Selector function accepting the date time firing time and returning the universe selected symbols</param> /// <param name="settings">Universe settings for subscriptions added via this universe, null will default to algorithm's universe settings</param> public ScheduledUniverseSelectionModel(IDateRule dateRule, ITimeRule timeRule, Func <DateTime, IEnumerable <Symbol> > selector, UniverseSettings settings = null) { _dateRule = dateRule; _timeRule = timeRule; _selector = selector; _settings = settings; }
/// <summary> /// Helper methods to defer the evaluation of the current time until the dates are enumerated for the first time. /// This allows for correct support for warmup period /// </summary> internal static IEnumerable <DateTime> GetDatesDeferred(IDateRule dateRule, SecurityManager securities) { foreach (var item in dateRule.GetDates(securities.UtcTime.Date.AddDays(-1), Time.EndOfTime)) { yield return(item); } }
/// <summary> /// Schedules the callback to run using the specified date and time rules /// </summary> /// <param name="name">The event's unique name</param> /// <param name="dateRule">Specifies what dates the event should run</param> /// <param name="timeRule">Specifies the times on those dates the event should run</param> /// <param name="callback">The callback to be invoked</param> public void On(string name, IDateRule dateRule, ITimeRule timeRule, Action callback) { var dates = dateRule.GetDates(_securities.UtcTime, Time.EndOfTime); var eventTimes = timeRule.CreateUtcEventTimes(dates); var scheduledEvent = new ScheduledEvent(name, eventTimes, (s, time) => callback()); _eventSchedule.Add(scheduledEvent); }
/// <summary> /// Schedules the callback to run using the specified date and time rules /// </summary> /// <param name="name">The event's unique name</param> /// <param name="dateRule">Specifies what dates the event should run</param> /// <param name="timeRule">Specifies the times on those dates the event should run</param> /// <param name="callback">The callback to be invoked</param> public ScheduledEvent On(string name, IDateRule dateRule, ITimeRule timeRule, Action <string, DateTime> callback) { // back the date up to ensure we get all events, the event scheduler will skip past events that whose time has passed var dates = dateRule.GetDates(_securities.UtcTime.Date.AddDays(-1), Time.EndOfTime); var eventTimes = timeRule.CreateUtcEventTimes(dates); var scheduledEvent = new ScheduledEvent(name, eventTimes, callback); Add(scheduledEvent); var exampleTimes = eventTimes.Take(3) .Select(x => x.ToString()) .ToArray(); if (exampleTimes.Length > 0) { Log.Trace("Event Name \"{0}\", scheduled to run at {1} (UTC){2}", name, string.Join(", ", exampleTimes), exampleTimes.Length > 1? "..." : ""); } else { Log.Trace("Event Name \"{0}\", scheduled to run, but no event times were selected", name); } return(scheduledEvent); }
/// <summary> /// Initializes a new instance of the <see cref="ScheduledUniverse"/> class /// </summary> /// <param name="timeZone">The time zone the date/time rules are in</param> /// <param name="dateRule">Date rule defines what days the universe selection function will be invoked</param> /// <param name="timeRule">Time rule defines what times on each day selected by date rule the universe selection function will be invoked</param> /// <param name="selector">Selector function accepting the date time firing time and returning the universe selected symbols</param> /// <param name="settings">Universe settings for subscriptions added via this universe, null will default to algorithm's universe settings</param> /// <param name="securityInitializer">Security initializer for new securities created via this universe, null will default to algorithm's security initializer</param> public ScheduledUniverse(DateTimeZone timeZone, IDateRule dateRule, ITimeRule timeRule, Func <DateTime, IEnumerable <Symbol> > selector, UniverseSettings settings = null, ISecurityInitializer securityInitializer = null) : base(CreateConfiguration(timeZone, dateRule, timeRule), securityInitializer) { _dateRule = dateRule; _timeRule = timeRule; _selector = selector; UniverseSettings = settings; }
/// <summary> /// Initializes a new instance of the <see cref="ScheduledUniverseSelectionModel"/> class using the algorithm's time zone /// </summary> /// <param name="dateRule">Date rule defines what days the universe selection function will be invoked</param> /// <param name="timeRule">Time rule defines what times on each day selected by date rule the universe selection function will be invoked</param> /// <param name="selector">Selector function accepting the date time firing time and returning the universe selected symbols</param> /// <param name="settings">Universe settings for subscriptions added via this universe, null will default to algorithm's universe settings</param> /// <param name="initializer">Security initializer for new securities created via this universe, null will default to algorithm's security initializer</param> public ScheduledUniverseSelectionModel(IDateRule dateRule, ITimeRule timeRule, Func <DateTime, IEnumerable <Symbol> > selector, UniverseSettings settings = null, ISecurityInitializer initializer = null) { _dateRule = dateRule; _timeRule = timeRule; _selector = selector; _settings = settings; _initializer = initializer; }
/// <summary> /// Initialize the model /// </summary> /// <param name="rebalancingDateRules">The date rules used to define the next expected rebalance time /// in UTC</param> /// <param name="lookback">Historical return lookback period</param> /// <param name="period">The time interval of history price to calculate the weight</param> /// <param name="resolution">The resolution of the history price</param> /// <param name="targetReturn">The target portfolio return</param> /// <param name="optimizer">The portfolio optimization algorithm. If the algorithm is not provided then the default will be mean-variance optimization.</param> public MeanVarianceOptimizationPortfolioConstructionModel(IDateRule rebalancingDateRules, int lookback = 1, int period = 63, Resolution resolution = Resolution.Daily, double targetReturn = 0.02, IPortfolioOptimizer optimizer = null) : this(rebalancingDateRules.ToFunc(), lookback, period, resolution, targetReturn, optimizer) { }
public ScheduledEvent On(string name, IDateRule dateRule, ITimeRule timeRule, Action <string, DateTime> callback) { var dates = dateRule.GetDates(_securities.UtcTime.Date.AddDays(-1), Time.EndOfTime); var eventTimes = timeRule.CreateUtcEventTimes(dates); var scheduledEvent = new ScheduledEvent(name, eventTimes, callback); Add(scheduledEvent); return(scheduledEvent); }
/// <summary> /// Schedules the callback to run using the specified date and time rules /// </summary> /// <param name="name">The event's unique name</param> /// <param name="dateRule">Specifies what dates the event should run</param> /// <param name="timeRule">Specifies the times on those dates the event should run</param> /// <param name="callback">The callback to be invoked</param> public ScheduledEvent On(string name, IDateRule dateRule, ITimeRule timeRule, Action <string, DateTime> callback) { // back the date up to ensure we get all events, the event scheduler will skip past events that whose time has passed var dates = dateRule.GetDates(_securities.UtcTime.Date.AddDays(-1), Time.EndOfTime); var eventTimes = timeRule.CreateUtcEventTimes(dates); var scheduledEvent = new ScheduledEvent(name, eventTimes, callback); Add(scheduledEvent); return(scheduledEvent); }
/// <summary> /// Initializes a new instance of the <see cref="ScheduledUniverseSelectionModel"/> class /// </summary> /// <param name="timeZone">The time zone the date/time rules are in</param> /// <param name="dateRule">Date rule defines what days the universe selection function will be invoked</param> /// <param name="timeRule">Time rule defines what times on each day selected by date rule the universe selection function will be invoked</param> /// <param name="selector">Selector function accepting the date time firing time and returning the universe selected symbols</param> /// <param name="settings">Universe settings for subscriptions added via this universe, null will default to algorithm's universe settings</param> public ScheduledUniverseSelectionModel(DateTimeZone timeZone, IDateRule dateRule, ITimeRule timeRule, PyObject selector, UniverseSettings settings = null) { Func <DateTime, object> func; selector.TryConvertToDelegate(out func); _timeZone = timeZone; _dateRule = dateRule; _timeRule = timeRule; _selector = func.ConvertToUniverseSelectionSymbolDelegate(); _settings = settings; }
/// <summary> /// Initializes a new instance of the <see cref="ScheduledUniverseSelectionModel"/> class using the algorithm's time zone /// </summary> /// <param name="dateRule">Date rule defines what days the universe selection function will be invoked</param> /// <param name="timeRule">Time rule defines what times on each day selected by date rule the universe selection function will be invoked</param> /// <param name="selector">Selector function accepting the date time firing time and returning the universe selected symbols</param> /// <param name="settings">Universe settings for subscriptions added via this universe, null will default to algorithm's universe settings</param> /// <param name="initializer">Security initializer for new securities created via this universe, null will default to algorithm's security initializer</param> public ScheduledUniverseSelectionModel(IDateRule dateRule, ITimeRule timeRule, PyObject selector, UniverseSettings settings = null, ISecurityInitializer initializer = null) { Func <DateTime, Symbol[]> func; selector.TryConvertToDelegate(out func); _dateRule = dateRule; _timeRule = timeRule; _selector = func; _settings = settings; _initializer = initializer; }
/// <summary> /// Initializes a new instance of the <see cref="ScheduledUniverse"/> class /// </summary> /// <param name="timeZone">The time zone the date/time rules are in</param> /// <param name="dateRule">Date rule defines what days the universe selection function will be invoked</param> /// <param name="timeRule">Time rule defines what times on each day selected by date rule the universe selection function will be invoked</param> /// <param name="selector">Selector function accepting the date time firing time and returning the universe selected symbols</param> /// <param name="settings">Universe settings for subscriptions added via this universe, null will default to algorithm's universe settings</param> public ScheduledUniverse(DateTimeZone timeZone, IDateRule dateRule, ITimeRule timeRule, PyObject selector, UniverseSettings settings = null) : base(CreateConfiguration(timeZone, dateRule, timeRule)) { Func <DateTime, object> func; selector.TryConvertToDelegate(out func); _dateRule = dateRule; _timeRule = timeRule; _selector = func.ConvertToUniverseSelectionSymbolDelegate(); UniverseSettings = settings; }
/// <summary> /// Initializes a new instance of the <see cref="ScheduledUniverse"/> class /// </summary> /// <param name="timeZone">The time zone the date/time rules are in</param> /// <param name="dateRule">Date rule defines what days the universe selection function will be invoked</param> /// <param name="timeRule">Time rule defines what times on each day selected by date rule the universe selection function will be invoked</param> /// <param name="selector">Selector function accepting the date time firing time and returning the universe selected symbols</param> /// <param name="settings">Universe settings for subscriptions added via this universe, null will default to algorithm's universe settings</param> /// <param name="securityInitializer">Security initializer for new securities created via this universe, null will default to algorithm's security initializer</param> public ScheduledUniverse(DateTimeZone timeZone, IDateRule dateRule, ITimeRule timeRule, PyObject selector, UniverseSettings settings = null, ISecurityInitializer securityInitializer = null) : base(CreateConfiguration(timeZone, dateRule, timeRule)) { Func <DateTime, Symbol[]> func; selector.TryConvertToDelegate(out func); _dateRule = dateRule; _timeRule = timeRule; _selector = func; UniverseSettings = settings; }
/// <summary> /// Initialize the model /// </summary> /// <param name="rebalancingDateRules">The date rules used to define the next expected rebalance time /// in UTC</param> /// <param name="lookback">Historical return lookback period</param> /// <param name="period">The time interval of history price to calculate the weight</param> /// <param name="resolution">The resolution of the history price</param> /// <param name="riskFreeRate">The risk free rate</param> /// <param name="delta">The risk aversion coeffficient of the market portfolio</param> /// <param name="tau">The model parameter indicating the uncertainty of the CAPM prior</param> /// <param name="optimizer">The portfolio optimization algorithm. If no algorithm is explicitly provided then the default will be max Sharpe ratio optimization.</param> public BlackLittermanOptimizationPortfolioConstructionModel(IDateRule rebalancingDateRules, int lookback = 1, int period = 63, Resolution resolution = Resolution.Daily, double riskFreeRate = 0.0, double delta = 2.5, double tau = 0.05, IPortfolioOptimizer optimizer = null) : this(rebalancingDateRules.ToFunc(), lookback, period, resolution, riskFreeRate, delta, tau, optimizer) { }
/// <summary> /// Schedules the callback to run using the specified date and time rules /// </summary> /// <param name="name">The event's unique name</param> /// <param name="dateRule">Specifies what dates the event should run</param> /// <param name="timeRule">Specifies the times on those dates the event should run</param> /// <param name="callback">The callback to be invoked</param> public ScheduledEvent On(string name, IDateRule dateRule, ITimeRule timeRule, Action <string, DateTime> callback) { // back the date up to ensure we get all events, the event scheduler will skip past events that whose time has passed var dates = GetDatesDeferred(dateRule, _securities); var eventTimes = timeRule.CreateUtcEventTimes(dates); var scheduledEvent = new ScheduledEvent(name, eventTimes, callback); Add(scheduledEvent); Log.Trace($"Event Name \"{scheduledEvent.Name}\", scheduled to run."); return(scheduledEvent); }
/// <summary> /// Schedules the callback to run using the specified date and time rules /// </summary> /// <param name="name">The event's unique name</param> /// <param name="dateRule">Specifies what dates the event should run</param> /// <param name="timeRule">Specifies the times on those dates the event should run</param> /// <param name="callback">The callback to be invoked</param> public ScheduledEvent On(string name, IDateRule dateRule, ITimeRule timeRule, Action <string, DateTime> callback) { // back the date up to ensure we get all events, the event scheduler will skip past events that whose time has passed var dates = dateRule.GetDates(_securities.UtcTime.Date.AddDays(-1), Time.EndOfTime); var eventTimes = timeRule.CreateUtcEventTimes(dates); var scheduledEvent = new ScheduledEvent(name, eventTimes, callback); Add(scheduledEvent); // ScheduledEvent constructor will prime the scheduled event if (scheduledEvent.NextEventUtcTime != DateTime.MaxValue) { Log.Trace($"Event Name \"{scheduledEvent.Name}\", scheduled to run at {scheduledEvent.NextEventUtcTime} (UTC)..."); } else { Log.Error($"Event Name \"{scheduledEvent.Name}\", scheduled to run, but no event times were selected"); } return(scheduledEvent); }
IFluentSchedulingTimeSpecifier IFluentSchedulingDateSpecifier.On(int year, int month, int day) { _dateRule = _schedule.DateRules.On(year, month, day); return this; }
/// <summary> /// Creates events on the first trading day of the month /// </summary> IFluentSchedulingTimeSpecifier IFluentSchedulingDateSpecifier.MonthStart(string symbol) { _dateRule = _schedule.DateRules.MonthStart(symbol); return this; }
/// <summary> /// Schedules the training code to run using the specified date and time rules /// </summary> /// <param name="dateRule">Specifies what dates the event should run</param> /// <param name="timeRule">Specifies the times on those dates the event should run</param> /// <param name="trainingCode">The training code to be invoked</param> public ScheduledEvent Training(IDateRule dateRule, ITimeRule timeRule, Action <DateTime> trainingCode) { var name = $"{dateRule.Name}: {timeRule.Name}"; return(On(name, dateRule, timeRule, (n, time) => trainingCode(time))); }
/// <summary> /// Schedules the callback to run using the specified date and time rules /// </summary> /// <param name="name">The event's unique name</param> /// <param name="dateRule">Specifies what dates the event should run</param> /// <param name="timeRule">Specifies the times on those dates the event should run</param> /// <param name="callback">The callback to be invoked</param> public ScheduledEvent On(string name, IDateRule dateRule, ITimeRule timeRule, Action callback) { return(On(name, dateRule, timeRule, (n, d) => callback())); }
/// <summary> /// Schedules the callback to run using the specified date and time rules /// </summary> /// <param name="dateRule">Specifies what dates the event should run</param> /// <param name="timeRule">Specifies the times on those dates the event should run</param> /// <param name="callback">The callback to be invoked</param> public ScheduledEvent On(IDateRule dateRule, ITimeRule timeRule, Action callback) { return(On(dateRule, timeRule, (name, time) => callback())); }
/// <summary> /// Schedules the callback to run using the specified date and time rules /// </summary> /// <param name="dateRule">Specifies what dates the event should run</param> /// <param name="timeRule">Specifies the times on those dates the event should run</param> /// <param name="callback">The callback to be invoked</param> public ScheduledEvent On(IDateRule dateRule, ITimeRule timeRule, Action<string, DateTime> callback) { var name = dateRule.Name + ": " + timeRule.Name; return On(name, dateRule, timeRule, callback); }
/// <summary> /// Schedules the callback to run using the specified date and time rules /// </summary> /// <param name="dateRule">Specifies what dates the event should run</param> /// <param name="timeRule">Specifies the times on those dates the event should run</param> /// <param name="callback">The callback to be invoked</param> public void On(IDateRule dateRule, ITimeRule timeRule, Action callback) { var name = dateRule.Name + ": " + timeRule.Name; On(name, dateRule, timeRule, callback); }
private static SubscriptionDataConfig CreateConfiguration(DateTimeZone timeZone, IDateRule dateRule, ITimeRule timeRule) { // remove forbidden characters var ticker = $"{dateRule.Name}_{timeRule.Name}"; foreach (var c in SecurityIdentifier.InvalidSymbolCharacters) { ticker = ticker.Replace(c.ToString(), "_"); } var symbol = Symbol.Create(ticker, SecurityType.Base, QuantConnect.Market.USA); var config = new SubscriptionDataConfig(typeof(Tick), symbol: symbol, resolution: Resolution.Daily, dataTimeZone: timeZone, exchangeTimeZone: timeZone, fillForward: false, extendedHours: false, isInternalFeed: true, isCustom: false, tickType: null, isFilteredSubscription: false ); // force always open hours so we don't inadvertently mess with the scheduled firing times MarketHoursDatabase.FromDataFolder() .SetEntryAlwaysOpen(config.Market, config.Symbol.Value, config.SecurityType, config.ExchangeTimeZone); return(config); }
/// <summary> /// Initialize a new instance of <see cref="InsightWeightingPortfolioConstructionModel"/> /// </summary> /// <param name="rebalancingDateRules">The date rules used to define the next expected rebalance time /// in UTC</param> public InsightWeightingPortfolioConstructionModel(IDateRule rebalancingDateRules) : base(rebalancingDateRules) { }
/// <summary> /// Initialize a new instance of <see cref="SectorWeightingPortfolioConstructionModel"/> /// </summary> /// <param name="rebalancingDateRules">The date rules used to define the next expected rebalance time /// in UTC</param> public SectorWeightingPortfolioConstructionModel(IDateRule rebalancingDateRules) : base(rebalancingDateRules.ToFunc()) { }
/// <summary> /// Initialize a new instance of <see cref="ConfidenceWeightedPortfolioConstructionModel"/> /// </summary> /// <param name="rebalancingDateRules">The date rules used to define the next expected rebalance time /// in UTC</param> public ConfidenceWeightedPortfolioConstructionModel(IDateRule rebalancingDateRules) : base(rebalancingDateRules) { }
/// <summary> /// Schedules the callback to run using the specified date and time rules /// </summary> /// <param name="name">The event's unique name</param> /// <param name="dateRule">Specifies what dates the event should run</param> /// <param name="timeRule">Specifies the times on those dates the event should run</param> /// <param name="callback">The callback to be invoked</param> public ScheduledEvent On(string name, IDateRule dateRule, ITimeRule timeRule, PyObject callback) { return(On(name, dateRule, timeRule, (n, d) => { using (Py.GIL()) callback.Invoke(); })); }
/// <summary> /// Initializes a new instance of the <see cref="ScheduledUniverseSelectionModel"/> class using the algorithm's time zone /// </summary> /// <param name="dateRule">Date rule defines what days the universe selection function will be invoked</param> /// <param name="timeRule">Time rule defines what times on each day selected by date rule the universe selection function will be invoked</param> /// <param name="selector">Selector function accepting the date time firing time and returning the universe selected symbols</param> /// <param name="settings">Universe settings for subscriptions added via this universe, null will default to algorithm's universe settings</param> public ScheduledUniverseSelectionModel(IDateRule dateRule, ITimeRule timeRule, PyObject selector, UniverseSettings settings = null) : this(null, dateRule, timeRule, selector, settings) { }
IFluentSchedulingTimeSpecifier IFluentSchedulingDateSpecifier.On(params DateTime[] dates) { _dateRule = _schedule.DateRules.On(dates); return this; }
public TestPortfolioConstructionModel(IDateRule dateRule) : this(dateRule.ToFunc()) { }
/// <summary> /// Initialize a new instance of <see cref="InsightWeightingPortfolioConstructionModel"/> /// </summary> /// <param name="rebalancingDateRules">The date rules used to define the next expected rebalance time /// in UTC</param> /// <param name="portfolioBias">Specifies the bias of the portfolio (Short, Long/Short, Long)</param> public InsightWeightingPortfolioConstructionModel(IDateRule rebalancingDateRules, PortfolioBias portfolioBias = PortfolioBias.LongShort) : base(rebalancingDateRules, portfolioBias) { }
/// <summary> /// Schedules the callback to run using the specified date and time rules /// </summary> /// <param name="name">The event's unique name</param> /// <param name="dateRule">Specifies what dates the event should run</param> /// <param name="timeRule">Specifies the times on those dates the event should run</param> /// <param name="callback">The callback to be invoked</param> public ScheduledEvent On(string name, IDateRule dateRule, ITimeRule timeRule, Action<string, DateTime> callback) { // back the date up to ensure we get all events, the event scheduler will skip past events that whose time has passed var dates = dateRule.GetDates(_securities.UtcTime.Date.AddDays(-1), Time.EndOfTime); var eventTimes = timeRule.CreateUtcEventTimes(dates); var scheduledEvent = new ScheduledEvent(name, eventTimes, callback); Add(scheduledEvent); return scheduledEvent; }
/// <summary> /// Schedules the callback to run using the specified date and time rules /// </summary> /// <param name="name">The event's unique name</param> /// <param name="dateRule">Specifies what dates the event should run</param> /// <param name="timeRule">Specifies the times on those dates the event should run</param> /// <param name="callback">The callback to be invoked</param> public ScheduledEvent On(string name, IDateRule dateRule, ITimeRule timeRule, Action callback) { return On(name, dateRule, timeRule, (n, d) => callback()); }
/// <summary> /// Initialize a new instance of <see cref="EqualWeightingPortfolioConstructionModel"/> /// </summary> /// <param name="rebalancingDateRules">The date rules used to define the next expected rebalance time /// in UTC</param> public EqualWeightingPortfolioConstructionModel(IDateRule rebalancingDateRules) : this(rebalancingDateRules.ToFunc()) { }
/// <summary> /// Schedules the callback to run using the specified date and time rules /// </summary> /// <param name="dateRule">Specifies what dates the event should run</param> /// <param name="timeRule">Specifies the times on those dates the event should run</param> /// <param name="callback">The callback to be invoked</param> public ScheduledEvent On(IDateRule dateRule, ITimeRule timeRule, Action callback) { return On(dateRule, timeRule, (name, time) => callback()); }
/// <summary> /// Creates events on each of the specified day of week /// </summary> IFluentSchedulingTimeSpecifier IFluentSchedulingDateSpecifier.Every(params DayOfWeek[] days) { _dateRule = _schedule.DateRules.Every(days); return this; }
/// <summary> /// Schedules the callback to run using the specified date and time rules /// </summary> /// <param name="dateRule">Specifies what dates the event should run</param> /// <param name="timeRule">Specifies the times on those dates the event should run</param> /// <param name="callback">The callback to be invoked</param> public ScheduledEvent On(IDateRule dateRule, ITimeRule timeRule, Action <string, DateTime> callback) { var name = dateRule.Name + ": " + timeRule.Name; return(On(name, dateRule, timeRule, callback)); }
/// <summary> /// Creates events on every trading day of the year for the symbol /// </summary> IFluentSchedulingTimeSpecifier IFluentSchedulingDateSpecifier.EveryDay(string symbol) { _dateRule = _schedule.DateRules.EveryDay(symbol); return this; }
/// <summary> /// Initializes a new instance of the <see cref="ScheduledUniverseSelectionModel"/> class using the algorithm's time zone /// </summary> /// <param name="dateRule">Date rule defines what days the universe selection function will be invoked</param> /// <param name="timeRule">Time rule defines what times on each day selected by date rule the universe selection function will be invoked</param> /// <param name="selector">Selector function accepting the date time firing time and returning the universe selected symbols</param> /// <param name="settings">Universe settings for subscriptions added via this universe, null will default to algorithm's universe settings</param> /// <param name="initializer">Security initializer for new securities created via this universe, null will default to algorithm's security initializer</param> public ScheduledUniverseSelectionModel(IDateRule dateRule, ITimeRule timeRule, PyObject selector, UniverseSettings settings = null, ISecurityInitializer initializer = null) : this(null, dateRule, timeRule, selector, settings, initializer) { }
/// <summary> /// Schedules the training code to run using the specified date and time rules /// </summary> /// <param name="dateRule">Specifies what dates the event should run</param> /// <param name="timeRule">Specifies the times on those dates the event should run</param> /// <param name="trainingCode">The training code to be invoked</param> public ScheduledEvent Training(IDateRule dateRule, ITimeRule timeRule, PyObject trainingCode) { var name = $"{dateRule.Name}: {timeRule.Name}"; return(On(name, dateRule, timeRule, (n, time) => { using (Py.GIL()) trainingCode.Invoke(); })); }