Lean  $LEAN_TAG$
QuantConnect.Data.SliceExtensions Class Reference

Provides extension methods to slices and slice enumerables More...

Static Public Member Functions

static IEnumerable< TradeBarsTradeBars (this IEnumerable< Slice > slices)
 Selects into the slice and returns the TradeBars that have data in order More...
 
static IEnumerable< TicksTicks (this IEnumerable< Slice > slices)
 Selects into the slice and returns the Ticks that have data in order More...
 
static IEnumerable< DataDictionary< BaseDataCollection > > GetUniverseData (this IEnumerable< Slice > slices)
 Gets the data dictionaries or points of the requested type in each slice More...
 
static IEnumerable< dynamic > Get (this IEnumerable< Slice > slices, Type type, Symbol symbol=null)
 Gets the data dictionaries or points of the requested type in each slice More...
 
static IEnumerable< TradeBarGet (this IEnumerable< Slice > slices, Symbol symbol)
 Gets an enumerable of TradeBar for the given symbol. This method does not verify that the specified symbol points to a TradeBar More...
 
static IEnumerable< T > Get< T > (this IEnumerable< DataDictionary< T >> dataDictionaries, Symbol symbol)
 Gets an enumerable of T for the given symbol. This method does not vify that the specified symbol points to a T More...
 
static IEnumerable< decimal > Get< T > (this IEnumerable< DataDictionary< T >> dataDictionaries, Symbol symbol, string field)
 Gets an enumerable of decimals by accessing the specified field on data for the symbol More...
 
static IEnumerable< DataDictionary< T > > Get< T > (this IEnumerable< Slice > slices)
 Gets the data dictionaries of the requested type in each slice More...
 
static IEnumerable< T > Get< T > (this IEnumerable< Slice > slices, Symbol symbol)
 Gets an enumerable of T by accessing the slices for the requested symbol More...
 
static IEnumerable< decimal > Get (this IEnumerable< Slice > slices, Symbol symbol, Func< BaseData, decimal > field)
 Gets an enumerable of decimal by accessing the slice for the symbol and then retrieving the specified field on each piece of data More...
 
static bool TryGet< T > (this Slice slice, Symbol symbol, out T data)
 Tries to get the data for the specified symbol and type More...
 
static bool TryGet (this Slice slice, Type type, Symbol symbol, out dynamic data)
 Tries to get the data for the specified symbol and type More...
 
static double[] ToDoubleArray (this IEnumerable< decimal > decimals)
 Converts the specified enumerable of decimals into a double array More...
 
static void PushThroughConsolidators (this IEnumerable< Slice > slices, Dictionary< Symbol, IDataConsolidator > consolidatorsBySymbol)
 Loops through the specified slices and pushes the data into the consolidators. This can be used to easily warm up indicators from a history call that returns slice objects. More...
 
static void PushThroughConsolidators (this IEnumerable< Slice > slices, Func< Symbol, IDataConsolidator > consolidatorsProvider)
 Loops through the specified slices and pushes the data into the consolidators. This can be used to easily warm up indicators from a history call that returns slice objects. More...
 
static void PushThrough (this IEnumerable< Slice > slices, Action< BaseData > handler, Type dataType=null)
 Loops through the specified slices and pushes the data into the consolidators. This can be used to easily warm up indicators from a history call that returns slice objects. More...
 

Detailed Description

Provides extension methods to slices and slice enumerables

Definition at line 31 of file SliceExtensions.cs.

Member Function Documentation

◆ TradeBars()

static IEnumerable<TradeBars> QuantConnect.Data.SliceExtensions.TradeBars ( this IEnumerable< Slice slices)
static

Selects into the slice and returns the TradeBars that have data in order

Parameters
slicesThe enumerable of slice
Returns
An enumerable of TradeBars

Definition at line 38 of file SliceExtensions.cs.

◆ Ticks()

static IEnumerable<Ticks> QuantConnect.Data.SliceExtensions.Ticks ( this IEnumerable< Slice slices)
static

Selects into the slice and returns the Ticks that have data in order

Parameters
slicesThe enumerable of slice
Returns
An enumerable of Ticks

Definition at line 48 of file SliceExtensions.cs.

◆ GetUniverseData()

static IEnumerable<DataDictionary<BaseDataCollection> > QuantConnect.Data.SliceExtensions.GetUniverseData ( this IEnumerable< Slice slices)
static

Gets the data dictionaries or points of the requested type in each slice

Parameters
slicesThe enumerable of slice
Returns
An enumerable of data dictionary or data point of the requested type

Definition at line 58 of file SliceExtensions.cs.

◆ Get() [1/3]

static IEnumerable<dynamic> QuantConnect.Data.SliceExtensions.Get ( this IEnumerable< Slice slices,
Type  type,
Symbol  symbol = null 
)
static

Gets the data dictionaries or points of the requested type in each slice

Parameters
slicesThe enumerable of slice
typeData type of the data that will be fetched
symbolThe symbol to retrieve
Returns
An enumerable of data dictionary or data point of the requested type

Definition at line 74 of file SliceExtensions.cs.

◆ Get() [2/3]

static IEnumerable<TradeBar> QuantConnect.Data.SliceExtensions.Get ( this IEnumerable< Slice slices,
Symbol  symbol 
)
static

Gets an enumerable of TradeBar for the given symbol. This method does not verify that the specified symbol points to a TradeBar

Parameters
slicesThe enumerable of slice
symbolThe symbol to retrieve
Returns
An enumerable of TradeBar for the matching symbol, of no TradeBar found for symbol, empty enumerable is returned

Definition at line 93 of file SliceExtensions.cs.

◆ Get< T >() [1/4]

static IEnumerable<T> QuantConnect.Data.SliceExtensions.Get< T > ( this IEnumerable< DataDictionary< T >>  dataDictionaries,
Symbol  symbol 
)
static

Gets an enumerable of T for the given symbol. This method does not vify that the specified symbol points to a T

Template Parameters
TThe data type
Parameters
dataDictionariesThe data dictionary enumerable to access
symbolThe symbol to retrieve
Returns
An enumerable of T for the matching symbol, if no T is found for symbol, empty enumerable is returned
Type Constraints
T :IBaseData 

Definition at line 106 of file SliceExtensions.cs.

◆ Get< T >() [2/4]

static IEnumerable<decimal> QuantConnect.Data.SliceExtensions.Get< T > ( this IEnumerable< DataDictionary< T >>  dataDictionaries,
Symbol  symbol,
string  field 
)
static

Gets an enumerable of decimals by accessing the specified field on data for the symbol

Template Parameters
TThe data type
Parameters
dataDictionariesAn enumerable of data dictionaries
symbolThe symbol to retrieve
fieldThe field to access
Returns
An enumerable of decimals

Definition at line 120 of file SliceExtensions.cs.

Here is the call graph for this function:

◆ Get< T >() [3/4]

static IEnumerable<DataDictionary<T> > QuantConnect.Data.SliceExtensions.Get< T > ( this IEnumerable< Slice slices)
static

Gets the data dictionaries of the requested type in each slice

Template Parameters
TThe data type
Parameters
slicesThe enumerable of slice
Returns
An enumerable of data dictionary of the requested type
Type Constraints
T :IBaseData 

Definition at line 159 of file SliceExtensions.cs.

◆ Get< T >() [4/4]

static IEnumerable<T> QuantConnect.Data.SliceExtensions.Get< T > ( this IEnumerable< Slice slices,
Symbol  symbol 
)
static

Gets an enumerable of T by accessing the slices for the requested symbol

Template Parameters
TThe data type
Parameters
slicesThe enumerable of slice
symbolThe symbol to retrieve
Returns
An enumerable of T by accessing each slice for the requested symbol
Type Constraints
T :IBaseData 

Definition at line 172 of file SliceExtensions.cs.

◆ Get() [3/3]

static IEnumerable<decimal> QuantConnect.Data.SliceExtensions.Get ( this IEnumerable< Slice slices,
Symbol  symbol,
Func< BaseData, decimal >  field 
)
static

Gets an enumerable of decimal by accessing the slice for the symbol and then retrieving the specified field on each piece of data

Parameters
slicesThe enumerable of slice
symbolThe symbol to retrieve
fieldThe field selector used to access the dats
Returns
An enumerable of decimal

Definition at line 186 of file SliceExtensions.cs.

◆ TryGet< T >()

static bool QuantConnect.Data.SliceExtensions.TryGet< T > ( this Slice  slice,
Symbol  symbol,
out T  data 
)
static

Tries to get the data for the specified symbol and type

Template Parameters
TThe type of data we want, for example, TradeBar or UnlinkedData, etc...
Parameters
sliceThe slice
symbolThe symbol data is sought for
dataThe found data
Returns
True if data was found for the specified type and symbol
Type Constraints
T :IBaseData 

Definition at line 207 of file SliceExtensions.cs.

◆ TryGet()

static bool QuantConnect.Data.SliceExtensions.TryGet ( this Slice  slice,
Type  type,
Symbol  symbol,
out dynamic  data 
)
static

Tries to get the data for the specified symbol and type

Parameters
sliceThe slice
typeThe type of data we seek
symbolThe symbol data is sought for
dataThe found data
Returns
True if data was found for the specified type and symbol

Definition at line 229 of file SliceExtensions.cs.

Here is the call graph for this function:

◆ ToDoubleArray()

static double [] QuantConnect.Data.SliceExtensions.ToDoubleArray ( this IEnumerable< decimal >  decimals)
static

Converts the specified enumerable of decimals into a double array

Parameters
decimalsThe enumerable of decimal
Returns
Double array representing the enumerable of decimal

Definition at line 247 of file SliceExtensions.cs.

◆ PushThroughConsolidators() [1/2]

static void QuantConnect.Data.SliceExtensions.PushThroughConsolidators ( this IEnumerable< Slice slices,
Dictionary< Symbol, IDataConsolidator consolidatorsBySymbol 
)
static

Loops through the specified slices and pushes the data into the consolidators. This can be used to easily warm up indicators from a history call that returns slice objects.

Parameters
slicesThe data to send into the consolidators, likely result of a history request
consolidatorsBySymbolDictionary of consolidators keyed by symbol

Definition at line 258 of file SliceExtensions.cs.

◆ PushThroughConsolidators() [2/2]

static void QuantConnect.Data.SliceExtensions.PushThroughConsolidators ( this IEnumerable< Slice slices,
Func< Symbol, IDataConsolidator consolidatorsProvider 
)
static

Loops through the specified slices and pushes the data into the consolidators. This can be used to easily warm up indicators from a history call that returns slice objects.

Parameters
slicesThe data to send into the consolidators, likely result of a history request
consolidatorsProviderDelegate that fetches the consolidators by a symbol

Definition at line 274 of file SliceExtensions.cs.

◆ PushThrough()

static void QuantConnect.Data.SliceExtensions.PushThrough ( this IEnumerable< Slice slices,
Action< BaseData handler,
Type  dataType = null 
)
static

Loops through the specified slices and pushes the data into the consolidators. This can be used to easily warm up indicators from a history call that returns slice objects.

Parameters
slicesThe data to send into the consolidators, likely result of a history request
handlerDelegate handles each data piece from the slice
dataTypeDefines the type of the data that should be pushed

Definition at line 286 of file SliceExtensions.cs.


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