Lean
$LEAN_TAG$
|
Base class caching spot for security data and any other temporary properties. More...
Public Member Functions | |
void | AddDataList (IReadOnlyList< BaseData > data, Type dataType, bool? containsFillForwardData=null) |
Add a list of market data points to the local security cache for the current market price. More... | |
void | AddData (BaseData data) |
Add a new market data point to the local security cache for the current market price. Rules: Don't cache fill forward data. Always return the last observation. If two consecutive data has the same time stamp and one is Quotebars and the other Tradebar, prioritize the Quotebar. More... | |
void | StoreData (IReadOnlyList< BaseData > data, Type dataType) |
Stores the specified data list in the cache WITHOUT updating any of the cache properties, such as Price More... | |
BaseData | GetData () |
Get last data packet received for this security if any else null More... | |
T | GetData< T > () |
Get last data packet received for this security of the specified type More... | |
IEnumerable< T > | GetAll< T > () |
Gets all data points of the specified type from the most recent time step that produced data for that type More... | |
void | Reset () |
Reset cache storage and free memory More... | |
bool | HasData (Type type) |
Gets whether or not this dynamic data instance has data stored for the specified type More... | |
bool | TryGetValue (Type type, out IReadOnlyList< BaseData > data) |
Gets whether or not this dynamic data instance has data stored for the specified type More... | |
Static Public Member Functions | |
static void | ShareTypeCacheInstance (SecurityCache sourceToShare, SecurityCache targetToModify) |
Helper method that modifies the target security cache instance to use the type cache of the source More... | |
Protected Member Functions | |
virtual void | ProcessDataPoint (BaseData data, bool cacheByType) |
Will consume the given data point updating the cache state and it's properties More... | |
Properties | |
decimal | Price [get] |
Gets the most recent price submitted to this cache More... | |
decimal | Open [get] |
Gets the most recent open submitted to this cache More... | |
decimal | High [get] |
Gets the most recent high submitted to this cache More... | |
decimal | Low [get] |
Gets the most recent low submitted to this cache More... | |
decimal | Close [get] |
Gets the most recent close submitted to this cache More... | |
decimal | BidPrice [get] |
Gets the most recent bid submitted to this cache More... | |
decimal | AskPrice [get] |
Gets the most recent ask submitted to this cache More... | |
decimal | BidSize [get] |
Gets the most recent bid size submitted to this cache More... | |
decimal | AskSize [get] |
Gets the most recent ask size submitted to this cache More... | |
decimal | Volume [get] |
Gets the most recent volume submitted to this cache More... | |
long | OpenInterest [get] |
Gets the most recent open interest submitted to this cache More... | |
Dictionary< string, object > | Properties [get] |
Collection of keyed custom properties More... | |
Base class caching spot for security data and any other temporary properties.
Definition at line 30 of file SecurityCache.cs.
void QuantConnect.Securities.SecurityCache.AddDataList | ( | IReadOnlyList< BaseData > | data, |
Type | dataType, | ||
bool? | containsFillForwardData = null |
||
) |
Add a list of market data points to the local security cache for the current market price.
Internally uses AddData using the last data point of the provided list and it stores by type the non fill forward points using StoreData
Definition at line 122 of file SecurityCache.cs.
void QuantConnect.Securities.SecurityCache.AddData | ( | BaseData | data | ) |
Add a new market data point to the local security cache for the current market price. Rules: Don't cache fill forward data. Always return the last observation. If two consecutive data has the same time stamp and one is Quotebars and the other Tradebar, prioritize the Quotebar.
Definition at line 160 of file SecurityCache.cs.
|
protectedvirtual |
Will consume the given data point updating the cache state and it's properties
data | The data point to process |
cacheByType | True if this data point should be cached by type |
Reimplemented in QuantConnect.Securities.Future.FutureCache.
Definition at line 170 of file SecurityCache.cs.
void QuantConnect.Securities.SecurityCache.StoreData | ( | IReadOnlyList< BaseData > | data, |
Type | dataType | ||
) |
Stores the specified data list in the cache WITHOUT updating any of the cache properties, such as Price
data | The collection of data to store in this cache |
dataType | The data type |
Definition at line 277 of file SecurityCache.cs.
BaseData QuantConnect.Securities.SecurityCache.GetData | ( | ) |
Get last data packet received for this security if any else null
Definition at line 304 of file SecurityCache.cs.
Get last data packet received for this security of the specified type
T | The data type |
T | : | BaseData |
Definition at line 314 of file SecurityCache.cs.
IEnumerable<T> QuantConnect.Securities.SecurityCache.GetAll< T > | ( | ) |
Gets all data points of the specified type from the most recent time step that produced data for that type
Definition at line 329 of file SecurityCache.cs.
void QuantConnect.Securities.SecurityCache.Reset | ( | ) |
Reset cache storage and free memory
Definition at line 350 of file SecurityCache.cs.
bool QuantConnect.Securities.SecurityCache.HasData | ( | Type | type | ) |
Gets whether or not this dynamic data instance has data stored for the specified type
Definition at line 375 of file SecurityCache.cs.
bool QuantConnect.Securities.SecurityCache.TryGetValue | ( | Type | type, |
out IReadOnlyList< BaseData > | data | ||
) |
Gets whether or not this dynamic data instance has data stored for the specified type
Definition at line 383 of file SecurityCache.cs.
|
static |
Helper method that modifies the target security cache instance to use the type cache of the source
Will set in the source cache any data already present in the target cache
This is useful for custom data securities which also have an underlying security, will allow both securities to access the same data by type
sourceToShare | The source cache to use |
targetToModify | The target security cache that will be modified |
Definition at line 465 of file SecurityCache.cs.
|
get |
Gets the most recent price submitted to this cache
Definition at line 50 of file SecurityCache.cs.
|
get |
Gets the most recent open submitted to this cache
Definition at line 55 of file SecurityCache.cs.
|
get |
Gets the most recent high submitted to this cache
Definition at line 60 of file SecurityCache.cs.
|
get |
Gets the most recent low submitted to this cache
Definition at line 65 of file SecurityCache.cs.
|
get |
Gets the most recent close submitted to this cache
Definition at line 70 of file SecurityCache.cs.
|
get |
Gets the most recent bid submitted to this cache
Definition at line 75 of file SecurityCache.cs.
|
get |
Gets the most recent ask submitted to this cache
Definition at line 80 of file SecurityCache.cs.
|
get |
Gets the most recent bid size submitted to this cache
Definition at line 85 of file SecurityCache.cs.
|
get |
Gets the most recent ask size submitted to this cache
Definition at line 90 of file SecurityCache.cs.
|
get |
Gets the most recent volume submitted to this cache
Definition at line 95 of file SecurityCache.cs.
|
get |
Gets the most recent open interest submitted to this cache
Definition at line 100 of file SecurityCache.cs.
|
get |
Collection of keyed custom properties
Definition at line 106 of file SecurityCache.cs.