Exemplo n.º 1
0
        private PoloniexCurrency GetPoloniexCurrency(string aTicker)
        {
            PoloniexCurrency lCurrency = null;

            if (!string.IsNullOrEmpty(aTicker) && !FCacheCurrencies.TryGetValue(aTicker, out lCurrency))
            {
                using (PoloniexClient lClient = new PoloniexClient())
                {
                    var lResponse = lClient.GetCurrencies();
                    if (!lResponse.Success)
                    {
                        throw new Exception($"Unable to retrieve Poloniex currency {aTicker}");
                    }
                    foreach (var lPoloniexCurrency in lResponse.Data)
                    {
                        FCacheCurrencies.AddOrUpdate(lPoloniexCurrency.Key, lPoloniexCurrency.Value, (x, y) => lPoloniexCurrency.Value);
                        if (lPoloniexCurrency.Key == aTicker)
                        {
                            lCurrency = lPoloniexCurrency.Value;
                        }
                    }
                }
            }
            return(lCurrency);
        }