/// <summary> /// Initializes a new instance of the <see cref="SecurityIdentifier"/> class /// </summary> /// <param name="symbol">The base36 string encoded as a long using alpha [0-9A-Z]</param> /// <param name="properties">Other data defining properties of the symbol including market, /// security type, listing or expiry date, strike/call/put/style for options, ect...</param> /// <param name="underlying">Specifies a <see cref="SecurityIdentifier"/> that represents the underlying security</param> public SecurityIdentifier(string symbol, ulong properties, SecurityIdentifier underlying) : this(symbol, properties) { if (symbol == null) { throw new ArgumentNullException("symbol", "SecurityIdentifier requires a non-null string 'symbol'"); } _symbol = symbol; _properties = properties; if (underlying != Empty) { _underlying = new SidBox(underlying); } }
/// <summary> /// Initializes a new instance of the <see cref="SecurityIdentifier"/> class /// </summary> /// <param name="symbol">The base36 string encoded as a long using alpha [0-9A-Z]</param> /// <param name="properties">Other data defining properties of the symbol including market, /// security type, listing or expiry date, strike/call/put/style for options, ect...</param> public SecurityIdentifier(string symbol, ulong properties) { if (symbol == null) { throw new ArgumentNullException("symbol", "SecurityIdentifier requires a non-null string 'symbol'"); } if (symbol.IndexOfAny(InvalidCharacters) != -1) { throw new ArgumentException("symbol must not contain the characters '|' or ' '.", "symbol"); } _symbol = symbol; _properties = properties; _underlying = null; }
/// <summary> /// Initializes a new instance of the <see cref="SecurityIdentifier"/> class /// </summary> /// <param name="symbol">The base36 string encoded as a long using alpha [0-9A-Z]</param> /// <param name="properties">Other data defining properties of the symbol including market, /// security type, listing or expiry date, strike/call/put/style for options, ect...</param> /// <param name="underlying">Specifies a <see cref="SecurityIdentifier"/> that represents the underlying security</param> public SecurityIdentifier(string symbol, ulong properties, SecurityIdentifier underlying) : this(symbol, properties) { if (symbol == null) { throw new ArgumentNullException("symbol", "SecurityIdentifier requires a non-null string 'symbol'"); } _symbol = symbol; _properties = properties; // performance: directly call Equals(SecurityIdentifier other), shortcuts Equals(object other) if (!underlying.Equals(Empty)) { _underlying = new SidBox(underlying); } }
/// <summary> /// Initializes a new instance of the <see cref="SecurityIdentifier"/> class /// </summary> /// <param name="symbol">The base36 string encoded as a long using alpha [0-9A-Z]</param> /// <param name="properties">Other data defining properties of the symbol including market, /// security type, listing or expiry date, strike/call/put/style for options, ect...</param> public SecurityIdentifier(string symbol, ulong properties) { if (symbol == null) { throw new ArgumentNullException("symbol", "SecurityIdentifier requires a non-null string 'symbol'"); } if (symbol.IndexOfAny(InvalidCharacters) != -1) { throw new ArgumentException("symbol must not contain the characters '|' or ' '.", "symbol"); } _symbol = symbol; _properties = properties; _underlying = null; SecurityType = (SecurityType)ExtractFromProperties(SecurityTypeOffset, SecurityTypeWidth, properties); _hashCode = unchecked (symbol.GetHashCode() * 397) ^ properties.GetHashCode(); }
/// <summary> /// Initializes a new instance of the <see cref="SecurityIdentifier"/> class /// </summary> /// <param name="symbol">The base36 string encoded as a long using alpha [0-9A-Z]</param> /// <param name="properties">Other data defining properties of the symbol including market, /// security type, listing or expiry date, strike/call/put/style for options, ect...</param> public SecurityIdentifier(string symbol, ulong properties) { if (symbol == null) { throw new ArgumentNullException(nameof(symbol), "SecurityIdentifier requires a non-null string 'symbol'"); } if (symbol.IndexOfAny(InvalidCharacters) != -1) { throw new ArgumentException("symbol must not contain the characters '|' or ' '.", nameof(symbol)); } _symbol = symbol; _properties = properties; _underlying = null; _strikePrice = -1; SecurityType = (SecurityType)ExtractFromProperties(SecurityTypeOffset, SecurityTypeWidth, properties); if (!Enum.IsDefined(typeof(SecurityType), SecurityType)) { throw new ArgumentException($"The provided properties do not match with a valid {nameof(SecurityType)}", "properties"); } _hashCode = unchecked (symbol.GetHashCode() * 397) ^ properties.GetHashCode(); }