Lean
$LEAN_TAG$
|
This consolidator can transform a stream of IBaseData instances into a stream of RangeBar More...
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... | |
This consolidator can transform a stream of IBaseData instances into a stream of RangeBar
Definition at line 26 of file RangeConsolidator.cs.
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.
range | The 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 |
selector | Extracts 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 |
volumeSelector | Extracts 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.
QuantConnect.Data.Consolidators.RangeConsolidator.RangeConsolidator | ( | int | range, |
PyObject | selector, | ||
PyObject | volumeSelector = null |
||
) |
Initializes a new instance of the RangeConsolidator class.
range | The 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 |
selector | Extracts 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 |
volumeSelector | Extracts 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.
|
protectedvirtual |
Updates the current RangeBar being created with the given data. Additionally, if it's the case, it consolidates the current RangeBar
time | Time of the given data |
currentValue | Value of the given data |
volume | Volume of the given data |
Implements QuantConnect.Data.Consolidators.BaseTimelessConsolidator< RangeBar >.
Definition at line 106 of file RangeConsolidator.cs.
|
protectedvirtual |
Creates a new bar with the given data
data | The new data for the bar |
currentValue | The new value for the bar |
volume | The new volume for the bar |
Implements QuantConnect.Data.Consolidators.BaseTimelessConsolidator< RangeBar >.
Definition at line 133 of file RangeConsolidator.cs.
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.
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.
|
getsetprotected |
Bar being created
Definition at line 39 of file RangeConsolidator.cs.
|
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.
|
get |
Number of MinimumPriceVariation units
Definition at line 50 of file RangeConsolidator.cs.