Lean
$LEAN_TAG$
|
Provides a base class for consolidators that emit data based on the passing of a period of time or after seeing a max count of data points. More...
Public Member Functions | |
override void | Update (T data) |
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. More... | |
override void | Scan (DateTime currentLocalTime) |
Scans this consolidator to see if it should emit a bar due to time passing More... | |
override void | Reset () |
Resets the consolidator More... | |
Public Member Functions inherited from QuantConnect.Data.Consolidators.DataConsolidator< T > | |
void | Update (IBaseData data) |
Updates this consolidator with the specified data More... | |
abstract void | Update (TInput data) |
Updates this consolidator with the specified data. This method is responsible for raising the DataConsolidated event More... | |
void | Dispose () |
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. More... | |
Public Attributes | |
override Type | OutputType => typeof(TConsolidated) |
Gets the type produced by this consolidator More... | |
override IBaseData | WorkingData => _workingBar?.Clone() |
Gets a clone of the data being currently consolidated More... | |
Protected Member Functions | |
PeriodCountConsolidatorBase (TimeSpan period) | |
Creates a consolidator to produce a new TConsolidated instance representing the period More... | |
PeriodCountConsolidatorBase (int maxCount) | |
Creates a consolidator to produce a new TConsolidated instance representing the last count pieces of data More... | |
PeriodCountConsolidatorBase (int maxCount, TimeSpan period) | |
Creates a consolidator to produce a new TConsolidated instance representing the last count pieces of data or the period, whichever comes first More... | |
PeriodCountConsolidatorBase (Func< DateTime, CalendarInfo > func) | |
Creates a consolidator to produce a new TConsolidated instance representing the last count pieces of data or the period, whichever comes first More... | |
PeriodCountConsolidatorBase (PyObject pyObject) | |
Creates a consolidator to produce a new TConsolidated instance representing the last count pieces of data or the period, whichever comes first More... | |
virtual bool | ShouldProcess (T data) |
Determines whether or not the specified data should be processed More... | |
abstract void | AggregateBar (ref TConsolidated workingBar, T data) |
Aggregates the new 'data' into the 'workingBar'. The 'workingBar' will be null following the event firing More... | |
DateTime | GetRoundedBarTime (DateTime time) |
Gets a rounded-down bar time. Called by AggregateBar in derived classes. More... | |
DateTime | GetRoundedBarTime (IBaseData inputData) |
Gets a rounded-down bar start time. Called by AggregateBar in derived classes. More... | |
virtual void | OnDataConsolidated (TConsolidated e) |
Event invocator for the DataConsolidated event More... | |
Protected Member Functions inherited from QuantConnect.Data.Consolidators.DataConsolidator< T > | |
virtual void | OnDataConsolidated (IBaseData consolidated) |
Event invocator for the DataConsolidated event. This should be invoked by derived classes when they have consolidated a new piece of data. More... | |
Protected Attributes | |
bool | IsTimeBased => !_maxCount.HasValue |
Returns true if this consolidator is time-based, false otherwise More... | |
TimeSpan? | Period => _period |
Gets the time period for this consolidator More... | |
Events | |
new EventHandler< TConsolidated > | DataConsolidated |
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 TConsolidated instead of a BaseData instance More... | |
Events inherited from QuantConnect.Data.Consolidators.DataConsolidator< T > | |
DataConsolidatedHandler | DataConsolidated |
Event handler that fires when a new piece of data is produced More... | |
Additional Inherited Members | |
Properties inherited from QuantConnect.Data.Consolidators.DataConsolidator< T > | |
IBaseData | Consolidated [get, protected set] |
Gets the most recently consolidated piece of data. This will be null if this consolidator has not produced any data yet. More... | |
abstract IBaseData | WorkingData [get] |
Gets a clone of the data being currently consolidated More... | |
Type | InputType [get] |
Gets the type consumed by this consolidator More... | |
abstract Type | OutputType [get] |
Gets the type produced by this consolidator More... | |
Provides a base class for consolidators that emit data based on the passing of a period of time or after seeing a max count of data points.
T | The input type of the consolidator |
TConsolidated | The output type of the consolidator |
Definition at line 31 of file PeriodCountConsolidatorBase.cs.
|
protected |
Creates a consolidator to produce a new TConsolidated instance representing the period
period | The minimum span of time before emitting a consolidated bar |
Definition at line 62 of file PeriodCountConsolidatorBase.cs.
|
protected |
Creates a consolidator to produce a new TConsolidated instance representing the last count pieces of data
maxCount | The number of pieces to accept before emiting a consolidated bar |
Definition at line 72 of file PeriodCountConsolidatorBase.cs.
|
protected |
Creates a consolidator to produce a new TConsolidated instance representing the last count pieces of data or the period, whichever comes first
maxCount | The number of pieces to accept before emiting a consolidated bar |
period | The minimum span of time before emitting a consolidated bar |
Definition at line 83 of file PeriodCountConsolidatorBase.cs.
|
protected |
Creates a consolidator to produce a new TConsolidated instance representing the last count pieces of data or the period, whichever comes first
func | Func that defines the start time of a consolidated data |
Definition at line 94 of file PeriodCountConsolidatorBase.cs.
|
protected |
Creates a consolidator to produce a new TConsolidated instance representing the last count pieces of data or the period, whichever comes first
pyObject | Python object that defines either a function object that defines the start time of a consolidated data or a timespan |
Definition at line 104 of file PeriodCountConsolidatorBase.cs.
override void QuantConnect.Data.Consolidators.PeriodCountConsolidatorBase< T, TConsolidated >.Update | ( | T | data | ) |
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.
InvalidOperationException | Thrown when multiple symbols are being consolidated. |
data | The new data for the consolidator |
Definition at line 134 of file PeriodCountConsolidatorBase.cs.
|
virtual |
Scans this consolidator to see if it should emit a bar due to time passing
currentLocalTime | The current time in the local time zone (same as BaseData.Time) |
Implements QuantConnect.Data.Consolidators.DataConsolidator< T >.
Definition at line 248 of file PeriodCountConsolidatorBase.cs.
|
virtual |
Resets the consolidator
Reimplemented from QuantConnect.Data.Consolidators.DataConsolidator< T >.
Definition at line 261 of file PeriodCountConsolidatorBase.cs.
|
protectedvirtual |
Determines whether or not the specified data should be processed
data | The data to check |
|
protectedpure virtual |
Aggregates the new 'data' into the 'workingBar'. The 'workingBar' will be null following the event firing
workingBar | The bar we're building, null if the event was just fired and we're starting a new consolidated bar |
data | The new data |
|
protected |
Gets a rounded-down bar time. Called by AggregateBar in derived classes.
time | The bar time to be rounded down |
Definition at line 303 of file PeriodCountConsolidatorBase.cs.
|
protected |
Gets a rounded-down bar start time. Called by AggregateBar in derived classes.
inputData | The input data point |
Definition at line 322 of file PeriodCountConsolidatorBase.cs.
|
protectedvirtual |
Event invocator for the DataConsolidated event
e | The consolidated data |
Definition at line 349 of file PeriodCountConsolidatorBase.cs.
override Type QuantConnect.Data.Consolidators.PeriodCountConsolidatorBase< T, TConsolidated >.OutputType => typeof(TConsolidated) |
Gets the type produced by this consolidator
Definition at line 112 of file PeriodCountConsolidatorBase.cs.
override IBaseData QuantConnect.Data.Consolidators.PeriodCountConsolidatorBase< T, TConsolidated >.WorkingData => _workingBar?.Clone() |
Gets a clone of the data being currently consolidated
Definition at line 117 of file PeriodCountConsolidatorBase.cs.
|
protected |
Returns true if this consolidator is time-based, false otherwise
Definition at line 275 of file PeriodCountConsolidatorBase.cs.
|
protected |
Gets the time period for this consolidator
Definition at line 280 of file PeriodCountConsolidatorBase.cs.
new EventHandler<TConsolidated> QuantConnect.Data.Consolidators.PeriodCountConsolidatorBase< T, TConsolidated >.DataConsolidated |
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 TConsolidated instead of a BaseData instance
Definition at line 123 of file PeriodCountConsolidatorBase.cs.