Lean
$LEAN_TAG$
|
Defines a unique identifier for securities More...
Public Member Functions | |
SecurityIdentifier (string symbol, ulong properties) | |
Initializes a new instance of the SecurityIdentifier class More... | |
SecurityIdentifier (string symbol, ulong properties, SecurityIdentifier underlying) | |
Initializes a new instance of the SecurityIdentifier class More... | |
int | CompareTo (SecurityIdentifier other) |
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... | |
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... | |
bool | Equals (SecurityIdentifier other) |
Indicates whether the current object is equal to another object of the same type. 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... | |
override string | ToString () |
Returns a string that represents the current object. More... | |
Static Public Member Functions | |
static SecurityIdentifier | GenerateOption (DateTime expiry, SecurityIdentifier underlying, string market, decimal strike, OptionRight optionRight, OptionStyle optionStyle) |
Generates a new SecurityIdentifier for an option More... | |
static SecurityIdentifier | GenerateOption (DateTime expiry, SecurityIdentifier underlying, string targetOption, string market, decimal strike, OptionRight optionRight, OptionStyle optionStyle) |
Generates a new SecurityIdentifier for an option More... | |
static SecurityIdentifier | GenerateFuture (DateTime expiry, string symbol, string market) |
Generates a new SecurityIdentifier for a future More... | |
static SecurityIdentifier | GenerateEquity (string symbol, string market, bool mapSymbol=true, IMapFileProvider mapFileProvider=null, DateTime? mappingResolveDate=null) |
Helper overload that will search the mapfiles to resolve the first date. This implementation uses the configured IMapFileProvider via the Composer.Instance More... | |
static string | Ticker (Symbol symbol, DateTime date) |
For the given symbol will resolve the ticker it used at the requested date More... | |
static SecurityIdentifier | GenerateEquity (DateTime date, string symbol, string market) |
Generates a new SecurityIdentifier for an equity More... | |
static SecurityIdentifier | GenerateConstituentIdentifier (string symbol, SecurityType securityType, string market) |
Generates a new SecurityIdentifier for a ConstituentsUniverseData. Note that the symbol ticker is case sensitive here. More... | |
static string | GenerateBaseSymbol (Type dataType, string symbol) |
Generates the Symbol property for QuantConnect.SecurityType.Base security identifiers More... | |
static bool | TryGetCustomDataType (string symbol, out string type) |
Tries to fetch the custom data type associated with a symbol More... | |
static bool | TryGetCustomDataTypeInstance (string symbol, out Type type) |
Tries to fetch the custom data type associated with a symbol More... | |
static SecurityIdentifier | GenerateBase (Type dataType, string symbol, string market, bool mapSymbol=false, DateTime? date=null) |
Generates a new SecurityIdentifier for a custom security with the option of providing the first date More... | |
static SecurityIdentifier | GenerateForex (string symbol, string market) |
Generates a new SecurityIdentifier for a forex pair More... | |
static SecurityIdentifier | GenerateCrypto (string symbol, string market) |
Generates a new SecurityIdentifier for a Crypto pair More... | |
static SecurityIdentifier | GenerateCryptoFuture (DateTime expiry, string symbol, string market) |
Generates a new SecurityIdentifier for a CryptoFuture pair More... | |
static SecurityIdentifier | GenerateCfd (string symbol, string market) |
Generates a new SecurityIdentifier for a CFD security More... | |
static SecurityIdentifier | GenerateIndex (string symbol, string market) |
Generates a new SecurityIdentifier for a INDEX security More... | |
static SecurityIdentifier | Parse (string value) |
Parses the specified string into a SecurityIdentifier The string must be a 40 digit number. The first 20 digits must be parseable to a 64 bit unsigned integer and contain ancillary data about the security. The second 20 digits must also be parseable as a 64 bit unsigned integer and contain the symbol encoded from base36, this provides for 12 alpha numeric case insensitive characters. More... | |
static bool | TryParse (string value, out SecurityIdentifier identifier) |
Attempts to parse the specified as a SecurityIdentifier. More... | |
static bool | operator== (SecurityIdentifier left, SecurityIdentifier right) |
Override equals operator More... | |
static bool | operator!= (SecurityIdentifier left, SecurityIdentifier right) |
Override not equals operator More... | |
Static Public Attributes | |
static readonly SecurityIdentifier | Empty = new SecurityIdentifier(string.Empty, 0) |
Gets an instance of SecurityIdentifier that is empty, that is, one with no symbol specified More... | |
static readonly SecurityIdentifier | None = new SecurityIdentifier("NONE", 0) |
Gets an instance of SecurityIdentifier that is explicitly no symbol More... | |
static readonly DateTime | DefaultDate = DateTime.FromOADate(0) |
Gets the date to be used when it does not apply. More... | |
static readonly HashSet< char > | InvalidSymbolCharacters = new HashSet<char>(InvalidCharacters) |
Gets the set of invalids symbol characters More... | |
Properties | |
bool | HasUnderlying [get] |
Gets whether or not this SecurityIdentifier is a derivative, that is, it has a valid Underlying property More... | |
SecurityIdentifier | Underlying [get] |
Gets the underlying security identifier for this security identifier. When there is no underlying, this property will return a value of Empty. More... | |
DateTime | Date [get] |
Gets the date component of this identifier. For equities this is the first date the security traded. Technically speaking, in LEAN, this is the first date mentioned in the map_files. For futures and options this is the expiry date of the contract. For other asset classes, this property will throw an exception as the field is not specified. More... | |
string | Symbol [get] |
Gets the original symbol used to generate this security identifier. For equities, by convention this is the first ticker symbol for which the security traded More... | |
string?? | Market [get] |
Gets the market component of this security identifier. If located in the internal mappings, the full string is returned. If the value is unknown, the integer value is returned as a string. More... | |
SecurityType | SecurityType [get] |
Gets the security type component of this security identifier. More... | |
decimal | StrikePrice [get] |
Gets the option strike price. This only applies if SecurityType is Option, IndexOption or FutureOption and will thrown anexception if accessed otherwise. More... | |
OptionRight | OptionRight [get] |
Gets the option type component of this security identifier. This only applies if SecurityType is Option, IndexOption or FutureOption and will throw an exception if accessed otherwise. More... | |
OptionStyle | OptionStyle [get] |
Gets the option style component of this security identifier. This only applies if SecurityType is Option, IndexOption or FutureOption and will throw an exception if accessed otherwise. More... | |
Defines a unique identifier for securities
The SecurityIdentifier contains information about a specific security. This includes the symbol and other data specific to the SecurityType. The symbol is limited to 12 characters
Definition at line 42 of file SecurityIdentifier.cs.
QuantConnect.SecurityIdentifier.SecurityIdentifier | ( | string | symbol, |
ulong | properties | ||
) |
Initializes a new instance of the SecurityIdentifier class
symbol | The base36 string encoded as a long using alpha [0-9A-Z] |
properties | Other data defining properties of the symbol including market, security type, listing or expiry date, strike/call/put/style for options, ect... |
Definition at line 317 of file SecurityIdentifier.cs.
QuantConnect.SecurityIdentifier.SecurityIdentifier | ( | string | symbol, |
ulong | properties, | ||
SecurityIdentifier | underlying | ||
) |
Initializes a new instance of the SecurityIdentifier class
symbol | The base36 string encoded as a long using alpha [0-9A-Z] |
properties | Other data defining properties of the symbol including market, security type, listing or expiry date, strike/call/put/style for options, ect... |
underlying | Specifies a SecurityIdentifier that represents the underlying security |
Definition at line 350 of file SecurityIdentifier.cs.
|
static |
Generates a new SecurityIdentifier for an option
expiry | The date the option expires |
underlying | The underlying security's symbol |
market | The market |
strike | The strike price |
optionRight | The option type, call or put |
optionStyle | The option style, American or European |
Definition at line 380 of file SecurityIdentifier.cs.
|
static |
Generates a new SecurityIdentifier for an option
expiry | The date the option expires |
underlying | The underlying security's symbol |
targetOption | The 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 |
market | The market |
strike | The strike price |
optionRight | The option type, call or put |
optionStyle | The option style, American or European |
Definition at line 401 of file SecurityIdentifier.cs.
|
static |
Generates a new SecurityIdentifier for a future
expiry | The date the future expires |
symbol | The security's symbol |
market | The market |
Definition at line 434 of file SecurityIdentifier.cs.
|
static |
Helper overload that will search the mapfiles to resolve the first date. This implementation uses the configured IMapFileProvider via the Composer.Instance
symbol | The symbol as it is known today |
market | The market |
mapSymbol | Specifies if symbol should be mapped using map file provider |
mapFileProvider | Specifies the IMapFileProvider to use for resolving symbols, specify null to load from Composer |
mappingResolveDate | The date to use to resolve the map file. Default value is DateTime.Today |
Definition at line 451 of file SecurityIdentifier.cs.
|
static |
For the given symbol will resolve the ticker it used at the requested date
symbol | The symbol to get the ticker for |
date | The date to map the symbol to |
Definition at line 470 of file SecurityIdentifier.cs.
|
static |
Generates a new SecurityIdentifier for an equity
date | The first date this security traded (in LEAN this is the first date in the map_file |
symbol | The ticker symbol this security traded under on the date |
market | The security's market |
Definition at line 490 of file SecurityIdentifier.cs.
|
static |
Generates a new SecurityIdentifier for a ConstituentsUniverseData. Note that the symbol ticker is case sensitive here.
symbol | The ticker to use for this constituent identifier |
securityType | The security type of this constituent universe |
market | The security's market |
This method is special in the sense that it does not force the Symbol to be upper which is required to determine the source file of the constituent ConstituentsUniverseData.GetSource(Data.SubscriptionDataConfig,DateTime,bool)
Definition at line 506 of file SecurityIdentifier.cs.
|
static |
Generates the Symbol property for QuantConnect.SecurityType.Base security identifiers
dataType | The base data custom data type if namespacing is required, null otherwise |
symbol | The ticker symbol |
Definition at line 517 of file SecurityIdentifier.cs.
|
static |
Tries to fetch the custom data type associated with a symbol
Custom data type SecurityIdentifier symbol value holds their data type
Definition at line 532 of file SecurityIdentifier.cs.
|
static |
Tries to fetch the custom data type associated with a symbol
Custom data type SecurityIdentifier symbol value holds their data type
Definition at line 551 of file SecurityIdentifier.cs.
|
static |
Generates a new SecurityIdentifier for a custom security with the option of providing the first date
dataType | The custom data type |
symbol | The ticker symbol of this security |
market | The security's market |
mapSymbol | Whether or not we should map this symbol |
date | First date that the security traded on |
Definition at line 566 of file SecurityIdentifier.cs.
|
static |
Generates a new SecurityIdentifier for a forex pair
symbol | The currency pair in the format similar to: 'EURUSD' |
market | The security's market |
Definition at line 592 of file SecurityIdentifier.cs.
|
static |
Generates a new SecurityIdentifier for a Crypto pair
symbol | The currency pair in the format similar to: 'EURUSD' |
market | The security's market |
Definition at line 603 of file SecurityIdentifier.cs.
|
static |
Generates a new SecurityIdentifier for a CryptoFuture pair
expiry | The date the future expires |
symbol | The currency pair in the format similar to: 'EURUSD' |
market | The security's market |
Definition at line 615 of file SecurityIdentifier.cs.
|
static |
Generates a new SecurityIdentifier for a CFD security
symbol | The CFD contract symbol |
market | The security's market |
Definition at line 626 of file SecurityIdentifier.cs.
|
static |
Generates a new SecurityIdentifier for a INDEX security
symbol | The Index contract symbol |
market | The security's market |
Definition at line 637 of file SecurityIdentifier.cs.
|
static |
Parses the specified string into a SecurityIdentifier The string must be a 40 digit number. The first 20 digits must be parseable to a 64 bit unsigned integer and contain ancillary data about the security. The second 20 digits must also be parseable as a 64 bit unsigned integer and contain the symbol encoded from base36, this provides for 12 alpha numeric case insensitive characters.
value | The string value to be parsed |
FormatException | This exception is thrown if the string's length is not exactly 40 characters, or if the components are unable to be parsed as 64 bit unsigned integers |
Definition at line 806 of file SecurityIdentifier.cs.
|
static |
Attempts to parse the specified as a SecurityIdentifier.
value | The string value to be parsed |
identifier | The result of parsing, when this function returns true, identifier was properly created and reflects the input string, when this function returns false identifier will equal default(SecurityIdentifier) |
Definition at line 826 of file SecurityIdentifier.cs.
int QuantConnect.SecurityIdentifier.CompareTo | ( | SecurityIdentifier | other | ) |
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.
other | An object to compare with this instance. |
Definition at line 982 of file SecurityIdentifier.cs.
int QuantConnect.SecurityIdentifier.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.
obj | An object to compare with this instance. |
T:System.ArgumentException | obj is not the same type as this instance. |
Definition at line 1002 of file SecurityIdentifier.cs.
bool QuantConnect.SecurityIdentifier.Equals | ( | SecurityIdentifier | other | ) |
Indicates whether the current object is equal to another object of the same type.
other | An object to compare with this object. |
Definition at line 1029 of file SecurityIdentifier.cs.
override bool QuantConnect.SecurityIdentifier.Equals | ( | object | obj | ) |
Determines whether the specified T:System.Object is equal to the current T:System.Object.
obj | The object to compare with the current object. |
<filterpriority>2</filterpriority>
Definition at line 1043 of file SecurityIdentifier.cs.
override int QuantConnect.SecurityIdentifier.GetHashCode | ( | ) |
Serves as a hash function for a particular type.
<filterpriority>2</filterpriority>
Definition at line 1057 of file SecurityIdentifier.cs.
|
static |
Override equals operator
Definition at line 1070 of file SecurityIdentifier.cs.
|
static |
Override not equals operator
Definition at line 1078 of file SecurityIdentifier.cs.
override string QuantConnect.SecurityIdentifier.ToString | ( | ) |
Returns a string that represents the current object.
<filterpriority>2</filterpriority>
Definition at line 1090 of file SecurityIdentifier.cs.
|
static |
Gets an instance of SecurityIdentifier that is empty, that is, one with no symbol specified
Definition at line 54 of file SecurityIdentifier.cs.
|
static |
Gets an instance of SecurityIdentifier that is explicitly no symbol
Definition at line 59 of file SecurityIdentifier.cs.
|
static |
Gets the date to be used when it does not apply.
Definition at line 64 of file SecurityIdentifier.cs.
|
static |
Gets the set of invalids symbol characters
Definition at line 69 of file SecurityIdentifier.cs.
|
get |
Gets whether or not this SecurityIdentifier is a derivative, that is, it has a valid Underlying property
Definition at line 131 of file SecurityIdentifier.cs.
|
get |
Gets the underlying security identifier for this security identifier. When there is no underlying, this property will return a value of Empty.
Definition at line 140 of file SecurityIdentifier.cs.
|
get |
Gets the date component of this identifier. For equities this is the first date the security traded. Technically speaking, in LEAN, this is the first date mentioned in the map_files. For futures and options this is the expiry date of the contract. For other asset classes, this property will throw an exception as the field is not specified.
Definition at line 160 of file SecurityIdentifier.cs.
|
get |
Gets the original symbol used to generate this security identifier. For equities, by convention this is the first ticker symbol for which the security traded
Definition at line 193 of file SecurityIdentifier.cs.
|
get |
Gets the market component of this security identifier. If located in the internal mappings, the full string is returned. If the value is unknown, the integer value is returned as a string.
Definition at line 203 of file SecurityIdentifier.cs.
|
get |
Gets the security type component of this security identifier.
Definition at line 221 of file SecurityIdentifier.cs.
|
get |
Gets the option strike price. This only applies if SecurityType is Option, IndexOption or FutureOption and will thrown anexception if accessed otherwise.
Definition at line 228 of file SecurityIdentifier.cs.
|
get |
Gets the option type component of this security identifier. This only applies if SecurityType is Option, IndexOption or FutureOption and will throw an exception if accessed otherwise.
Definition at line 266 of file SecurityIdentifier.cs.
|
get |
Gets the option style component of this security identifier. This only applies if SecurityType is Option, IndexOption or FutureOption and will throw an exception if accessed otherwise.
Definition at line 289 of file SecurityIdentifier.cs.