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";
72 public const string JPY =
"JPY";
85 public static readonly IReadOnlyDictionary<string, string>
CurrencySymbols =
new Dictionary<string, string>
157 [Obsolete(
"StablePairsGDAX is deprecated. Use StablePairsCoinbase instead.")]
190 private static readonly HashSet<string> _stableCoinsWithoutPairsCoinbase =
new HashSet<string>
202 private static readonly HashSet<string> _stableCoinsWithoutPairsBinance =
new HashSet<string>
223 private static readonly HashSet<string> _stableCoinsWithoutPairsBitfinex =
new HashSet<string>
236 private static readonly HashSet<string> _stableCoinsWithoutPairsBybit =
new HashSet<string>
251 private static readonly Dictionary<string, HashSet<string>> _stableCoinsWithoutPairsMarkets =
new Dictionary<string, HashSet<string>>
253 { Market.Binance , _stableCoinsWithoutPairsBinance},
254 { Market.Bitfinex , _stableCoinsWithoutPairsBitfinex},
255 { Market.Coinbase, _stableCoinsWithoutPairsCoinbase},
256 { Market.Bybit , _stableCoinsWithoutPairsBybit},
267 if (_stableCoinsWithoutPairsMarkets.TryGetValue(market, out var stableCoins) && stableCoins.Contains(symbol))
281 if (
string.IsNullOrEmpty(currency))
286 return CurrencySymbols.TryGetValue(currency, out var currencySymbol) ? currencySymbol : currency;
295 public static decimal
Parse(
string value)
299 if (!
TryParse(value, out parsedValue))
313 public static bool TryParse(
string value, out decimal parsedValue)
316 value = Regex.Replace(value,
@"^[^\d\s-+]+",
string.Empty);
317 return decimal.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out parsedValue);