Skip to content

FluentScheduledEventBuilder

QuantConnect.Scheduling.FluentScheduledEventBuilder

FluentScheduledEventBuilder(
    schedule: ScheduleManager,
    securities: SecurityManager,
    name: str = None,
)

Bases: Object, IFluentSchedulingDateSpecifier, IFluentSchedulingRunnable

Provides a builder class to allow for fluent syntax when constructing new events

Initializes a new instance of the FluentScheduledEventBuilder class

Parameters:

Name Type Description Default
schedule ScheduleManager

The schedule to send created events to

required
securities SecurityManager

The algorithm's security manager

required
name str

A specific name for this event

None

at

at(
    hour: int, minute: int, time_zone: Any
) -> IFluentSchedulingRunnable
at(
    hour: int, minute: int, second: int, time_zone: Any
) -> IFluentSchedulingRunnable
at(
    time_of_day: timedelta, time_zone: Any
) -> IFluentSchedulingRunnable
at(
    hour: int, minute: int, second: int = 0
) -> IFluentSchedulingRunnable
at(time_of_day: timedelta) -> IFluentSchedulingRunnable

Signature descriptions:

  • Creates events that fire at the specified time of day in the specified time zone

  • Creates events that fire at the specific time of day in the algorithm's time zone

after_market_open

after_market_open(
    symbol: Union[Symbol, str, BaseContract],
    minutes_after_open: float = 0,
    extended_market_open: bool = False,
) -> IFluentSchedulingRunnable

Creates events that fire a specified number of minutes after market open

before_market_close

before_market_close(
    symbol: Union[Symbol, str, BaseContract],
    minute_before_close: float = 0,
    extended_market_close: bool = False,
) -> IFluentSchedulingRunnable

Creates events that fire a specified numer of minutes before market close

every

every(
    *days: Union[DayOfWeek, Iterable[DayOfWeek]]
) -> IFluentSchedulingTimeSpecifier

Creates events on each of the specified day of week

where

where(
    predicate: Callable[[datetime], bool],
) -> IFluentSchedulingTimeSpecifier

Filters the event times using the predicate

run

run(callback: Callable[[], Any]) -> ScheduledEvent
run(callback: Callable[[datetime], Any]) -> ScheduledEvent
run(
    callback: Callable[[str, datetime], Any],
) -> ScheduledEvent

Register the defined event with the callback

during_market_hours

during_market_hours(
    symbol: Union[Symbol, str, BaseContract],
    extended_market: bool = False,
) -> IFluentSchedulingRunnable

Filters the event times to only include times where the symbol's market is considered open

every_day

every_day(
    symbol: Union[Symbol, str, BaseContract],
) -> IFluentSchedulingTimeSpecifier

Signature descriptions:

  • Creates events on every day of the year

  • Creates events on every trading day of the year for the symbol

month_start

month_start(
    symbol: Union[Symbol, str, BaseContract],
) -> IFluentSchedulingTimeSpecifier

Signature descriptions:

  • Creates events on the first day of the month

  • Creates events on the first trading day of the month

on

on(
    year: int, month: int, day: int
) -> IFluentSchedulingTimeSpecifier
on(
    *dates: Union[datetime, Iterable[datetime]]
) -> IFluentSchedulingTimeSpecifier

Signature descriptions:

  • Creates events only on the specified date

  • Creates events only on the specified dates