Lean  $LEAN_TAG$
QuantConnect.Symbol Class Reference

Represents a unique security identifier. This is made of two components, the unique SID and the Value. The value is the current ticker symbol while the SID is constant over the life of a security More...

Inheritance diagram for QuantConnect.Symbol:
[legend]

Public Member Functions

bool IsCanonical ()
 Method returns true, if symbol is a derivative canonical symbol More...
 
bool HasCanonical ()
 Determines whether the symbol has a canonical representation More...
 
bool HasUnderlyingSymbol (Symbol symbol)
 Determines if the specified symbol is an underlying of this symbol instance More...
 
 Symbol (SecurityIdentifier sid, string value)
 Initializes a new instance of the Symbol class More...
 
Symbol UpdateMappedSymbol (string mappedSymbol, uint contractDepthOffset=0)
 Creates new symbol with updated mapped symbol. Symbol Mapping: When symbols change over time (e.g. CHASE-> JPM) need to update the symbol requested. Method returns newly created symbol More...
 
override bool Equals (object obj)
 Determines whether the specified T:System.Object is equal to the current T:System.Object. More...
 
override int GetHashCode ()
 Serves as a hash function for a particular type. More...
 
int CompareTo (object obj)
 Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object. More...
 
override string ToString ()
 Returns a string that represents the current object. More...
 
bool Equals (Symbol other)
 Indicates whether the current object is equal to another object of the same type. More...
 
bool Contains (string value)
 
bool EndsWith (string value)
 
bool StartsWith (string value)
 
string ToLower ()
 
string ToUpper ()
 

Static Public Member Functions

static Symbol Create (string ticker, SecurityType securityType, string market, string alias=null, Type baseDataType=null)
 Provides a convenience method for creating a Symbol for most security types. This method currently does not support Commodities More...
 
static Symbol CreateBase (PyObject baseType, Symbol underlying, string market=null)
 Creates a new Symbol for custom data. This method allows for the creation of a new Base Symbol using the first ticker and the first traded date from the provided underlying Symbol. This avoids the issue for mappable types, where the ticker is remapped supposing the provided ticker value is from today. See SecurityIdentifier's private method GetFirstTickerAndDate. The provided symbol is also set to Symbol.Underlying so that it can be accessed using the custom data Symbol. This is useful for associating custom data Symbols to other asset classes so that it is possible to filter using custom data and place trades on the underlying asset based on the filtered custom data. More...
 
static Symbol CreateBase (Type baseType, Symbol underlying, string market=null)
 Creates a new Symbol for custom data. This method allows for the creation of a new Base Symbol using the first ticker and the first traded date from the provided underlying Symbol. This avoids the issue for mappable types, where the ticker is remapped supposing the provided ticker value is from today. See SecurityIdentifier's private method GetFirstTickerAndDate. The provided symbol is also set to Symbol.Underlying so that it can be accessed using the custom data Symbol. This is useful for associating custom data Symbols to other asset classes so that it is possible to filter using custom data and place trades on the underlying asset based on the filtered custom data. More...
 
static Symbol CreateOption (string underlying, string market, OptionStyle style, OptionRight right, decimal strike, DateTime expiry, string alias=null, bool mapSymbol=true)
 Provides a convenience method for creating an option Symbol. More...
 
static Symbol CreateOption (Symbol underlyingSymbol, string market, OptionStyle style, OptionRight right, decimal strike, DateTime expiry, string alias=null)
 Provides a convenience method for creating an option Symbol using SecurityIdentifier. More...
 
static Symbol CreateOption (Symbol underlyingSymbol, string targetOption, string market, OptionStyle style, OptionRight right, decimal strike, DateTime expiry, string alias=null)
 Provides a convenience method for creating an option Symbol using SecurityIdentifier. More...
 
static Symbol CreateCanonicalOption (Symbol underlyingSymbol, string market=null, string alias=null)
 Simple method to create the canonical option symbol for any given underlying symbol More...
 
static Symbol CreateCanonicalOption (Symbol underlyingSymbol, string targetOption, string market=null, string alias=null)
 Simple method to create the canonical option symbol for any given underlying symbol More...
 
static Symbol CreateFuture (string ticker, string market, DateTime expiry, string alias=null)
 Provides a convenience method for creating a future Symbol. More...
 
static SecurityType GetOptionTypeFromUnderlying (Symbol underlyingSymbol)
 Determines the SecurityType based on the underlying Symbol's SecurityType More...
 
static SecurityType GetOptionTypeFromUnderlying (SecurityType securityType)
 Determines the SecurityType based on the underlying Symbol's SecurityType GetUnderlyingFromOptionType(SecurityType) More...
 
static SecurityType GetUnderlyingFromOptionType (SecurityType securityType)
 Determines the underlying SecurityType based on the option Symbol's SecurityType GetOptionTypeFromUnderlying(SecurityType) More...
 
static bool operator== (Symbol left, Symbol right)
 Equals operator More...
 
static bool operator!= (Symbol left, Symbol right)
 Not equals operator More...
 
static implicit operator string (Symbol symbol)
 Returns the symbol's string ticker More...
 
static implicit operator Symbol (string ticker)
 Creates symbol using string as sid More...
 
static string GetAlias (SecurityIdentifier securityIdentifier, Symbol underlying=null)
 Centralized helper method to resolve alias for a symbol More...
 

Static Public Attributes

static readonly Symbol Empty = new Symbol(SecurityIdentifier.Empty, string.Empty)
 Represents an unassigned symbol. This is intended to be used as an uninitialized, default value More...
 
static readonly Symbol None = new Symbol(SecurityIdentifier.None, "NONE")
 Represents no symbol. This is intended to be used when no symbol is explicitly intended More...
 

Properties

Symbol Canonical [get]
 Get's the canonical representation of this symbol More...
 
string Value [get]
 Gets the current symbol for this ticker More...
 
SecurityIdentifier ID [get]
 Gets the security identifier for this symbol More...
 
bool HasUnderlying [get]
 Gets whether or not this Symbol is a derivative, that is, it has a valid Underlying property More...
 
Symbol Underlying [get]
 Gets the security underlying symbol, if any More...
 
SecurityType SecurityType [get]
 Gets the security type of the symbol More...
 
string CUSIP [get]
 The Committee on Uniform Securities Identification Procedures (CUSIP) number corresponding to this Symbol More...
 
string CompositeFIGI [get]
 The composite Financial Instrument Global Identifier (FIGI) corresponding to this Symbol More...
 
string SEDOL [get]
 The Stock Exchange Daily Official List (SEDOL) security identifier corresponding to this Symbol More...
 
string ISIN [get]
 The International Securities Identification Number (ISIN) corresponding to this Symbol More...
 
int? CIK [get]
 The Central Index Key number (CIK) corresponding to this Symbol More...
 

Detailed Description

Represents a unique security identifier. This is made of two components, the unique SID and the Value. The value is the current ticker symbol while the SID is constant over the life of a security

Definition at line 32 of file Symbol.cs.

Constructor & Destructor Documentation

◆ Symbol()

QuantConnect.Symbol.Symbol ( SecurityIdentifier  sid,
string  value 
)

Initializes a new instance of the Symbol class

Parameters
sidThe security identifier for this symbol
valueThe current ticker symbol value

Definition at line 427 of file Symbol.cs.

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

Member Function Documentation

◆ Create()

static Symbol QuantConnect.Symbol.Create ( string  ticker,
SecurityType  securityType,
string  market,
string  alias = null,
Type  baseDataType = null 
)
static

Provides a convenience method for creating a Symbol for most security types. This method currently does not support Commodities

Parameters
tickerThe string ticker symbol
securityTypeThe security type of the ticker. If securityType == Option, then a canonical symbol is created
marketThe market the ticker resides in
aliasAn alias to be used for the symbol cache. Required when adding the same security from different markets
baseDataTypeOptional for SecurityType.Base and used for generating the base data SID
Returns
A new Symbol object for the specified ticker

Definition at line 62 of file Symbol.cs.

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

◆ CreateBase() [1/2]

static Symbol QuantConnect.Symbol.CreateBase ( PyObject  baseType,
Symbol  underlying,
string  market = null 
)
static

Creates a new Symbol for custom data. This method allows for the creation of a new Base Symbol using the first ticker and the first traded date from the provided underlying Symbol. This avoids the issue for mappable types, where the ticker is remapped supposing the provided ticker value is from today. See SecurityIdentifier's private method GetFirstTickerAndDate. The provided symbol is also set to Symbol.Underlying so that it can be accessed using the custom data Symbol. This is useful for associating custom data Symbols to other asset classes so that it is possible to filter using custom data and place trades on the underlying asset based on the filtered custom data.

Parameters
baseTypeType of BaseData instance
underlyingUnderlying symbol to set for the Base Symbol
marketMarket
Returns
New non-mapped Base Symbol that contains an Underlying Symbol

Definition at line 136 of file Symbol.cs.

Here is the caller graph for this function:

◆ CreateBase() [2/2]

static Symbol QuantConnect.Symbol.CreateBase ( Type  baseType,
Symbol  underlying,
string  market = null 
)
static

Creates a new Symbol for custom data. This method allows for the creation of a new Base Symbol using the first ticker and the first traded date from the provided underlying Symbol. This avoids the issue for mappable types, where the ticker is remapped supposing the provided ticker value is from today. See SecurityIdentifier's private method GetFirstTickerAndDate. The provided symbol is also set to Symbol.Underlying so that it can be accessed using the custom data Symbol. This is useful for associating custom data Symbols to other asset classes so that it is possible to filter using custom data and place trades on the underlying asset based on the filtered custom data.

Parameters
baseTypeType of BaseData instance
underlyingUnderlying symbol to set for the Base Symbol
marketMarket
Returns
New non-mapped Base Symbol that contains an Underlying Symbol

Definition at line 154 of file Symbol.cs.

Here is the call graph for this function:

◆ CreateOption() [1/3]

static Symbol QuantConnect.Symbol.CreateOption ( string  underlying,
string  market,
OptionStyle  style,
OptionRight  right,
decimal  strike,
DateTime  expiry,
string  alias = null,
bool  mapSymbol = true 
)
static

Provides a convenience method for creating an option Symbol.

Parameters
underlyingThe underlying ticker
marketThe market the underlying resides in
styleThe option style (American, European, ect..)
rightThe option right (Put/Call)
strikeThe option strike price
expiryThe option expiry date
aliasAn alias to be used for the symbol cache. Required when adding the same security from different markets
mapSymbolSpecifies if symbol should be mapped using map file provider
Returns
A new Symbol object for the specified option contract

Definition at line 182 of file Symbol.cs.

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

◆ CreateOption() [2/3]

static Symbol QuantConnect.Symbol.CreateOption ( Symbol  underlyingSymbol,
string  market,
OptionStyle  style,
OptionRight  right,
decimal  strike,
DateTime  expiry,
string  alias = null 
)
static

Provides a convenience method for creating an option Symbol using SecurityIdentifier.

Parameters
underlyingSymbolThe underlying security symbol
marketThe market the underlying resides in
styleThe option style (American, European, ect..)
rightThe option right (Put/Call)
strikeThe option strike price
expiryThe option expiry date
aliasAn alias to be used for the symbol cache. Required when adding the same security from diferent markets
Returns
A new Symbol object for the specified option contract

Definition at line 202 of file Symbol.cs.

Here is the call graph for this function:

◆ CreateOption() [3/3]

static Symbol QuantConnect.Symbol.CreateOption ( Symbol  underlyingSymbol,
string  targetOption,
string  market,
OptionStyle  style,
OptionRight  right,
decimal  strike,
DateTime  expiry,
string  alias = null 
)
static

Provides a convenience method for creating an option Symbol using SecurityIdentifier.

Parameters
underlyingSymbolThe underlying security symbol
targetOptionThe target option ticker. This is useful when the option ticker does not match the underlying, e.g. SPX index and the SPXW weekly option. If null is provided will use underlying
marketThe market the underlying resides in
styleThe option style (American, European, ect..)
rightThe option right (Put/Call)
strikeThe option strike price
expiryThe option expiry date
aliasAn alias to be used for the symbol cache. Required when adding the same security from diferent markets
Returns
A new Symbol object for the specified option contract

Definition at line 220 of file Symbol.cs.

Here is the call graph for this function:

◆ CreateCanonicalOption() [1/2]

static Symbol QuantConnect.Symbol.CreateCanonicalOption ( Symbol  underlyingSymbol,
string  market = null,
string  alias = null 
)
static

Simple method to create the canonical option symbol for any given underlying symbol

Parameters
underlyingSymbolUnderlying of this option
marketMarket for this option
aliasAn alias to be used for the symbol cache. Required when adding the same security from different markets
Returns
New Canonical Option

Definition at line 235 of file Symbol.cs.

Here is the caller graph for this function:

◆ CreateCanonicalOption() [2/2]

static Symbol QuantConnect.Symbol.CreateCanonicalOption ( Symbol  underlyingSymbol,
string  targetOption,
string  market = null,
string  alias = null 
)
static

Simple method to create the canonical option symbol for any given underlying symbol

Parameters
underlyingSymbolUnderlying of this option
targetOptionThe target option ticker. This is useful when the option ticker does not match the underlying, e.g. SPX index and the SPXW weekly option. If null is provided will use underlying
marketMarket for this option
aliasAn alias to be used for the symbol cache. Required when adding the same security from different markets
Returns
New Canonical Option

Definition at line 249 of file Symbol.cs.

Here is the call graph for this function:

◆ CreateFuture()

static Symbol QuantConnect.Symbol.CreateFuture ( string  ticker,
string  market,
DateTime  expiry,
string  alias = null 
)
static

Provides a convenience method for creating a future Symbol.

Parameters
tickerThe ticker
marketThe market the future resides in
expiryThe future expiry date
aliasAn alias to be used for the symbol cache. Required when adding the same security from different markets
Returns
A new Symbol object for the specified future contract

Definition at line 274 of file Symbol.cs.

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

◆ IsCanonical()

bool QuantConnect.Symbol.IsCanonical ( )

Method returns true, if symbol is a derivative canonical symbol

Returns
true, if symbol is a derivative canonical symbol

Definition at line 285 of file Symbol.cs.

Here is the caller graph for this function:

◆ HasCanonical()

bool QuantConnect.Symbol.HasCanonical ( )

Determines whether the symbol has a canonical representation

Definition at line 329 of file Symbol.cs.

Here is the call graph for this function:

◆ HasUnderlyingSymbol()

bool QuantConnect.Symbol.HasUnderlyingSymbol ( Symbol  symbol)

Determines if the specified symbol is an underlying of this symbol instance

Parameters
symbolThe underlying to check for
Returns
True if the specified symbol is an underlying of this symbol instance

Definition at line 339 of file Symbol.cs.

◆ UpdateMappedSymbol()

Symbol QuantConnect.Symbol.UpdateMappedSymbol ( string  mappedSymbol,
uint  contractDepthOffset = 0 
)

Creates new symbol with updated mapped symbol. Symbol Mapping: When symbols change over time (e.g. CHASE-> JPM) need to update the symbol requested. Method returns newly created symbol

Definition at line 446 of file Symbol.cs.

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

◆ GetOptionTypeFromUnderlying() [1/2]

static SecurityType QuantConnect.Symbol.GetOptionTypeFromUnderlying ( Symbol  underlyingSymbol)
static

Determines the SecurityType based on the underlying Symbol's SecurityType

Parameters
underlyingSymbolUnderlying Symbol of an option
Returns
SecurityType of the option
Exceptions
ArgumentExceptionThe provided underlying has no SecurityType able to represent it as an option

Definition at line 507 of file Symbol.cs.

Here is the caller graph for this function:

◆ GetOptionTypeFromUnderlying() [2/2]

static SecurityType QuantConnect.Symbol.GetOptionTypeFromUnderlying ( SecurityType  securityType)
static

Determines the SecurityType based on the underlying Symbol's SecurityType GetUnderlyingFromOptionType(SecurityType)

Parameters
securityTypeSecurityType of the underlying Symbol
Returns
SecurityType of the option
Exceptions
ArgumentExceptionThe provided underlying has no SecurityType able to represent it as an option

Definition at line 518 of file Symbol.cs.

◆ GetUnderlyingFromOptionType()

static SecurityType QuantConnect.Symbol.GetUnderlyingFromOptionType ( SecurityType  securityType)
static

Determines the underlying SecurityType based on the option Symbol's SecurityType GetOptionTypeFromUnderlying(SecurityType)

Parameters
securityTypeSecurityType of the option Symbol
Returns
SecurityType of the underlying
Exceptions
ArgumentExceptionThe provided option has no SecurityType able to represent it as an underlying

Definition at line 539 of file Symbol.cs.

Here is the caller graph for this function:

◆ Equals() [1/2]

override bool QuantConnect.Symbol.Equals ( object  obj)

Determines whether the specified T:System.Object is equal to the current T:System.Object.

Returns
true if the specified object is equal to the current object; otherwise, false.
Parameters
objThe object to compare with the current object.

<filterpriority>2</filterpriority>

Definition at line 582 of file Symbol.cs.

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

◆ GetHashCode()

override int QuantConnect.Symbol.GetHashCode ( )

Serves as a hash function for a particular type.

Returns
A hash code for the current T:System.Object.

<filterpriority>2</filterpriority>

Definition at line 615 of file Symbol.cs.

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

◆ CompareTo()

int QuantConnect.Symbol.CompareTo ( object  obj)

Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

Returns
A value that indicates the relative order of the objects being compared. The return value has these meanings: Value Meaning Less than zero This instance precedes obj in the sort order. Zero This instance occurs in the same position in the sort order as obj . Greater than zero This instance follows obj in the sort order.
Parameters
objAn object to compare with this instance.
Exceptions
T:System.ArgumentExceptionobj is not the same type as this instance.

<filterpriority>2</filterpriority>

Definition at line 628 of file Symbol.cs.

Here is the call graph for this function:

◆ ToString()

override string QuantConnect.Symbol.ToString ( )

Returns a string that represents the current object.

Returns
A string that represents the current object.

<filterpriority>2</filterpriority>

Definition at line 651 of file Symbol.cs.

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

◆ Equals() [2/2]

bool QuantConnect.Symbol.Equals ( Symbol  other)

Indicates whether the current object is equal to another object of the same type.

Returns
true if the current object is equal to the other parameter; otherwise, false.
Parameters
otherAn object to compare with this object.

Definition at line 667 of file Symbol.cs.

Here is the call graph for this function:

◆ operator==()

static bool QuantConnect.Symbol.operator== ( Symbol  left,
Symbol  right 
)
static

Equals operator

Parameters
leftThe left operand
rightThe right operand
Returns
True if both symbols are equal, otherwise false

Definition at line 694 of file Symbol.cs.

Here is the call graph for this function:

◆ operator!=()

static bool QuantConnect.Symbol.operator!= ( Symbol  left,
Symbol  right 
)
static

Not equals operator

Parameters
leftThe left operand
rightThe right operand
Returns
True if both symbols are not equal, otherwise false

Definition at line 714 of file Symbol.cs.

◆ operator string()

static implicit QuantConnect.Symbol.operator string ( Symbol  symbol)
static

Returns the symbol's string ticker

Parameters
symbolThe symbol
Returns
The string ticker

Definition at line 729 of file Symbol.cs.

Here is the call graph for this function:

◆ operator Symbol()

static implicit QuantConnect.Symbol.operator Symbol ( string  ticker)
static

Creates symbol using string as sid

Parameters
tickerThe string
Returns
The symbol

Definition at line 740 of file Symbol.cs.

Here is the call graph for this function:

◆ GetAlias()

static string QuantConnect.Symbol.GetAlias ( SecurityIdentifier  securityIdentifier,
Symbol  underlying = null 
)
static

Centralized helper method to resolve alias for a symbol

Definition at line 781 of file Symbol.cs.

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

Member Data Documentation

◆ Empty

readonly Symbol QuantConnect.Symbol.Empty = new Symbol(SecurityIdentifier.Empty, string.Empty)
static

Represents an unassigned symbol. This is intended to be used as an uninitialized, default value

Definition at line 44 of file Symbol.cs.

◆ None

readonly Symbol QuantConnect.Symbol.None = new Symbol(SecurityIdentifier.None, "NONE")
static

Represents no symbol. This is intended to be used when no symbol is explicitly intended

Definition at line 49 of file Symbol.cs.

Property Documentation

◆ Canonical

Symbol QuantConnect.Symbol.Canonical
get

Get's the canonical representation of this symbol

This is useful for access and performance

Definition at line 298 of file Symbol.cs.

◆ Value

string QuantConnect.Symbol.Value
get

Gets the current symbol for this ticker

Definition at line 361 of file Symbol.cs.

◆ ID

SecurityIdentifier QuantConnect.Symbol.ID
get

Gets the security identifier for this symbol

Definition at line 367 of file Symbol.cs.

◆ HasUnderlying

bool QuantConnect.Symbol.HasUnderlying
get

Gets whether or not this Symbol is a derivative, that is, it has a valid Underlying property

Definition at line 374 of file Symbol.cs.

◆ Underlying

Symbol QuantConnect.Symbol.Underlying
get

Gets the security underlying symbol, if any

Definition at line 382 of file Symbol.cs.

◆ SecurityType

SecurityType QuantConnect.Symbol.SecurityType
get

Gets the security type of the symbol

Definition at line 389 of file Symbol.cs.

◆ CUSIP

string QuantConnect.Symbol.CUSIP
get

The Committee on Uniform Securities Identification Procedures (CUSIP) number corresponding to this Symbol

Definition at line 396 of file Symbol.cs.

◆ CompositeFIGI

string QuantConnect.Symbol.CompositeFIGI
get

The composite Financial Instrument Global Identifier (FIGI) corresponding to this Symbol

Definition at line 401 of file Symbol.cs.

◆ SEDOL

string QuantConnect.Symbol.SEDOL
get

The Stock Exchange Daily Official List (SEDOL) security identifier corresponding to this Symbol

Definition at line 406 of file Symbol.cs.

◆ ISIN

string QuantConnect.Symbol.ISIN
get

The International Securities Identification Number (ISIN) corresponding to this Symbol

Definition at line 411 of file Symbol.cs.

◆ CIK

int? QuantConnect.Symbol.CIK
get

The Central Index Key number (CIK) corresponding to this Symbol

Definition at line 416 of file Symbol.cs.


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