TickConsolidator
QuantConnect.Data.Consolidators.TickConsolidator
TickConsolidator(pyfuncobj: Any)
TickConsolidator(period: timedelta)
TickConsolidator(max_count: int)
TickConsolidator(max_count: int, period: timedelta)
TickConsolidator(func: Callable[[datetime], CalendarInfo])
Bases: TradeBarConsolidatorBase[Tick]
A data consolidator that can make bigger bars from ticks over a given time span or a count of pieces of data.
Signature descriptions:
-
Creates a consolidator to produce a new 'TradeBar' representing the last count pieces of data or the period, whichever comes first
-
Creates a consolidator to produce a new 'TradeBar' representing the period
-
Creates a consolidator to produce a new 'TradeBar' representing the last count pieces of data
-
Initializes a new instance of the TickQuoteBarConsolidator class
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pyfuncobj
|
Optional[Any]
|
Python function object that defines the start time of a consolidated data |
None
|
period
|
Optional[timedelta]
|
The minimum span of time before emitting a consolidated bar |
None
|
max_count
|
Optional[int]
|
The number of pieces to accept before emitting a consolidated bar |
None
|
func
|
Optional[Callable[[datetime], CalendarInfo]]
|
Func that defines the start time of a consolidated data |
None
|
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 the type produced by this consolidator
data_consolidated
data_consolidated: _EventContainer[
Callable[
[
Object,
QuantConnect_Data_Consolidators_PeriodCountConsolidatorBase_TConsolidated,
],
Any,
],
Any,
]
Event handler that fires when a new piece of data is produced. We define this as a 'new' event so we can expose it as a t_consolidated instead of a BaseData instance
is_time_based
is_time_based: bool
Returns true if this consolidator is time-based, false otherwise
This codeEntityType is protected.
period
period: Optional[timedelta]
Gets the time period for this consolidator
This codeEntityType is protected.
aggregate_bar
should_process
should_process(data: Tick) -> bool
Determines whether or not the specified data should be processed
This codeEntityType is protected.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Tick
|
The data to check |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the consolidator should process this data, false otherwise. |
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: QuantConnect_Data_Consolidators_PeriodCountConsolidatorBase_T,
) -> None
Updates this consolidator with the specified data. This method is responsible for raising the DataConsolidated event In time span mode, the bar range is closed on the left and open on the right: [T, T+TimeSpan). For example, if time span is 1 minute, we have [10:00, 10:01): so data at 10:01 is not included in the bar starting at 10:00.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
QuantConnect_Data_Consolidators_PeriodCountConsolidatorBase_T
|
The new data for the consolidator |
required |
dispose
dispose() -> None
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
on_data_consolidated
on_data_consolidated(
e: QuantConnect_Data_Consolidators_PeriodCountConsolidatorBase_TConsolidated,
) -> None
Event invocator for the data_consolidated event
This codeEntityType is protected.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
e
|
QuantConnect_Data_Consolidators_PeriodCountConsolidatorBase_TConsolidated
|
The consolidated data |
required |
get_rounded_bar_time
get_rounded_bar_time(
time: Union[datetime, date],
) -> datetime
get_rounded_bar_time(input_data: IBaseData) -> datetime
Signature descriptions:
-
Gets a rounded-down bar time. Called by AggregateBar in derived classes.
-
Gets a rounded-down bar start time. Called by AggregateBar in derived classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time
|
Optional[Union[datetime, date]]
|
The bar time to be rounded down |
None
|
input_data
|
Optional[IBaseData]
|
The input data point |
None
|
Returns:
| Type | Description |
|---|---|
datetime
|
Depends on the signature used. Case 1: [The rounded bar time.]; Case 2: [The rounded bar start time.] |
reset_working_bar
reset_working_bar() -> None
Resets the working bar
This codeEntityType is protected.