Lean  $LEAN_TAG$
QuantConnect.Securities.Security Class Reference

A base vehicle properties class for providing a common interface to all assets in QuantConnect. More...

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

Public Member Functions

 Security (SecurityExchangeHours exchangeHours, SubscriptionDataConfig config, Cash quoteCurrency, SymbolProperties symbolProperties, ICurrencyConverter currencyConverter, IRegisteredSecurityDataTypesProvider registeredTypesProvider, SecurityCache cache)
 Construct a new security vehicle based on the user options. More...
 
 Security (Symbol symbol, SecurityExchangeHours exchangeHours, Cash quoteCurrency, SymbolProperties symbolProperties, ICurrencyConverter currencyConverter, IRegisteredSecurityDataTypesProvider registeredTypesProvider, SecurityCache cache)
 Construct a new security vehicle based on the user options. More...
 
BaseData GetLastData ()
 Get the last price update set to the security if any else null More...
 
virtual void SetLocalTimeKeeper (LocalTimeKeeper localTimeKeeper)
 Sets the LocalTimeKeeper to be used for this Security. This is the source of this instance's time. More...
 
void SetMarketPrice (BaseData data)
 Update any security properties based on the latest market data and time More...
 
void Update (IReadOnlyList< BaseData > data, Type dataType, bool? containsFillForwardData=null)
 Updates all of the security properties, such as price/OHLCV/bid/ask based on the data provided. Data is also stored into the security's data cache More...
 
bool IsCustomData ()
 Returns true if the security contains at least one subscription that represents custom data More...
 
void SetLeverage (decimal leverage)
 Set the leverage parameter for this security More...
 
virtual void SetDataNormalizationMode (DataNormalizationMode mode)
 Sets the data normalization mode to be used by this security More...
 
void RefreshDataNormalizationModeProperty ()
 This method will refresh the value of the DataNormalizationMode property. This is required for backward-compatibility. TODO: to be deleted with the DataNormalizationMode property More...
 
void SetFeeModel (IFeeModel feelModel)
 Sets the fee model More...
 
void SetFeeModel (PyObject feelModel)
 Sets the fee model More...
 
void SetFillModel (IFillModel fillModel)
 Sets the fill model More...
 
void SetFillModel (PyObject fillModel)
 Sets the fill model More...
 
void SetSettlementModel (ISettlementModel settlementModel)
 Sets the settlement model More...
 
void SetSettlementModel (PyObject settlementModel)
 Sets the settlement model More...
 
void SetSlippageModel (ISlippageModel slippageModel)
 Sets the slippage model More...
 
void SetSlippageModel (PyObject slippageModel)
 Sets the slippage model More...
 
void SetVolatilityModel (IVolatilityModel volatilityModel)
 Sets the volatility model More...
 
void SetVolatilityModel (PyObject volatilityModel)
 Sets the volatility model More...
 
void SetBuyingPowerModel (IBuyingPowerModel buyingPowerModel)
 Sets the buying power model More...
 
void SetBuyingPowerModel (PyObject pyObject)
 Sets the buying power model More...
 
void SetMarginInterestRateModel (IMarginInterestRateModel marginInterestRateModel)
 Sets the margin interests rate model More...
 
void SetMarginInterestRateModel (PyObject pyObject)
 Sets the margin interests rate model More...
 
void SetMarginModel (IBuyingPowerModel marginModel)
 Sets the margin model More...
 
void SetMarginModel (PyObject pyObject)
 Sets the margin model More...
 
void SetShortableProvider (PyObject pyObject)
 Set Python Shortable Provider for this Security More...
 
void SetShortableProvider (IShortableProvider shortableProvider)
 Set Shortable Provider for this Security More...
 
void SetDataFilter (PyObject pyObject)
 Set Security Data Filter More...
 
void SetDataFilter (ISecurityDataFilter dataFilter)
 Set Security Data Filter More...
 
override bool TryGetMember (GetMemberBinder binder, out object result)
 This is a DynamicObject override. Not meant for external use. More...
 
override bool TrySetMember (SetMemberBinder binder, object value)
 This is a DynamicObject override. Not meant for external use. More...
 
override bool TryInvokeMember (InvokeMemberBinder binder, object[] args, out object result)
 This is a DynamicObject override. Not meant for external use. More...
 
void Add (string key, object value)
 Adds the specified custom property. This allows us to use the security object as a dynamic object for quick storage. More...
 
bool TryGet< T > (string key, out T value)
 Gets the specified custom property More...
 
Get< T > (string key)
 Gets the specified custom property More...
 
bool Remove (string key)
 Removes a custom property. More...
 
bool Remove< T > (string key, out T value)
 Removes a custom property. More...
 
void Clear ()
 Removes every custom property that had been set. More...
 
override string ToString ()
 Returns a string that represents the current object. More...
 

Public Attributes

SecurityType Type => Symbol.ID.SecurityType
 Type of the security. More...
 
bool HasData => GetLastData() != null
 There has been at least one datapoint since our algorithm started running for us to determine price. More...
 
virtual bool HoldStock => Holdings.HoldStock
 Read only property that checks if we currently own stock in the company. More...
 
virtual bool Invested => HoldStock
 Alias for HoldStock - Do we have any of this security More...
 
virtual decimal Price => Cache.Price
 Get the current value of the security. More...
 
virtual decimal Leverage => Holdings.Leverage
 Leverage for this Security. More...
 
virtual decimal High => Cache.High == 0 ? Price : Cache.High
 If this uses tradebar data, return the most recent high. More...
 
virtual decimal Low => Cache.Low == 0 ? Price : Cache.Low
 If this uses tradebar data, return the most recent low. More...
 
virtual decimal Close => Cache.Close == 0 ? Price : Cache.Close
 If this uses tradebar data, return the most recent close. More...
 
virtual decimal Open => Cache.Open == 0 ? Price : Cache.Open
 If this uses tradebar data, return the most recent open. More...
 
virtual decimal Volume => Cache.Volume
 Access to the volume of the equity today More...
 
virtual decimal BidPrice => Cache.BidPrice == 0 ? Price : Cache.BidPrice
 Gets the most recent bid price if available More...
 
virtual decimal BidSize => Cache.BidSize
 Gets the most recent bid size if available More...
 
virtual decimal AskPrice => Cache.AskPrice == 0 ? Price : Cache.AskPrice
 Gets the most recent ask price if available More...
 
virtual decimal AskSize => Cache.AskSize
 Gets the most recent ask size if available More...
 
virtual long OpenInterest => Cache.OpenInterest
 Access to the open interest of the security today More...
 

Static Public Attributes

const decimal NullLeverage = 0
 A null security leverage value More...
 

Protected Member Functions

 Security (Symbol symbol, Cash quoteCurrency, SymbolProperties symbolProperties, SecurityExchange exchange, SecurityCache cache, ISecurityPortfolioModel portfolioModel, IFillModel fillModel, IFeeModel feeModel, ISlippageModel slippageModel, ISettlementModel settlementModel, IVolatilityModel volatilityModel, IBuyingPowerModel buyingPowerModel, ISecurityDataFilter dataFilter, IPriceVariationModel priceVariationModel, ICurrencyConverter currencyConverter, IRegisteredSecurityDataTypesProvider registeredTypesProvider, IMarginInterestRateModel marginInterestRateModel)
 Construct a new security vehicle based on the user options. More...
 
 Security (SubscriptionDataConfig config, Cash quoteCurrency, SymbolProperties symbolProperties, SecurityExchange exchange, SecurityCache cache, ISecurityPortfolioModel portfolioModel, IFillModel fillModel, IFeeModel feeModel, ISlippageModel slippageModel, ISettlementModel settlementModel, IVolatilityModel volatilityModel, IBuyingPowerModel buyingPowerModel, ISecurityDataFilter dataFilter, IPriceVariationModel priceVariationModel, ICurrencyConverter currencyConverter, IRegisteredSecurityDataTypesProvider registeredTypesProvider, IMarginInterestRateModel marginInterestRateModel)
 Temporary convenience constructor More...
 
virtual void UpdateConsumersMarketPrice (BaseData data)
 Update market price of this Security More...
 

Properties

IShortableProvider ShortableProvider [get]
 This securities IShortableProvider More...
 
IEnumerable< SubscriptionDataConfigSubscriptions [get]
 Gets all the subscriptions for this security More...
 
Symbol Symbol [get]
 Symbol for the asset. More...
 
Cash QuoteCurrency [get]
 Gets the Cash object used for converting the quote currency to the account currency More...
 
SymbolProperties SymbolProperties [get, protected set]
 Gets the symbol properties for this security More...
 
Resolution Resolution [get]
 Resolution of data requested for this security. More...
 
bool IsFillDataForward [get]
 Indicates the data will use previous bars when there was no trading in this time period. This was a configurable datastream setting set in initialization. More...
 
bool IsExtendedMarketHours [get]
 Indicates the security will continue feeding data after the primary market hours have closed. This was a configurable setting set in initialization. More...
 
DataNormalizationMode DataNormalizationMode [get]
 Gets the data normalization mode used for this security More...
 
SubscriptionDataConfig SubscriptionDataConfig [get]
 Gets the subscription configuration for this security More...
 
virtual bool IsTradable [get, set]
 Gets or sets whether or not this security should be considered tradable More...
 
bool IsDelisted [get, set]
 True if the security has been delisted from exchanges and is no longer tradable More...
 
SecurityCache Cache [get, set]
 Data cache for the security to store previous price information. More...
 
SecurityHolding Holdings [get, set]
 Holdings class contains the portfolio, cash and processes order fills. More...
 
SecurityExchange Exchange [get, set]
 Exchange class contains the market opening hours, along with pre-post market hours. More...
 
IFeeModel FeeModel [get, set]
 Fee model used to compute order fees for this security More...
 
IFillModel FillModel [get, set]
 Fill model used to produce fill events for this security More...
 
ISlippageModel SlippageModel [get, set]
 Slippage model use to compute slippage of market orders More...
 
ISecurityPortfolioModel PortfolioModel [get, set]
 Gets the portfolio model used by this security More...
 
IBuyingPowerModel BuyingPowerModel [get, set]
 Gets the buying power model used for this security More...
 
IBuyingPowerModel MarginModel [get, set]
 Gets the buying power model used for this security, an alias for BuyingPowerModel More...
 
IMarginInterestRateModel MarginInterestRateModel [get, set]
 Gets or sets the margin interest rate model More...
 
ISettlementModel SettlementModel [get, set]
 Gets the settlement model used for this security More...
 
IVolatilityModel VolatilityModel [get, set]
 Gets the volatility model used for this security More...
 
ISecurityDataFilter DataFilter [get, set]
 Customizable data filter to filter outlier ticks before they are passed into user event handlers. By default all ticks are passed into the user algorithms. More...
 
IPriceVariationModel PriceVariationModel [get, set]
 Customizable price variation model used to define the minimum price variation of this security. By default minimum price variation is a constant find in the symbol-properties-database. More...
 
dynamic Data [get]
 Provides dynamic access to data in the cache More...
 
virtual DateTime LocalTime [get]
 Local time for this market More...
 
Fundamental Fundamentals [get]
 Gets the fundamental data associated with the security if there is any, otherwise null. More...
 
object this[string key] [get, set]
 Gets or sets the specified custom property through the indexer. This is a wrapper around the Get<T>(string) and Add(string,object) methods. More...
 
- Properties inherited from QuantConnect.Interfaces.ISecurityPrice
decimal Price [get]
 Get the current value of the security. More...
 
decimal Close [get]
 If this uses trade bar data, return the most recent close. More...
 
decimal Volume [get]
 Access to the volume of the equity today More...
 
decimal BidPrice [get]
 Gets the most recent bid price if available More...
 
decimal BidSize [get]
 Gets the most recent bid size if available More...
 
decimal AskPrice [get]
 Gets the most recent ask price if available More...
 
decimal AskSize [get]
 Gets the most recent ask size if available More...
 
long OpenInterest [get]
 Access to the open interest of the security today More...
 
Symbol Symbol [get]
 Symbol for the asset. More...
 
SymbolProperties SymbolProperties [get]
 SymbolProperties of the symbol More...
 

Detailed Description

A base vehicle properties class for providing a common interface to all assets in QuantConnect.

Security object is intended to hold properties of the specific security asset. These properties can include trade start-stop dates, price, market hours, resolution of the security, the holdings information for this security and the specific fill model.

Definition at line 47 of file Security.cs.

Constructor & Destructor Documentation

◆ Security() [1/4]

QuantConnect.Securities.Security.Security ( SecurityExchangeHours  exchangeHours,
SubscriptionDataConfig  config,
Cash  quoteCurrency,
SymbolProperties  symbolProperties,
ICurrencyConverter  currencyConverter,
IRegisteredSecurityDataTypesProvider  registeredTypesProvider,
SecurityCache  cache 
)

Construct a new security vehicle based on the user options.

Definition at line 322 of file Security.cs.

◆ Security() [2/4]

QuantConnect.Securities.Security.Security ( Symbol  symbol,
SecurityExchangeHours  exchangeHours,
Cash  quoteCurrency,
SymbolProperties  symbolProperties,
ICurrencyConverter  currencyConverter,
IRegisteredSecurityDataTypesProvider  registeredTypesProvider,
SecurityCache  cache 
)

Construct a new security vehicle based on the user options.

Definition at line 354 of file Security.cs.

◆ Security() [3/4]

QuantConnect.Securities.Security.Security ( Symbol  symbol,
Cash  quoteCurrency,
SymbolProperties  symbolProperties,
SecurityExchange  exchange,
SecurityCache  cache,
ISecurityPortfolioModel  portfolioModel,
IFillModel  fillModel,
IFeeModel  feeModel,
ISlippageModel  slippageModel,
ISettlementModel  settlementModel,
IVolatilityModel  volatilityModel,
IBuyingPowerModel  buyingPowerModel,
ISecurityDataFilter  dataFilter,
IPriceVariationModel  priceVariationModel,
ICurrencyConverter  currencyConverter,
IRegisteredSecurityDataTypesProvider  registeredTypesProvider,
IMarginInterestRateModel  marginInterestRateModel 
)
protected

Construct a new security vehicle based on the user options.

Definition at line 386 of file Security.cs.

◆ Security() [4/4]

QuantConnect.Securities.Security.Security ( SubscriptionDataConfig  config,
Cash  quoteCurrency,
SymbolProperties  symbolProperties,
SecurityExchange  exchange,
SecurityCache  cache,
ISecurityPortfolioModel  portfolioModel,
IFillModel  fillModel,
IFeeModel  feeModel,
ISlippageModel  slippageModel,
ISettlementModel  settlementModel,
IVolatilityModel  volatilityModel,
IBuyingPowerModel  buyingPowerModel,
ISecurityDataFilter  dataFilter,
IPriceVariationModel  priceVariationModel,
ICurrencyConverter  currencyConverter,
IRegisteredSecurityDataTypesProvider  registeredTypesProvider,
IMarginInterestRateModel  marginInterestRateModel 
)
protected

Temporary convenience constructor

Definition at line 443 of file Security.cs.

Member Function Documentation

◆ GetLastData()

BaseData QuantConnect.Securities.Security.GetLastData ( )

Get the last price update set to the security if any else null

Returns
BaseData object for this security

Implements QuantConnect.Interfaces.ISecurityPrice.

Here is the caller graph for this function:

◆ SetLocalTimeKeeper()

virtual void QuantConnect.Securities.Security.SetLocalTimeKeeper ( LocalTimeKeeper  localTimeKeeper)
virtual

Sets the LocalTimeKeeper to be used for this Security. This is the source of this instance's time.

Parameters
localTimeKeeperThe source of this Security's time.

Reimplemented in QuantConnect.Securities.Future.Future.

Definition at line 592 of file Security.cs.

Here is the caller graph for this function:

◆ SetMarketPrice()

void QuantConnect.Securities.Security.SetMarketPrice ( BaseData  data)

Update any security properties based on the latest market data and time

Parameters
dataNew data packet from LEAN

Implements QuantConnect.Interfaces.ISecurityPrice.

Definition at line 602 of file Security.cs.

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

◆ Update()

void QuantConnect.Securities.Security.Update ( IReadOnlyList< BaseData data,
Type  dataType,
bool?  containsFillForwardData = null 
)

Updates all of the security properties, such as price/OHLCV/bid/ask based on the data provided. Data is also stored into the security's data cache

Parameters
dataThe security update data
dataTypeThe data type
containsFillForwardDataFlag indicating whether data contains any fill forward bar or not

Implements QuantConnect.Interfaces.ISecurityPrice.

Definition at line 619 of file Security.cs.

Here is the call graph for this function:

◆ IsCustomData()

bool QuantConnect.Securities.Security.IsCustomData ( )

Returns true if the security contains at least one subscription that represents custom data

Definition at line 631 of file Security.cs.

◆ SetLeverage()

void QuantConnect.Securities.Security.SetLeverage ( decimal  leverage)

Set the leverage parameter for this security

Parameters
leverageLeverage for this asset

Definition at line 645 of file Security.cs.

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

◆ SetDataNormalizationMode()

virtual void QuantConnect.Securities.Security.SetDataNormalizationMode ( DataNormalizationMode  mode)
virtual

Sets the data normalization mode to be used by this security

Reimplemented in QuantConnect.Securities.Option.Option, and QuantConnect.Securities.Equity.Equity.

Definition at line 660 of file Security.cs.

Here is the caller graph for this function:

◆ RefreshDataNormalizationModeProperty()

void QuantConnect.Securities.Security.RefreshDataNormalizationModeProperty ( )

This method will refresh the value of the DataNormalizationMode property. This is required for backward-compatibility. TODO: to be deleted with the DataNormalizationMode property

Definition at line 677 of file Security.cs.

◆ SetFeeModel() [1/2]

void QuantConnect.Securities.Security.SetFeeModel ( IFeeModel  feelModel)

Sets the fee model

Parameters
feelModelModel that represents a fee model

Definition at line 692 of file Security.cs.

◆ SetFeeModel() [2/2]

void QuantConnect.Securities.Security.SetFeeModel ( PyObject  feelModel)

Sets the fee model

Parameters
feelModelModel that represents a fee model

Definition at line 701 of file Security.cs.

◆ SetFillModel() [1/2]

void QuantConnect.Securities.Security.SetFillModel ( IFillModel  fillModel)

Sets the fill model

Parameters
fillModelModel that represents a fill model

Definition at line 710 of file Security.cs.

◆ SetFillModel() [2/2]

void QuantConnect.Securities.Security.SetFillModel ( PyObject  fillModel)

Sets the fill model

Parameters
fillModelModel that represents a fill model

Definition at line 719 of file Security.cs.

◆ SetSettlementModel() [1/2]

void QuantConnect.Securities.Security.SetSettlementModel ( ISettlementModel  settlementModel)

Sets the settlement model

Parameters
settlementModelModel that represents a settlement model

Definition at line 728 of file Security.cs.

◆ SetSettlementModel() [2/2]

void QuantConnect.Securities.Security.SetSettlementModel ( PyObject  settlementModel)

Sets the settlement model

Parameters
settlementModelModel that represents a settlement model

Definition at line 737 of file Security.cs.

◆ SetSlippageModel() [1/2]

void QuantConnect.Securities.Security.SetSlippageModel ( ISlippageModel  slippageModel)

Sets the slippage model

Parameters
slippageModelModel that represents a slippage model

Definition at line 746 of file Security.cs.

◆ SetSlippageModel() [2/2]

void QuantConnect.Securities.Security.SetSlippageModel ( PyObject  slippageModel)

Sets the slippage model

Parameters
slippageModelModel that represents a slippage model

Definition at line 755 of file Security.cs.

◆ SetVolatilityModel() [1/2]

void QuantConnect.Securities.Security.SetVolatilityModel ( IVolatilityModel  volatilityModel)

Sets the volatility model

Parameters
volatilityModelModel that represents a volatility model

Definition at line 764 of file Security.cs.

◆ SetVolatilityModel() [2/2]

void QuantConnect.Securities.Security.SetVolatilityModel ( PyObject  volatilityModel)

Sets the volatility model

Parameters
volatilityModelModel that represents a volatility model

Definition at line 773 of file Security.cs.

◆ SetBuyingPowerModel() [1/2]

void QuantConnect.Securities.Security.SetBuyingPowerModel ( IBuyingPowerModel  buyingPowerModel)

Sets the buying power model

Parameters
buyingPowerModelModel that represents a security's model of buying power

Definition at line 782 of file Security.cs.

Here is the caller graph for this function:

◆ SetBuyingPowerModel() [2/2]

void QuantConnect.Securities.Security.SetBuyingPowerModel ( PyObject  pyObject)

Sets the buying power model

Parameters
pyObjectModel that represents a security's model of buying power

Definition at line 791 of file Security.cs.

Here is the call graph for this function:

◆ SetMarginInterestRateModel() [1/2]

void QuantConnect.Securities.Security.SetMarginInterestRateModel ( IMarginInterestRateModel  marginInterestRateModel)

Sets the margin interests rate model

Parameters
marginInterestRateModelModel that represents a security's model of margin interest rate

Definition at line 800 of file Security.cs.

Here is the caller graph for this function:

◆ SetMarginInterestRateModel() [2/2]

void QuantConnect.Securities.Security.SetMarginInterestRateModel ( PyObject  pyObject)

Sets the margin interests rate model

Parameters
pyObjectModel that represents a security's model of margin interest rate

Definition at line 809 of file Security.cs.

Here is the call graph for this function:

◆ SetMarginModel() [1/2]

void QuantConnect.Securities.Security.SetMarginModel ( IBuyingPowerModel  marginModel)

Sets the margin model

Parameters
marginModelModel that represents a security's model of buying power

Definition at line 818 of file Security.cs.

Here is the caller graph for this function:

◆ SetMarginModel() [2/2]

void QuantConnect.Securities.Security.SetMarginModel ( PyObject  pyObject)

Sets the margin model

Parameters
pyObjectModel that represents a security's model of buying power

Definition at line 827 of file Security.cs.

Here is the call graph for this function:

◆ SetShortableProvider() [1/2]

void QuantConnect.Securities.Security.SetShortableProvider ( PyObject  pyObject)

Set Python Shortable Provider for this Security

Parameters
pyObjectPython class that represents a custom shortable provider

Definition at line 836 of file Security.cs.

Here is the caller graph for this function:

◆ SetShortableProvider() [2/2]

void QuantConnect.Securities.Security.SetShortableProvider ( IShortableProvider  shortableProvider)

Set Shortable Provider for this Security

Parameters
shortableProviderProvider to use

Definition at line 859 of file Security.cs.

◆ SetDataFilter() [1/2]

void QuantConnect.Securities.Security.SetDataFilter ( PyObject  pyObject)

Set Security Data Filter

Parameters
pyObjectPython class that represents a custom Security Data Filter
Exceptions
ArgumentException

Definition at line 869 of file Security.cs.

◆ SetDataFilter() [2/2]

void QuantConnect.Securities.Security.SetDataFilter ( ISecurityDataFilter  dataFilter)

Set Security Data Filter

Parameters
dataFilterSecurity Data Filter

Definition at line 892 of file Security.cs.

◆ TryGetMember()

override bool QuantConnect.Securities.Security.TryGetMember ( GetMemberBinder  binder,
out object  result 
)

This is a DynamicObject override. Not meant for external use.

Definition at line 902 of file Security.cs.

◆ TrySetMember()

override bool QuantConnect.Securities.Security.TrySetMember ( SetMemberBinder  binder,
object  value 
)

This is a DynamicObject override. Not meant for external use.

Definition at line 910 of file Security.cs.

◆ TryInvokeMember()

override bool QuantConnect.Securities.Security.TryInvokeMember ( InvokeMemberBinder  binder,
object[]  args,
out object  result 
)

This is a DynamicObject override. Not meant for external use.

Definition at line 919 of file Security.cs.

◆ Add()

void QuantConnect.Securities.Security.Add ( string  key,
object  value 
)

Adds the specified custom property. This allows us to use the security object as a dynamic object for quick storage.

Parameters
keyThe property key
valueThe property value

Definition at line 940 of file Security.cs.

◆ TryGet< T >()

bool QuantConnect.Securities.Security.TryGet< T > ( string  key,
out T  value 
)

Gets the specified custom property

Parameters
keyThe property key
valueThe property value
Returns
True if the property is found.
Exceptions
InvalidCastExceptionIf the property is found but its value cannot be casted to the speficied type

Definition at line 952 of file Security.cs.

◆ Get< T >()

T QuantConnect.Securities.Security.Get< T > ( string  key)

Gets the specified custom property

Parameters
keyThe property key
Returns
The property value is found
Exceptions
KeyNotFoundExceptionIf the property is not found

Definition at line 969 of file Security.cs.

◆ Remove()

bool QuantConnect.Securities.Security.Remove ( string  key)

Removes a custom property.

Parameters
keyThe property key
Returns
True if the property is successfully removed

Definition at line 979 of file Security.cs.

Here is the caller graph for this function:

◆ Remove< T >()

bool QuantConnect.Securities.Security.Remove< T > ( string  key,
out T  value 
)

Removes a custom property.

Parameters
keyThe property key
valueThe removed property value
Returns
True if the property is successfully removed

Definition at line 990 of file Security.cs.

◆ Clear()

void QuantConnect.Securities.Security.Clear ( )

Removes every custom property that had been set.

Definition at line 1004 of file Security.cs.

◆ ToString()

override string QuantConnect.Securities.Security.ToString ( )

Returns a string that represents the current object.

Returns
A string that represents the current object.

<filterpriority>2</filterpriority>

Definition at line 1035 of file Security.cs.

Here is the call graph for this function:

◆ UpdateConsumersMarketPrice()

virtual void QuantConnect.Securities.Security.UpdateConsumersMarketPrice ( BaseData  data)
protectedvirtual

Update market price of this Security

Parameters
dataData to pull price from

Reimplemented in QuantConnect.Securities.IndexOption.IndexOption.

Definition at line 1089 of file Security.cs.

Here is the call graph for this function:

Member Data Documentation

◆ NullLeverage

const decimal QuantConnect.Securities.Security.NullLeverage = 0
static

A null security leverage value

This value is used to determine when the SecurityInitializer leverage is used

Definition at line 68 of file Security.cs.

◆ Type

SecurityType QuantConnect.Securities.Security.Type => Symbol.ID.SecurityType

Type of the security.

QuantConnect currently only supports Equities and Forex

Definition at line 112 of file Security.cs.

◆ HasData

bool QuantConnect.Securities.Security.HasData => GetLastData() != null

There has been at least one datapoint since our algorithm started running for us to determine price.

Definition at line 157 of file Security.cs.

◆ HoldStock

virtual bool QuantConnect.Securities.Security.HoldStock => Holdings.HoldStock

Read only property that checks if we currently own stock in the company.

Definition at line 487 of file Security.cs.

◆ Invested

virtual bool QuantConnect.Securities.Security.Invested => HoldStock

Alias for HoldStock - Do we have any of this security

Definition at line 492 of file Security.cs.

◆ Price

virtual decimal QuantConnect.Securities.Security.Price => Cache.Price

Get the current value of the security.

Definition at line 513 of file Security.cs.

◆ Leverage

virtual decimal QuantConnect.Securities.Security.Leverage => Holdings.Leverage

Leverage for this Security.

Definition at line 518 of file Security.cs.

◆ High

virtual decimal QuantConnect.Securities.Security.High => Cache.High == 0 ? Price : Cache.High

If this uses tradebar data, return the most recent high.

Definition at line 523 of file Security.cs.

◆ Low

virtual decimal QuantConnect.Securities.Security.Low => Cache.Low == 0 ? Price : Cache.Low

If this uses tradebar data, return the most recent low.

Definition at line 528 of file Security.cs.

◆ Close

virtual decimal QuantConnect.Securities.Security.Close => Cache.Close == 0 ? Price : Cache.Close

If this uses tradebar data, return the most recent close.

Definition at line 533 of file Security.cs.

◆ Open

virtual decimal QuantConnect.Securities.Security.Open => Cache.Open == 0 ? Price : Cache.Open

If this uses tradebar data, return the most recent open.

Definition at line 538 of file Security.cs.

◆ Volume

virtual decimal QuantConnect.Securities.Security.Volume => Cache.Volume

Access to the volume of the equity today

Definition at line 543 of file Security.cs.

◆ BidPrice

virtual decimal QuantConnect.Securities.Security.BidPrice => Cache.BidPrice == 0 ? Price : Cache.BidPrice

Gets the most recent bid price if available

Definition at line 548 of file Security.cs.

◆ BidSize

virtual decimal QuantConnect.Securities.Security.BidSize => Cache.BidSize

Gets the most recent bid size if available

Definition at line 553 of file Security.cs.

◆ AskPrice

virtual decimal QuantConnect.Securities.Security.AskPrice => Cache.AskPrice == 0 ? Price : Cache.AskPrice

Gets the most recent ask price if available

Definition at line 558 of file Security.cs.

◆ AskSize

virtual decimal QuantConnect.Securities.Security.AskSize => Cache.AskSize

Gets the most recent ask size if available

Definition at line 563 of file Security.cs.

◆ OpenInterest

virtual long QuantConnect.Securities.Security.OpenInterest => Cache.OpenInterest

Access to the open interest of the security today

Definition at line 568 of file Security.cs.

Property Documentation

◆ ShortableProvider

IShortableProvider QuantConnect.Securities.Security.ShortableProvider
get

This securities IShortableProvider

Definition at line 61 of file Security.cs.

◆ Subscriptions

IEnumerable<SubscriptionDataConfig> QuantConnect.Securities.Security.Subscriptions
get

Gets all the subscriptions for this security

Definition at line 74 of file Security.cs.

◆ Symbol

Symbol QuantConnect.Securities.Security.Symbol
get

Symbol for the asset.

Definition at line 87 of file Security.cs.

◆ QuoteCurrency

Cash QuantConnect.Securities.Security.QuoteCurrency
get

Gets the Cash object used for converting the quote currency to the account currency

Definition at line 93 of file Security.cs.

◆ SymbolProperties

SymbolProperties QuantConnect.Securities.Security.SymbolProperties
getprotected set

Gets the symbol properties for this security

Definition at line 101 of file Security.cs.

◆ Resolution

Resolution QuantConnect.Securities.Security.Resolution
get

Resolution of data requested for this security.

Tick, second or minute resolution for QuantConnect assets.

Definition at line 119 of file Security.cs.

◆ IsFillDataForward

bool QuantConnect.Securities.Security.IsFillDataForward
get

Indicates the data will use previous bars when there was no trading in this time period. This was a configurable datastream setting set in initialization.

Definition at line 125 of file Security.cs.

◆ IsExtendedMarketHours

bool QuantConnect.Securities.Security.IsExtendedMarketHours
get

Indicates the security will continue feeding data after the primary market hours have closed. This was a configurable setting set in initialization.

Definition at line 131 of file Security.cs.

◆ DataNormalizationMode

DataNormalizationMode QuantConnect.Securities.Security.DataNormalizationMode
get

Gets the data normalization mode used for this security

Definition at line 137 of file Security.cs.

◆ SubscriptionDataConfig

SubscriptionDataConfig QuantConnect.Securities.Security.SubscriptionDataConfig
get

Gets the subscription configuration for this security

Definition at line 144 of file Security.cs.

◆ IsTradable

virtual bool QuantConnect.Securities.Security.IsTradable
getset

Gets or sets whether or not this security should be considered tradable

Definition at line 163 of file Security.cs.

◆ IsDelisted

bool QuantConnect.Securities.Security.IsDelisted
getset

True if the security has been delisted from exchanges and is no longer tradable

Definition at line 170 of file Security.cs.

◆ Cache

SecurityCache QuantConnect.Securities.Security.Cache
getset

Data cache for the security to store previous price information.

See also
EquityCache, ForexCache

Definition at line 178 of file Security.cs.

◆ Holdings

SecurityHolding QuantConnect.Securities.Security.Holdings
getset

Holdings class contains the portfolio, cash and processes order fills.

See also
EquityHolding, ForexHolding

Definition at line 188 of file Security.cs.

◆ Exchange

SecurityExchange QuantConnect.Securities.Security.Exchange
getset

Exchange class contains the market opening hours, along with pre-post market hours.

See also
EquityExchange, ForexExchange

Definition at line 199 of file Security.cs.

◆ FeeModel

IFeeModel QuantConnect.Securities.Security.FeeModel
getset

Fee model used to compute order fees for this security

Definition at line 208 of file Security.cs.

◆ FillModel

IFillModel QuantConnect.Securities.Security.FillModel
getset

Fill model used to produce fill events for this security

Definition at line 217 of file Security.cs.

◆ SlippageModel

ISlippageModel QuantConnect.Securities.Security.SlippageModel
getset

Slippage model use to compute slippage of market orders

Definition at line 226 of file Security.cs.

◆ PortfolioModel

ISecurityPortfolioModel QuantConnect.Securities.Security.PortfolioModel
getset

Gets the portfolio model used by this security

Definition at line 235 of file Security.cs.

◆ BuyingPowerModel

IBuyingPowerModel QuantConnect.Securities.Security.BuyingPowerModel
getset

Gets the buying power model used for this security

Definition at line 244 of file Security.cs.

◆ MarginModel

IBuyingPowerModel QuantConnect.Securities.Security.MarginModel
getset

Gets the buying power model used for this security, an alias for BuyingPowerModel

Definition at line 253 of file Security.cs.

◆ MarginInterestRateModel

IMarginInterestRateModel QuantConnect.Securities.Security.MarginInterestRateModel
getset

Gets or sets the margin interest rate model

Definition at line 262 of file Security.cs.

◆ SettlementModel

ISettlementModel QuantConnect.Securities.Security.SettlementModel
getset

Gets the settlement model used for this security

Definition at line 271 of file Security.cs.

◆ VolatilityModel

IVolatilityModel QuantConnect.Securities.Security.VolatilityModel
getset

Gets the volatility model used for this security

Definition at line 280 of file Security.cs.

◆ DataFilter

ISecurityDataFilter QuantConnect.Securities.Security.DataFilter
getset

Customizable data filter to filter outlier ticks before they are passed into user event handlers. By default all ticks are passed into the user algorithms.

TradeBars (seconds and minute bars) are prefiltered to ensure the ticks which build the bars are realistically tradeable

See also
EquityDataFilter, ForexDataFilter

Definition at line 293 of file Security.cs.

◆ PriceVariationModel

IPriceVariationModel QuantConnect.Securities.Security.PriceVariationModel
getset

Customizable price variation model used to define the minimum price variation of this security. By default minimum price variation is a constant find in the symbol-properties-database.

See also
AdjustedPriceVariationModel, SecurityPriceVariationModel, EquityPriceVariationModel

Definition at line 306 of file Security.cs.

◆ Data

dynamic QuantConnect.Securities.Security.Data
get

Provides dynamic access to data in the cache

Definition at line 315 of file Security.cs.

◆ LocalTime

virtual DateTime QuantConnect.Securities.Security.LocalTime
get

Local time for this market

Definition at line 498 of file Security.cs.

◆ Fundamentals

Fundamental QuantConnect.Securities.Security.Fundamentals
get

Gets the fundamental data associated with the security if there is any, otherwise null.

Definition at line 574 of file Security.cs.

◆ this[string key]

object QuantConnect.Securities.Security.this[string key]
getset

Gets or sets the specified custom property through the indexer. This is a wrapper around the Get<T>(string) and Add(string,object) methods.

Parameters
keyThe property key

Definition at line 1015 of file Security.cs.


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