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); }
public async Task <IEnumerable <PoloniexCurrency> > GetCurrencies(CancellationToken token = default(CancellationToken)) { return(await RetryHelper.DoAsync(async() => { JObject jobject = await JObjectQuery(PublicUrl + "?command=returnCurrencies", token); return PoloniexCurrency.GetFromJObject(jobject); }, TimeSpan.FromMilliseconds(Constant.DefaultRetryInterval))); }