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

This consolidator can transform a stream of IBaseData instances into a stream of RangeBar. The difference between this consolidator and RangeConsolidator, is that this last one creates intermediate/ phantom RangeBar's (RangeBar's with zero volume) if the price rises up or falls down by above/below two times the range size. Therefore, RangeConsolidator leaves no space between two adyacent RangeBar's since it always start a new RangeBar one range above the last RangeBar's High value or one range below the last RangeBar's Low value, where one range equals to one minimum price change. More...

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

Public Member Functions

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

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...
 
- Protected Member Functions inherited from QuantConnect.Data.Consolidators.RangeConsolidator
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...
 

Additional Inherited Members

- Public Attributes inherited from QuantConnect.Data.Consolidators.RangeConsolidator
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...
 
- Properties inherited from QuantConnect.Data.Consolidators.RangeConsolidator
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...
 
- 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. The difference between this consolidator and RangeConsolidator, is that this last one creates intermediate/ phantom RangeBar's (RangeBar's with zero volume) if the price rises up or falls down by above/below two times the range size. Therefore, RangeConsolidator leaves no space between two adyacent RangeBar's since it always start a new RangeBar one range above the last RangeBar's High value or one range below the last RangeBar's Low value, where one range equals to one minimum price change.

Definition at line 30 of file ClassicRangeConsolidator.cs.

Constructor & Destructor Documentation

◆ ClassicRangeConsolidator() [1/2]

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

Initializes a new instance of the ClassicRangeConsolidator 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 41 of file ClassicRangeConsolidator.cs.

◆ ClassicRangeConsolidator() [2/2]

QuantConnect.Data.Consolidators.ClassicRangeConsolidator.ClassicRangeConsolidator ( 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 58 of file ClassicRangeConsolidator.cs.

Member Function Documentation

◆ UpdateBar()

override void QuantConnect.Data.Consolidators.ClassicRangeConsolidator.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 72 of file ClassicRangeConsolidator.cs.

Here is the call graph for this function:

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