Lean  $LEAN_TAG$
QuantConnect.Data.Consolidators.RangeConsolidator Class Reference

This consolidator can transform a stream of IBaseData instances into a stream of RangeBar More...

Inheritance diagram for QuantConnect.Data.Consolidators.RangeConsolidator:
[legend]

Public Member Functions

 RangeConsolidator (int range, Func< IBaseData, decimal > selector=null, Func< IBaseData, decimal > volumeSelector=null)
 Initializes a new instance of the RangeConsolidator class. More...
 
 RangeConsolidator (int range, PyObject selector, PyObject volumeSelector=null)
 Initializes a new instance of the RangeConsolidator class. More...
 
- Public Member Functions inherited from QuantConnect.Data.Consolidators.BaseTimelessConsolidator< RangeBar >
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

override Type OutputType => typeof(RangeBar)
 Gets RangeBar which is the type emitted in the IDataConsolidator.DataConsolidated event. More...
 
override IBaseData WorkingData => CurrentBar?.Clone()
 Gets a clone of the data being currently consolidated More...
 
- Public Attributes inherited from QuantConnect.Data.Consolidators.BaseTimelessConsolidator< RangeBar >
Type InputType
 Gets the type consumed by this consolidator More...
 
virtual Type OutputType
 Gets T which is the type emitted in the IDataConsolidator.DataConsolidated event. More...
 

Protected Member Functions

override 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...
 
override void CreateNewBar (IBaseData data, decimal currentValue, decimal volume)
 Creates a new bar with the given data More...
 
- Protected Member Functions inherited from QuantConnect.Data.Consolidators.BaseTimelessConsolidator< RangeBar >
 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...
 
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

override RangeBar CurrentBar [get, set]
 Bar being created More...
 
decimal RangeSize [get]
 Range for each RangeBar, this is, the difference between the High and Low for each RangeBar More...
 
int Range [get]
 Number of MinimumPriceVariation units More...
 
- Properties inherited from QuantConnect.Data.Consolidators.BaseTimelessConsolidator< RangeBar >
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...
 

Additional Inherited Members

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

Detailed Description

This consolidator can transform a stream of IBaseData instances into a stream of RangeBar

Definition at line 26 of file RangeConsolidator.cs.

Constructor & Destructor Documentation

◆ RangeConsolidator() [1/2]

QuantConnect.Data.Consolidators.RangeConsolidator.RangeConsolidator ( int  range,
Func< IBaseData, decimal >  selector = null,
Func< IBaseData, decimal >  volumeSelector = null 
)

Initializes a new instance of the RangeConsolidator class.

Parameters
rangeThe Range interval sets the range in which the price moves, which in turn initiates the formation of a new bar. One range equals to one minimum price change, where this last value is defined depending of the RangeBar's symbol
selectorExtracts the value from a data instance to be formed into a RangeBar. 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, except if the input is a TradeBar.

Definition at line 71 of file RangeConsolidator.cs.

◆ RangeConsolidator() [2/2]

QuantConnect.Data.Consolidators.RangeConsolidator.RangeConsolidator ( int  range,
PyObject  selector,
PyObject  volumeSelector = null 
)

Initializes a new instance of the RangeConsolidator class.

Parameters
rangeThe Range interval sets the range in which the price moves, which in turn initiates the formation of a new bar. One range equals to one minimum price change, where this last value is defined depending of the RangeBar's symbol
selectorExtracts the value from a data instance to be formed into a RangeBar. 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 90 of file RangeConsolidator.cs.

Member Function Documentation

◆ UpdateBar()

override void QuantConnect.Data.Consolidators.RangeConsolidator.UpdateBar ( DateTime  time,
decimal  currentValue,
decimal  volume 
)
protectedvirtual

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

Implements QuantConnect.Data.Consolidators.BaseTimelessConsolidator< RangeBar >.

Definition at line 106 of file RangeConsolidator.cs.

Here is the call graph for this function:

◆ CreateNewBar()

override void QuantConnect.Data.Consolidators.RangeConsolidator.CreateNewBar ( IBaseData  data,
decimal  currentValue,
decimal  volume 
)
protectedvirtual

Creates a new bar with the given data

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

Implements QuantConnect.Data.Consolidators.BaseTimelessConsolidator< RangeBar >.

Definition at line 133 of file RangeConsolidator.cs.

Here is the call graph for this function:

Member Data Documentation

◆ OutputType

override Type QuantConnect.Data.Consolidators.RangeConsolidator.OutputType => typeof(RangeBar)

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

Definition at line 55 of file RangeConsolidator.cs.

◆ WorkingData

override IBaseData QuantConnect.Data.Consolidators.RangeConsolidator.WorkingData => CurrentBar?.Clone()

Gets a clone of the data being currently consolidated

Definition at line 60 of file RangeConsolidator.cs.

Property Documentation

◆ CurrentBar

override RangeBar QuantConnect.Data.Consolidators.RangeConsolidator.CurrentBar
getsetprotected

Bar being created

Definition at line 39 of file RangeConsolidator.cs.

◆ RangeSize

decimal QuantConnect.Data.Consolidators.RangeConsolidator.RangeSize
get

Range for each RangeBar, this is, the difference between the High and Low for each RangeBar

Definition at line 45 of file RangeConsolidator.cs.

◆ Range

int QuantConnect.Data.Consolidators.RangeConsolidator.Range
get

Number of MinimumPriceVariation units

Definition at line 50 of file RangeConsolidator.cs.


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