Skip to content

LiveFillForwardEnumerator

QuantConnect.Lean.Engine.DataFeeds.Enumerators.LiveFillForwardEnumerator

LiveFillForwardEnumerator(
    time_provider: ITimeProvider,
    enumerator: IEnumerator[BaseData],
    exchange: SecurityExchange,
    fill_forward_resolution: IReadOnlyRef[timedelta],
    is_extended_market_hours: bool,
    subscription_start_time: Union[datetime, date],
    subscription_end_time: Union[datetime, date],
    data_resolution: Resolution,
    data_time_zone: Any,
    daily_strict_end_time_enabled: bool,
    data_type: Type = None,
    last_point_tracker: LastPointTracker = None,
)

Bases: FillForwardEnumerator

An implementation of the FillForwardEnumerator that uses an ITimeProvider to determine if a fill forward bar needs to be emitted

Initializes a new instance of the LiveFillForwardEnumerator class that accepts a reference to the fill forward resolution, useful if the fill forward resolution is dynamic and changing as the enumeration progresses

Parameters:

Name Type Description Default
time_provider ITimeProvider

The source of time used to gauage when this enumerator should emit extra bars when null data is returned from the source enumerator

required
enumerator IEnumerator[BaseData]

The source enumerator to be filled forward

required
exchange SecurityExchange

The exchange used to determine when to insert fill forward data

required
fill_forward_resolution IReadOnlyRef[timedelta]

The resolution we'd like to receive data on

required
is_extended_market_hours bool

True to use the exchange's extended market hours, false to use the regular market hours

required
subscription_start_time Union[datetime, date]

The start time of the subscription

required
subscription_end_time Union[datetime, date]

The end time of the subscription, once passing this date the enumerator will stop

required
data_resolution Resolution

The source enumerator's data resolution

required
data_time_zone Any

Time zone of the underlying source data

required
daily_strict_end_time_enabled bool

True if daily strict end times are enabled

required
data_type Type

The configuration data type this enumerator is for

None
last_point_tracker LastPointTracker

A reference to the last point emitted before this enumerator is first enumerated

None

use_strict_end_time

use_strict_end_time: bool

Whether to use strict daily end times

This codeEntityType is protected.

exchange

exchange: SecurityExchange

The exchange used to determine when to insert fill forward data

This codeEntityType is protected.

current

current: BaseData

Gets the element in the collection at the current position of the enumerator.

get_maximum_data_timeout

get_maximum_data_timeout(
    resolution: Resolution,
) -> timedelta

Helper method to know how much we should wait before fill forwarding a bar in live trading

requires_fill_forward_data

requires_fill_forward_data(
    fill_forward_resolution: timedelta,
    previous: BaseData,
    next: BaseData,
    fill_forward: Optional[BaseData],
) -> Tuple[bool, BaseData]

Determines whether or not fill forward is required, and if true, will produce the new fill forward data

This codeEntityType is protected.

Parameters:

Name Type Description Default
fill_forward_resolution timedelta
required
previous BaseData

The last piece of data emitted by this enumerator

required
next BaseData

The next piece of data on the source enumerator, this may be null

required
fill_forward Optional[BaseData]

When this function returns true, this will have a non-null value, null when the function returns false

required

Returns:

Type Description
Tuple[bool, BaseData]

True when a new fill forward piece of data was produced and should be emitted by this enumerator.

dispose

dispose() -> None

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

move_next

move_next() -> bool

Advances the enumerator to the next element of the collection.

Returns:

Type Description
bool

true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.

reset

reset() -> None

Sets the enumerator to its initial position, which is before the first element in the collection.