Lean  $LEAN_TAG$
QuantConnect.Data.Consolidators.BaseTimelessConsolidator< T > Class Template Referenceabstract

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. More...

Inheritance diagram for QuantConnect.Data.Consolidators.BaseTimelessConsolidator< T >:
[legend]

Public Member Functions

void Update (IBaseData data)
 Updates this consolidator with the specified data More...
 
virtual void Dispose ()
 Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. More...
 
void Scan (DateTime currentLocalTime)
 Scans this consolidator to see if it should emit a bar due to time passing More...
 

Public Attributes

Type InputType => typeof(IBaseData)
 Gets the type consumed by this consolidator More...
 
virtual Type OutputType => typeof(T)
 Gets T which is the type emitted in the IDataConsolidator.DataConsolidated event. More...
 

Protected Member Functions

 BaseTimelessConsolidator (Func< IBaseData, decimal > selector=null, Func< IBaseData, decimal > volumeSelector=null)
 Initializes a new instance of the BaseTimelessConsolidator<T> class. More...
 
 BaseTimelessConsolidator (PyObject valueSelector, PyObject volumeSelector=null)
 Initializes a new instance of the BaseTimelessConsolidator<T> class. More...
 
abstract void UpdateBar (DateTime time, decimal currentValue, decimal volume)
 Updates the current RangeBar being created with the given data. Additionally, if it's the case, it consolidates the current RangeBar More...
 
abstract void CreateNewBar (IBaseData data, decimal currentValue, decimal volume)
 Creates a new bar with the given data More...
 
void OnDataConsolidated (T consolidated)
 Event invocator for the DataConsolidated event. This should be invoked by derived classes when they have consolidated a new piece of data. More...
 

Properties

Func< IBaseData, decimal > Selector [get, set]
 Extracts the value from a data instance to be formed into a T. More...
 
Func< IBaseData, decimal > VolumeSelector [get, set]
 Extracts the volume from a data instance. The default value is null which does not aggregate volume per bar. More...
 
DataConsolidatedHandler DataConsolidatedHandler [get, set]
 Event handler type for the IDataConsolidator.DataConsolidated event More...
 
virtual T CurrentBar [get, set]
 Bar being created More...
 
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...
 
- Properties inherited from QuantConnect.Data.Consolidators.IDataConsolidator
IBaseData Consolidated [get]
 Gets the most recently consolidated piece of data. This will be null if this consolidator has not produced any data yet. More...
 
IBaseData WorkingData [get]
 Gets a clone of the data being currently consolidated More...
 
Type InputType [get]
 Gets the type consumed by this consolidator More...
 
Type OutputType [get]
 Gets the type produced by this consolidator More...
 

Events

EventHandler< T > DataConsolidated
 Event handler that fires when a new piece of data is produced More...
 
- Events inherited from QuantConnect.Data.Consolidators.IDataConsolidator
DataConsolidatedHandler DataConsolidated
 Event handler that fires when a new piece of data is produced More...
 

Detailed Description

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.

Type Constraints
T :IBaseData 

Definition at line 26 of file BaseTimelessConsolidator.cs.

Constructor & Destructor Documentation

◆ BaseTimelessConsolidator() [1/2]

QuantConnect.Data.Consolidators.BaseTimelessConsolidator< T >.BaseTimelessConsolidator ( Func< IBaseData, decimal >  selector = null,
Func< IBaseData, decimal >  volumeSelector = null 
)
protected

Initializes a new instance of the BaseTimelessConsolidator<T> class.

Parameters
selectorExtracts the value from a data instance to be formed into a new bar which inherits from IBaseData. The default value is (x => x.Value) the IBaseData.Value property on IBaseData
volumeSelectorExtracts the volume from a data instance. The default value is null which does not aggregate volume per bar.

Definition at line 92 of file BaseTimelessConsolidator.cs.

◆ BaseTimelessConsolidator() [2/2]

QuantConnect.Data.Consolidators.BaseTimelessConsolidator< T >.BaseTimelessConsolidator ( PyObject  valueSelector,
PyObject  volumeSelector = null 
)
protected

Initializes a new instance of the BaseTimelessConsolidator<T> class.

Parameters
valueSelectorExtracts the value from a data instance to be formed into a new bar which inherits from IBaseData. The default value is (x => x.Value) the IBaseData.Value property on IBaseData
volumeSelectorExtracts the volume from a data instance. The default value is null which does not aggregate volume per bar.

Definition at line 105 of file BaseTimelessConsolidator.cs.

Member Function Documentation

◆ Update()

Updates this consolidator with the specified data

Parameters
dataThe new data for the consolidator

Implements QuantConnect.Data.Consolidators.IDataConsolidator.

Definition at line 144 of file BaseTimelessConsolidator.cs.

◆ UpdateBar()

abstract void QuantConnect.Data.Consolidators.BaseTimelessConsolidator< T >.UpdateBar ( DateTime  time,
decimal  currentValue,
decimal  volume 
)
protectedpure virtual

Updates the current RangeBar being created with the given data. Additionally, if it's the case, it consolidates the current RangeBar

Parameters
timeTime of the given data
currentValueValue of the given data
volumeVolume of the given data

Implemented in QuantConnect.Data.Consolidators.ClassicRenkoConsolidator< TInput >, QuantConnect.Data.Consolidators.RangeConsolidator, and QuantConnect.Data.Consolidators.ClassicRangeConsolidator.

Here is the caller graph for this function:

◆ CreateNewBar()

abstract void QuantConnect.Data.Consolidators.BaseTimelessConsolidator< T >.CreateNewBar ( IBaseData  data,
decimal  currentValue,
decimal  volume 
)
protectedpure virtual

Creates a new bar with the given data

Parameters
dataThe new data for the bar
currentValueThe new value for the bar
volumeThe new volume to the bar

Implemented in QuantConnect.Data.Consolidators.ClassicRenkoConsolidator< TInput >, and QuantConnect.Data.Consolidators.RangeConsolidator.

Here is the caller graph for this function:

◆ OnDataConsolidated()

void QuantConnect.Data.Consolidators.BaseTimelessConsolidator< T >.OnDataConsolidated ( consolidated)
protected

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

Parameters
consolidatedThe newly consolidated data

Definition at line 185 of file BaseTimelessConsolidator.cs.

◆ Dispose()

virtual void QuantConnect.Data.Consolidators.BaseTimelessConsolidator< T >.Dispose ( )
virtual

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

<filterpriority>2</filterpriority>

Definition at line 196 of file BaseTimelessConsolidator.cs.

◆ Scan()

void QuantConnect.Data.Consolidators.BaseTimelessConsolidator< T >.Scan ( DateTime  currentLocalTime)

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

Parameters
currentLocalTimeThe current time in the local time zone (same as BaseData.Time)

Implements QuantConnect.Data.Consolidators.IDataConsolidator.

Definition at line 206 of file BaseTimelessConsolidator.cs.

Member Data Documentation

◆ InputType

Gets the type consumed by this consolidator

Definition at line 64 of file BaseTimelessConsolidator.cs.

◆ OutputType

virtual Type QuantConnect.Data.Consolidators.BaseTimelessConsolidator< T >.OutputType => typeof(T)

Gets T which is the type emitted in the IDataConsolidator.DataConsolidated event.

Definition at line 69 of file BaseTimelessConsolidator.cs.

Property Documentation

◆ Selector

Func<IBaseData, decimal> QuantConnect.Data.Consolidators.BaseTimelessConsolidator< T >.Selector
getsetprotected

Extracts the value from a data instance to be formed into a T.

Definition at line 32 of file BaseTimelessConsolidator.cs.

◆ VolumeSelector

Func<IBaseData, decimal> QuantConnect.Data.Consolidators.BaseTimelessConsolidator< T >.VolumeSelector
getsetprotected

Extracts the volume from a data instance. The default value is null which does not aggregate volume per bar.

Definition at line 38 of file BaseTimelessConsolidator.cs.

◆ DataConsolidatedHandler

DataConsolidatedHandler QuantConnect.Data.Consolidators.BaseTimelessConsolidator< T >.DataConsolidatedHandler
getsetprotected

Event handler type for the IDataConsolidator.DataConsolidated event

Definition at line 43 of file BaseTimelessConsolidator.cs.

◆ CurrentBar

virtual T QuantConnect.Data.Consolidators.BaseTimelessConsolidator< T >.CurrentBar
getsetprotected

Bar being created

Definition at line 48 of file BaseTimelessConsolidator.cs.

◆ Consolidated

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

Definition at line 54 of file BaseTimelessConsolidator.cs.

◆ WorkingData

Gets a clone of the data being currently consolidated

Definition at line 59 of file BaseTimelessConsolidator.cs.

Event Documentation

◆ DataConsolidated

EventHandler<T> QuantConnect.Data.Consolidators.BaseTimelessConsolidator< T >.DataConsolidated

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

Definition at line 74 of file BaseTimelessConsolidator.cs.


The documentation for this class was generated from the following file: