private void WsOnMessage(object sender, MessageEventArgs args) { try { var json = args.Data; var data = JsonConvert.DeserializeObject <dynamic> (json); foreach (var datum in data) { var s = (string)datum.s; var symbol = s.Substring(0, 3); if (!s.EndsWith("USDT")) { continue; } if (symbol == "BCC") { symbol = "BCH"; } if (!KnownSymbols.Contains(symbol)) { continue; } Update(datum, symbol); } } catch (Exception e) { Logger.Error(e); } }
public override async Task GetExchangeData(CancellationToken ct) { ExchangeData = new Dictionary <string, CryptoCoin> ( ); while (!ct.IsCancellationRequested) { var data = await TickerUrl.GetJsonAsync <List <CoinDeltaCoin> > (ct); foreach (var datum in data) { var marketname = datum.MarketName.Split('-'); if (marketname[1] == "inr" && KnownSymbols.Contains(marketname[0].ToUpper( ))) { Update(datum, marketname[0].ToUpper( )); } } await Task.Delay(60000, ct); } }