17 using Newtonsoft.Json;
18 using System.Collections.Generic;
30 public static Exchange UNKNOWN {
get; } =
new (
string.Empty,
string.Empty,
"UNKNOWN",
string.Empty);
280 public string Code {
get; init; }
285 public string Name {
get; init; }
295 [JsonProperty(ReferenceLoopHandling = ReferenceLoopHandling.Ignore)]
296 public IReadOnlyList<SecurityType>
SecurityTypes {
get; init; } =
new List<SecurityType>();
309 private Exchange(
string name,
string code,
string description,
string market, params
SecurityType[] securityTypes)
314 SecurityTypes = securityTypes?.ToList() ??
new List<SecurityType>();
315 Code =
string.IsNullOrEmpty(code) ? name : code;
329 public static implicit
operator string(
Exchange exchange)
331 return ReferenceEquals(exchange,
null) ?
string.Empty : exchange.
ToString();
339 if (ReferenceEquals(
this, obj))
344 if (ReferenceEquals(exchange,
null) || ReferenceEquals(exchange,
UNKNOWN))
348 return ReferenceEquals(
this,
UNKNOWN);
351 return Code == exchange.Code
352 &&
Market == exchange.Market
365 if (ReferenceEquals(left, right))
371 return ReferenceEquals(right,
null) || right.
Equals(
UNKNOWN);
373 return left.
Equals(right);
384 return !(left == right);
394 var hashCode =
Code.GetHashCode();
395 hashCode = (hashCode * 397) ^
Market.GetHashCode();