Skip to content

SequentialConsolidator

QuantConnect.Data.Consolidators.SequentialConsolidator

SequentialConsolidator(
    first: Union[
        IDataConsolidator, PythonConsolidator, timedelta
    ],
    second: Union[
        IDataConsolidator, PythonConsolidator, timedelta
    ],
)

Bases: Object, IDataConsolidator

This consolidator wires up the events on its First and Second consolidators such that data flows from the First to Second consolidator. It's output comes from the Second.

Creates a new consolidator that will pump date through the first, and then the output of the first into the second. This enables 'wrapping' or 'composing' of consolidators

Parameters:

Name Type Description Default
first Union[IDataConsolidator, PythonConsolidator, timedelta]

The first consolidator to receive data

required
second Union[IDataConsolidator, PythonConsolidator, timedelta]

The consolidator to receive first's output

required

first

Gets the first consolidator to receive data

second

Gets the second consolidator that ends up receiving data produced by the first

consolidated

consolidated: IBaseData

Gets the most recently consolidated piece of data. This will be null if this consolidator has not produced any data yet.

For a SequentialConsolidator, this is the output from the 'Second' consolidator.

working_data

working_data: IBaseData

Gets a clone of the data being currently consolidated

input_type

input_type: Type

Gets the type consumed by this consolidator

output_type

output_type: Type

Gets the type produced by this consolidator

data_consolidated

data_consolidated: _EventContainer[
    Callable[[Object, IBaseData], Any], Any
]

Event handler that fires when a new piece of data is produced

dispose

dispose() -> None

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

on_data_consolidated

on_data_consolidated(consolidated: IBaseData) -> None

Event invocator for the DataConsolidated event. This should be invoked by derived classes when they have consolidated a new piece of data.

This codeEntityType is protected.

Parameters:

Name Type Description Default
consolidated IBaseData

The newly consolidated data

required

reset

reset() -> None

Resets the consolidator

scan

scan(current_local_time: Union[datetime, date]) -> None

Scans this consolidator to see if it should emit a bar due to time passing

Parameters:

Name Type Description Default
current_local_time Union[datetime, date]

The current time in the local time zone (same as BaseData.time)

required

update

update(data: IBaseData) -> None

Updates this consolidator with the specified data

Parameters:

Name Type Description Default
data IBaseData

The new data for the consolidator

required