Skip to content

FuncTimeRule

QuantConnect.Scheduling.FuncTimeRule

FuncTimeRule(
    name: str, create_utc_event_times_function: Any
)
FuncTimeRule(
    name: str,
    create_utc_event_times_function: Callable[
        [List[datetime]], List[datetime]
    ],
)

Bases: Object, ITimeRule

Uses a function to define a time rule as a projection of date times to date times

Signature descriptions:

  • Initializes a new instance of the FuncTimeRule class using a Python function

  • Initializes a new instance of the FuncTimeRule class

Parameters:

Name Type Description Default
name str

The name of the time rule

required
create_utc_event_times_function Any | Callable[[List[datetime]], List[datetime]]

Function used to transform dates into event date times in Python

required

name

name: str

Gets a name for this rule

create_utc_event_times

create_utc_event_times(
    dates: List[datetime],
) -> Iterable[datetime]

Creates the event times for the specified dates in UTC

Parameters:

Name Type Description Default
dates List[datetime]

The dates to apply times to

required

Returns:

Type Description
Iterable[datetime]

An enumerable of date times that is the result of applying this rule to the specified dates.