ScheduleManager
QuantConnect.Scheduling.ScheduleManager
ScheduleManager(
algorithm: IAlgorithm,
securities: SecurityManager,
time_zone: Any,
market_hours_database: MarketHoursDatabase,
)
Bases: Object, IEventSchedule
Provides access to the real time handler's event scheduling feature
Initializes a new instance of the ScheduleManager class
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
algorithm
|
IAlgorithm
|
The algorithm instance |
required |
securities
|
SecurityManager
|
Securities manager containing the algorithm's securities |
required |
time_zone
|
Any
|
The algorithm's time zone |
required |
market_hours_database
|
MarketHoursDatabase
|
The market hours database instance to use |
required |
date_rules
date_rules: DateRules
Gets the date rules helper object to make specifying dates for events easier
time_rules
time_rules: TimeRules
Gets the time rules helper object to make specifying times for events easier
event
event() -> IFluentSchedulingDateSpecifier
event(name: str) -> IFluentSchedulingDateSpecifier
Entry point for the fluent scheduled event builder
on
on(
date_rule: IDateRule,
time_rule: ITimeRule,
callback: Any,
) -> ScheduledEvent
on(
name: str,
date_rule: IDateRule,
time_rule: ITimeRule,
callback: Any,
) -> ScheduledEvent
on(
date_rule: IDateRule,
time_rule: ITimeRule,
callback: Callable[[], Any],
) -> ScheduledEvent
on(
date_rule: IDateRule,
time_rule: ITimeRule,
callback: Callable[[str, datetime], Any],
) -> ScheduledEvent
on(
name: str,
date_rule: IDateRule,
time_rule: ITimeRule,
callback: Callable[[], Any],
) -> ScheduledEvent
on(
name: str,
date_rule: IDateRule,
time_rule: ITimeRule,
callback: Callable[[str, datetime], Any],
) -> ScheduledEvent
Schedules the callback to run using the specified date and time rules
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
date_rule
|
IDateRule
|
Specifies what dates the event should run |
required |
time_rule
|
ITimeRule
|
Specifies the times on those dates the event should run |
required |
callback
|
Any | Callable[[], Any] | Callable[[str, datetime], Any]
|
The callback to be invoked |
required |
name
|
Optional[str]
|
The event's unique name |
None
|
training
training(
date_rule: IDateRule,
time_rule: ITimeRule,
training_code: Any,
) -> ScheduledEvent
training(
date_rule: IDateRule,
time_rule: ITimeRule,
training_code: Callable[[], Any],
) -> ScheduledEvent
training(
date_rule: IDateRule,
time_rule: ITimeRule,
training_code: Callable[[datetime], Any],
) -> ScheduledEvent
Schedules the training code to run using the specified date and time rules
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
date_rule
|
IDateRule
|
Specifies what dates the event should run |
required |
time_rule
|
ITimeRule
|
Specifies the times on those dates the event should run |
required |
training_code
|
Any | Callable[[], Any] | Callable[[datetime], Any]
|
The training code to be invoked |
required |
training_now
training_now(training_code: Any) -> ScheduledEvent
training_now(
training_code: Callable[[], Any],
) -> ScheduledEvent
Schedules the provided training code to execute immediately
add
add(scheduled_event: ScheduledEvent) -> None
Adds the specified event to the schedule
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scheduled_event
|
ScheduledEvent
|
The event to be scheduled, including the date/times the event fires and the callback |
required |
remove
remove(scheduled_event: ScheduledEvent) -> None
Removes the specified event from the schedule
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scheduled_event
|
ScheduledEvent
|
The event to be removed |
required |