17 using System.Collections.Generic;
19 using System.Globalization;
20 using System.Text.RegularExpressions;
32 public const string USD =
"USD";
37 public const string EUR =
"EUR";
42 public const string GBP =
"GBP";
47 public const string INR =
"INR";
52 public const string IDR =
"IDR";
57 public const string CNH =
"CNH";
62 public const string CHF =
"CHF";
67 public const string HKD =
"HKD";
80 public static readonly IReadOnlyDictionary<string, string>
CurrencySymbols =
new Dictionary<string, string>
152 [Obsolete(
"StablePairsGDAX is deprecated. Use StablePairsCoinbase instead.")]
185 private static readonly HashSet<string> _stableCoinsWithoutPairsCoinbase =
new HashSet<string>
197 private static readonly HashSet<string> _stableCoinsWithoutPairsBinance =
new HashSet<string>
218 private static readonly HashSet<string> _stableCoinsWithoutPairsBitfinex =
new HashSet<string>
231 private static readonly HashSet<string> _stableCoinsWithoutPairsBybit =
new HashSet<string>
246 private static readonly Dictionary<string, HashSet<string>> _stableCoinsWithoutPairsMarkets =
new Dictionary<string, HashSet<string>>
248 { Market.Binance , _stableCoinsWithoutPairsBinance},
249 { Market.Bitfinex , _stableCoinsWithoutPairsBitfinex},
250 { Market.Coinbase, _stableCoinsWithoutPairsCoinbase},
251 { Market.Bybit , _stableCoinsWithoutPairsBybit},
262 if (_stableCoinsWithoutPairsMarkets.TryGetValue(market, out var stableCoins) && stableCoins.Contains(symbol))
276 if (
string.IsNullOrEmpty(currency))
281 return CurrencySymbols.TryGetValue(currency, out var currencySymbol) ? currencySymbol : currency;
290 public static decimal
Parse(
string value)
294 if (!
TryParse(value, out parsedValue))
308 public static bool TryParse(
string value, out decimal parsedValue)
311 value = Regex.Replace(value,
@"^[^\d\s-+]+",
string.Empty);
312 return decimal.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out parsedValue);