30 new Lazy<SymbolPropertiesDatabase>(Securities.SymbolPropertiesDatabase.FromDataFolder);
44 if (!IsValidSecurityType(currencyPair?.
SecurityType, throwException:
false))
71 IsValidSecurityType(currencyPair?.
SecurityType, throwException:
true);
84 defaultQuoteCurrency);
103 return !
string.IsNullOrEmpty(currencyPair) && currencyPair.Length == 6;
113 if (currencyPair ==
null)
120 return currencyPair.
Value.Length == 6;
131 return currencyPair.
Value.EndsWith(symbolProperties.QuoteCurrency);
146 string quoteCurrency;
160 public static string CurrencyPairDual(
string baseCurrency,
string quoteCurrency,
string knownSymbol)
162 if (baseCurrency == knownSymbol)
164 return quoteCurrency;
167 if (quoteCurrency == knownSymbol)
210 var currencies =
new string[] { baseCurrencyA, quoteCurrencyA, baseCurrencyB, quoteCurrencyB};
211 var isThereAnyMatch =
false;
214 var potentialStableCoins =
new int[][]
222 foreach(var pair
in potentialStableCoins)
229 currencies[pair[0]] = currencies[pair[1]];
230 isThereAnyMatch =
true;
237 pairAValue = currencies[0] + currencies[1];
241 if (pairAValue == baseCurrencyB + quoteCurrencyB)
243 return Match.ExactMatch;
246 if (pairAValue == quoteCurrencyB + baseCurrencyB)
248 return Match.InverseMatch;
251 return Match.NoMatch;
254 public static bool IsValidSecurityType(
SecurityType? securityType,
bool throwException)
256 if (securityType ==
null)
260 throw new ArgumentException(
"Currency pair must not be null");
272 throw new ArgumentException($
"Unsupported security type: {securityType}");