BaseTimelessConsolidator
QuantConnect.Data.Consolidators.BaseTimelessConsolidator
BaseTimelessConsolidator(
value_selector: Any, volume_selector: Any = None
)
Bases: Generic[QuantConnect_Data_Consolidators_BaseTimelessConsolidator_T], Object, IDataConsolidator
Represents a timeless consolidator which depends on the given values. This consolidator is meant to consolidate data into bars that do not depend on time, e.g., RangeBar's.
Initializes a new instance of the BaseTimelessConsolidator{T} class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value_selector
|
Optional[Any]
|
Extracts the value from a data instance to be formed into a new bar which inherits from IBaseData. The default |
None
|
volume_selector
|
Any | Callable[[IBaseData], float]
|
Extracts the volume from a data instance. The default value is null which does |
None
|
selector
|
Optional[Callable[[IBaseData], float]]
|
Extracts the value from a data instance to be formed into a new bar which inherits from IBaseData. The default |
None
|
selector
selector: Callable[[IBaseData], float]
Extracts the value from a data instance to be formed into a T.
This codeEntityType is protected.
volume_selector
volume_selector: Callable[[IBaseData], float]
Extracts the volume from a data instance. The default value is null which does not aggregate volume per bar.
This codeEntityType is protected.
data_consolidated_handler
data_consolidated_handler: Callable[
[Object, IBaseData], Any
]
Event handler type for the IDataConsolidator.DataConsolidated event
This codeEntityType is protected.
current_bar
current_bar: QuantConnect_Data_Consolidators_BaseTimelessConsolidator_T
Bar being created
This codeEntityType is protected.
consolidated
consolidated: IBaseData
Gets the most recently consolidated piece of data. This will be null if this consolidator has not produced any data yet.
input_type
input_type: Type
Gets the type consumed by this consolidator
output_type
output_type: Type
Gets T which is the type emitted in the IDataConsolidator.data_consolidated event.
data_consolidated
data_consolidated: _EventContainer[
Callable[
[
Object,
QuantConnect_Data_Consolidators_BaseTimelessConsolidator_T,
],
Any,
],
Any,
]
Event handler that fires when a new piece of data is produced
create_new_bar
create_new_bar(
data: IBaseData, current_value: float, volume: float
) -> None
Creates a new bar with the given data
This codeEntityType is protected.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
IBaseData
|
The new data for the bar |
required |
current_value
|
float
|
The new value for the bar |
required |
volume
|
float
|
The new volume to the bar |
required |
dispose
dispose() -> None
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
on_data_consolidated
on_data_consolidated(
consolidated: QuantConnect_Data_Consolidators_BaseTimelessConsolidator_T,
) -> 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
|
QuantConnect_Data_Consolidators_BaseTimelessConsolidator_T
|
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 |
update_bar
update_bar(
time: Union[datetime, date],
current_value: float,
volume: float,
) -> None
Updates the current RangeBar being created with the given data. Additionally, if it's the case, it consolidates the current RangeBar
This codeEntityType is protected.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time
|
Union[datetime, date]
|
Time of the given data |
required |
current_value
|
float
|
Value of the given data |
required |
volume
|
float
|
Volume of the given data |
required |