private void Refresh() { if (Monitor.TryEnter(_lock)) { try { List <Prices> latestPrices = BinanceService.ListPrices(); OnExchangeRateReady?.Invoke(latestPrices); lock (_tradeDataCallbacks) { foreach (KeyValuePair <String, Action <List <TradeInfo> > > entry in _tradeDataCallbacks) { if (entry.Value != null) { List <TradeInfo> tradeInfo = BinanceService.GetTrades(entry.Key); entry.Value.Invoke(tradeInfo); } } } } finally { Monitor.Exit(_lock); } } }
public List <TradeInfo> GetTradeHistory(String symbol) { lock (_lock) { return(BinanceService.GetTrades(symbol)); } }