Skip to content

FillForwardEnumerator

QuantConnect.Lean.Engine.DataFeeds.Enumerators.FillForwardEnumerator

FillForwardEnumerator(
    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: timedelta,
    data_time_zone: Any,
    daily_strict_end_time_enabled: bool,
    data_type: Type = None,
    last_point_tracker: LastPointTracker = None,
)

Bases: Object, IEnumerator[BaseData]

The FillForwardEnumerator wraps an existing base data enumerator and inserts extra 'base data' instances on a specified fill forward resolution

Initializes a new instance of the FillForwardEnumerator 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
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 timedelta

The source enumerator's data resolution

required
data_time_zone Any

The time zone of the underlying source data. This is used for rounding calculations and is NOT the time zone on the BaseData instances (unless of course data time zone equals the exchange time zone)

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.

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.

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

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.

reset

reset() -> None

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