17 using Newtonsoft.Json;
18 using System.Collections.Generic;
30 public static Exchange UNKNOWN {
get; } =
new(
string.Empty,
string.Empty,
"UNKNOWN",
string.Empty);
330 public string Code {
get; init; }
335 public string Name {
get; init; }
345 [JsonProperty(ReferenceLoopHandling = ReferenceLoopHandling.Ignore)]
346 public IReadOnlyList<SecurityType>
SecurityTypes {
get; init; } =
new List<SecurityType>();
359 public Exchange(
string name,
string code,
string description,
string market, params
SecurityType[] securityTypes)
364 SecurityTypes = securityTypes?.ToList() ??
new List<SecurityType>();
365 Code =
string.IsNullOrEmpty(code) ? name : code;
379 public static implicit
operator string(
Exchange exchange)
381 return ReferenceEquals(exchange,
null) ?
string.Empty : exchange.
ToString();
389 if (ReferenceEquals(
this, obj))
394 if (ReferenceEquals(exchange,
null) || ReferenceEquals(exchange,
UNKNOWN))
398 return ReferenceEquals(
this,
UNKNOWN);
401 return Code == exchange.Code
402 &&
Market == exchange.Market
415 if (ReferenceEquals(left, right))
421 return ReferenceEquals(right,
null) || right.
Equals(
UNKNOWN);
423 return left.
Equals(right);
434 return !(left == right);
444 var hashCode =
Code.GetHashCode();
445 hashCode = (hashCode * 397) ^
Market.GetHashCode();