Lean  $LEAN_TAG$
QuantConnect.Python.PythonSlice Class Reference

Provides a data structure for all of an algorithm's data at a single time step More...

Inheritance diagram for QuantConnect.Python.PythonSlice:
[legend]

Public Member Functions

 PythonSlice (Slice slice)
 Initializes a new instance of the PythonSlice class More...
 
dynamic Get (PyObject type, Symbol symbol)
 Gets the data of the specified symbol and type. More...
 
PyObject Get (PyObject type)
 Gets the data of the specified symbol and type. More...
 
override bool ContainsKey (Symbol symbol)
 Determines whether this instance contains data for the specified symbol More...
 
override bool TryGetValue (Symbol symbol, out dynamic data)
 Gets the data associated with the specified symbol More...
 
- Public Member Functions inherited from QuantConnect.Data.Slice
 Slice (DateTime time, IEnumerable< BaseData > data, DateTime utcTime)
 Initializes a new instance of the Slice class, lazily instantiating the Slice.Bars and Slice.Ticks collections on demand More...
 
 Slice (DateTime time, List< BaseData > data, DateTime utcTime)
 Initializes a new instance of the Slice class, lazily instantiating the Slice.Bars and Slice.Ticks collections on demand More...
 
 Slice (DateTime time, List< BaseData > data, TradeBars tradeBars, QuoteBars quoteBars, Ticks ticks, OptionChains optionChains, FuturesChains futuresChains, Splits splits, Dividends dividends, Delistings delistings, SymbolChangedEvents symbolChanges, MarginInterestRates marginInterestRates, DateTime utcTime, bool? hasData=null)
 Initializes a new instance of the Slice class More...
 
DataDictionary< T > Get< T > ()
 Gets the DataDictionary<T> for all data of the specified type More...
 
dynamic Get (Type type)
 Gets the data of the specified type. More...
 
Get< T > (Symbol symbol)
 Gets the data of the specified symbol and type. More...
 
override bool TryGetValue (Symbol symbol, out dynamic data)
 Gets the data associated with the specified symbol More...
 
void MergeSlice (Slice inputSlice)
 Merge two slice with same Time More...
 
IEnumerator< KeyValuePair< Symbol, BaseData > > GetEnumerator ()
 Returns an enumerator that iterates through the collection. More...
 
- Public Member Functions inherited from QuantConnect.ExtendedDictionary< dynamic >
virtual void Clear ()
 Removes all items from the T:System.Collections.Generic.ICollection`1. More...
 
abstract bool TryGetValue (Symbol symbol, out T value)
 Gets the value associated with the specified Symbol. More...
 
virtual bool Remove (Symbol symbol)
 Removes the value with the specified Symbol More...
 
void clear ()
 Removes all keys and values from the IExtendedDictionary<TKey, TValue>. More...
 
PyDict copy ()
 Creates a shallow copy of the IExtendedDictionary<TKey, TValue>. More...
 
PyDict fromkeys (Symbol[] sequence)
 Creates a new dictionary from the given sequence of elements. More...
 
PyDict fromkeys (Symbol[] sequence, T value)
 Creates a new dictionary from the given sequence of elements with a value provided by the user. More...
 
get (Symbol symbol)
 Returns the value for the specified Symbol if Symbol is in dictionary. More...
 
get (Symbol symbol, T value)
 Returns the value for the specified Symbol if Symbol is in dictionary. More...
 
PyList items ()
 Returns a view object that displays a list of dictionary's (Symbol, value) tuple pairs. More...
 
PyTuple popitem ()
 Returns and removes an arbitrary element (Symbol, value) pair from the dictionary. More...
 
setdefault (Symbol symbol)
 Returns the value of a Symbol (if the Symbol is in dictionary). If not, it inserts Symbol with a value to the dictionary. More...
 
setdefault (Symbol symbol, T default_value)
 Returns the value of a Symbol (if the Symbol is in dictionary). If not, it inserts Symbol with a value to the dictionary. More...
 
pop (Symbol symbol)
 Removes and returns an element from a dictionary having the given Symbol. More...
 
pop (Symbol symbol, T default_value)
 Removes and returns an element from a dictionary having the given Symbol. More...
 
void update (PyObject other)
 Updates the dictionary with the elements from the another dictionary object or from an iterable of Symbol/value pairs. The update() method adds element(s) to the dictionary if the Symbol is not in the dictionary.If the Symbol is in the dictionary, it updates the Symbol with the new value. More...
 
PyList keys ()
 Returns a view object that displays a list of all the Symbol objects in the dictionary More...
 
PyList values ()
 Returns a view object that displays a list of all the values in the dictionary. More...
 

Properties

override int Count [get]
 Gets the number of symbols held in this slice More...
 
override IReadOnlyList< SymbolKeys [get]
 Gets all the symbols in this slice More...
 
override IReadOnlyList< BaseDataValues [get]
 Gets a list of all the data in this slice More...
 
override dynamic this[Symbol symbol] [get]
 Gets the data corresponding to the specified symbol. If the requested data is of MarketDataType.Tick, then a List<Tick> will be returned, otherwise, it will be the subscribed type, for example, TradeBar or event UnlinkedData for custom data. More...
 
- Properties inherited from QuantConnect.Data.Slice
List< BaseDataAllData [get]
 All the data hold in this slice More...
 
DateTime Time [get]
 Gets the timestamp for this slice of data More...
 
DateTime UtcTime [get]
 Gets the timestamp for this slice of data in UTC More...
 
bool HasData [get]
 Gets whether or not this slice has data More...
 
TradeBars Bars [get]
 Gets the TradeBars for this slice of data More...
 
QuoteBars QuoteBars [get]
 Gets the QuoteBars for this slice of data More...
 
Ticks Ticks [get]
 Gets the Ticks for this slice of data More...
 
OptionChains OptionChains [get]
 Gets the OptionChains for this slice of data More...
 
FuturesChains FuturesChains [get]
 Gets the FuturesChains for this slice of data More...
 
FuturesChains FutureChains [get]
 Gets the FuturesChains for this slice of data More...
 
Splits Splits [get]
 Gets the Splits for this slice of data More...
 
Dividends Dividends [get]
 Gets the Dividends for this slice of data More...
 
Delistings Delistings [get]
 Gets the Delistings for this slice of data More...
 
SymbolChangedEvents SymbolChangedEvents [get]
 Gets the Market.SymbolChangedEvents for this slice of data More...
 
MarginInterestRates MarginInterestRates [get]
 Gets the Market.MarginInterestRates for this slice of data More...
 
virtual int Count [get]
 Gets the number of symbols held in this slice More...
 
virtual IReadOnlyList< SymbolKeys [get]
 Gets all the symbols in this slice More...
 
virtual IReadOnlyList< BaseDataValues [get]
 Gets a list of all the data in this slice More...
 
override dynamic this[Symbol symbol] [get]
 Gets the data corresponding to the specified symbol. If the requested data is of MarketDataType.Tick, then a List<Tick> will be returned, otherwise, it will be the subscribed type, for example, TradeBar or event UnlinkedData for custom data. More...
 
- Properties inherited from QuantConnect.ExtendedDictionary< dynamic >
abstract IEnumerable< SymbolGetKeys [get]
 Gets an T:System.Collections.Generic.ICollection`1 containing the Symbol objects of the T:System.Collections.Generic.IDictionary`2. More...
 
abstract IEnumerable< T > GetValues [get]
 Gets an T:System.Collections.Generic.ICollection`1 containing the values in the T:System.Collections.Generic.IDictionary`2. More...
 
virtual T this[Symbol symbol] [get, set]
 Indexer method for the base dictioanry to access the objects by their symbol. More...
 
virtual T this[string ticker] [get, set]
 Indexer method for the base dictioanry to access the objects by their symbol. More...
 

Additional Inherited Members

- Public Attributes inherited from QuantConnect.ExtendedDictionary< dynamic >
virtual bool IsReadOnly
 Gets a value indicating whether the IDictionary object is read-only. More...
 
- Protected Member Functions inherited from QuantConnect.Data.Slice
 Slice (Slice slice)
 Initializes a new instance used by the PythonSlice More...
 
dynamic GetImpl (Type type, Slice instance)
 Gets the data of the specified type. More...
 
- Protected Attributes inherited from QuantConnect.Data.Slice
override IEnumerable< SymbolGetKeys => _data.Value.Keys
 Gets an T:System.Collections.Generic.ICollection`1 containing the Symbol objects of the T:System.Collections.Generic.IDictionary`2. More...
 
override IEnumerable< dynamic > GetValues => GetKeyValuePairEnumerable().Select(data => (dynamic)data.Value)
 Gets an T:System.Collections.Generic.ICollection`1 containing the values in the T:System.Collections.Generic.IDictionary`2. More...
 

Detailed Description

Provides a data structure for all of an algorithm's data at a single time step

Definition at line 27 of file PythonSlice.cs.

Constructor & Destructor Documentation

◆ PythonSlice()

QuantConnect.Python.PythonSlice.PythonSlice ( Slice  slice)

Initializes a new instance of the PythonSlice class

Parameters
sliceslice object to wrap

Definition at line 58 of file PythonSlice.cs.

Member Function Documentation

◆ Get() [1/2]

dynamic QuantConnect.Python.PythonSlice.Get ( PyObject  type,
Symbol  symbol 
)

Gets the data of the specified symbol and type.

Parameters
typeThe type of data we seek
symbolThe specific symbol was seek
Returns
The data for the requested symbol

Definition at line 70 of file PythonSlice.cs.

Here is the call graph for this function:

◆ Get() [2/2]

PyObject QuantConnect.Python.PythonSlice.Get ( PyObject  type)

Gets the data of the specified symbol and type.

Parameters
typeThe type of data we seek
Returns
The data for the requested symbol

Definition at line 80 of file PythonSlice.cs.

Here is the call graph for this function:

◆ ContainsKey()

override bool QuantConnect.Python.PythonSlice.ContainsKey ( Symbol  symbol)
virtual

Determines whether this instance contains data for the specified symbol

Parameters
symbolThe symbol we seek data for
Returns
True if this instance contains data for the symbol, false otherwise

Reimplemented from QuantConnect.Data.Slice.

Definition at line 151 of file PythonSlice.cs.

◆ TryGetValue()

override bool QuantConnect.Python.PythonSlice.TryGetValue ( Symbol  symbol,
out dynamic  data 
)

Gets the data associated with the specified symbol

Parameters
symbolThe symbol we want data for
dataThe data for the specifed symbol, or null if no data was found
Returns
True if data was found, false otherwise

Definition at line 162 of file PythonSlice.cs.

Property Documentation

◆ Count

override int QuantConnect.Python.PythonSlice.Count
get

Gets the number of symbols held in this slice

Definition at line 93 of file PythonSlice.cs.

◆ Keys

override IReadOnlyList<Symbol> QuantConnect.Python.PythonSlice.Keys
get

Gets all the symbols in this slice

Definition at line 101 of file PythonSlice.cs.

◆ Values

override IReadOnlyList<BaseData> QuantConnect.Python.PythonSlice.Values
get

Gets a list of all the data in this slice

Definition at line 109 of file PythonSlice.cs.

◆ this[Symbol symbol]

override dynamic QuantConnect.Python.PythonSlice.this[Symbol symbol]
get

Gets the data corresponding to the specified symbol. If the requested data is of MarketDataType.Tick, then a List<Tick> will be returned, otherwise, it will be the subscribed type, for example, TradeBar or event UnlinkedData for custom data.

Parameters
symbolThe data's symbols
Returns
The data for the specified symbol

Definition at line 122 of file PythonSlice.cs.


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