Lean  $LEAN_TAG$
QuantConnect.Securities.SecurityCache Class Reference

Base class caching spot for security data and any other temporary properties. More...

Inheritance diagram for QuantConnect.Securities.SecurityCache:
[legend]

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...
 
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...
 

Detailed Description

Base class caching spot for security data and any other temporary properties.

Definition at line 30 of file SecurityCache.cs.

Member Function Documentation

◆ AddDataList()

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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddData()

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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ProcessDataPoint()

virtual void QuantConnect.Securities.SecurityCache.ProcessDataPoint ( BaseData  data,
bool  cacheByType 
)
protectedvirtual

Will consume the given data point updating the cache state and it's properties

Parameters
dataThe data point to process
cacheByTypeTrue if this data point should be cached by type

Reimplemented in QuantConnect.Securities.Future.FutureCache.

Definition at line 170 of file SecurityCache.cs.

Here is the caller graph for this function:

◆ StoreData()

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

Parameters
dataThe collection of data to store in this cache
dataTypeThe data type

Definition at line 277 of file SecurityCache.cs.

Here is the caller graph for this function:

◆ GetData()

BaseData QuantConnect.Securities.SecurityCache.GetData ( )

Get last data packet received for this security if any else null

Returns
BaseData type of the security

Definition at line 304 of file SecurityCache.cs.

Here is the caller graph for this function:

◆ GetData< T >()

Get last data packet received for this security of the specified type

Template Parameters
TThe data type
Returns
The last data packet, null if none received of type
Type Constraints
T :BaseData 

Definition at line 314 of file SecurityCache.cs.

Here is the call graph for this function:

◆ GetAll< T >()

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.

◆ Reset()

void QuantConnect.Securities.SecurityCache.Reset ( )

Reset cache storage and free memory

Definition at line 350 of file SecurityCache.cs.

◆ HasData()

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.

Here is the call graph for this function:

◆ TryGetValue()

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.

Here is the caller graph for this function:

◆ ShareTypeCacheInstance()

static void QuantConnect.Securities.SecurityCache.ShareTypeCacheInstance ( SecurityCache  sourceToShare,
SecurityCache  targetToModify 
)
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

Parameters
sourceToShareThe source cache to use
targetToModifyThe target security cache that will be modified

Definition at line 465 of file SecurityCache.cs.

Here is the caller graph for this function:

Property Documentation

◆ Price

decimal QuantConnect.Securities.SecurityCache.Price
get

Gets the most recent price submitted to this cache

Definition at line 50 of file SecurityCache.cs.

◆ Open

decimal QuantConnect.Securities.SecurityCache.Open
get

Gets the most recent open submitted to this cache

Definition at line 55 of file SecurityCache.cs.

◆ High

decimal QuantConnect.Securities.SecurityCache.High
get

Gets the most recent high submitted to this cache

Definition at line 60 of file SecurityCache.cs.

◆ Low

decimal QuantConnect.Securities.SecurityCache.Low
get

Gets the most recent low submitted to this cache

Definition at line 65 of file SecurityCache.cs.

◆ Close

decimal QuantConnect.Securities.SecurityCache.Close
get

Gets the most recent close submitted to this cache

Definition at line 70 of file SecurityCache.cs.

◆ BidPrice

decimal QuantConnect.Securities.SecurityCache.BidPrice
get

Gets the most recent bid submitted to this cache

Definition at line 75 of file SecurityCache.cs.

◆ AskPrice

decimal QuantConnect.Securities.SecurityCache.AskPrice
get

Gets the most recent ask submitted to this cache

Definition at line 80 of file SecurityCache.cs.

◆ BidSize

decimal QuantConnect.Securities.SecurityCache.BidSize
get

Gets the most recent bid size submitted to this cache

Definition at line 85 of file SecurityCache.cs.

◆ AskSize

decimal QuantConnect.Securities.SecurityCache.AskSize
get

Gets the most recent ask size submitted to this cache

Definition at line 90 of file SecurityCache.cs.

◆ Volume

decimal QuantConnect.Securities.SecurityCache.Volume
get

Gets the most recent volume submitted to this cache

Definition at line 95 of file SecurityCache.cs.

◆ OpenInterest

long QuantConnect.Securities.SecurityCache.OpenInterest
get

Gets the most recent open interest submitted to this cache

Definition at line 100 of file SecurityCache.cs.

◆ Properties

Dictionary<string, object> QuantConnect.Securities.SecurityCache.Properties
get

Collection of keyed custom properties

Definition at line 106 of file SecurityCache.cs.


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