private void InitExchanges( ) { foreach (var exchange in Exchanges.Values) { exchange.ClearObservers( ); Observers[exchange.Id] = new CryptoExchangeObserver(exchange); exchange.Changed += (e, coin) => { if (!pendingUpdates.Contains(e.Id)) { pendingUpdates.Enqueue(e.Id); } }; var observer = Observers[exchange.Id]; observer.Next += (e, coin) => Logger.Debug($"{e.Name,-10} {e[coin.Symbol]}"); exchange.Subscribe(observer); CompareTable.AddExchange(exchange); try { Task.Run(() => exchange.StartMonitor(cts.Token), cts.Token); } catch (Exception e) { Logger.Error(e); throw; } } }
private void InitExchanges( ) { foreach (var exchange in Exchanges.Values) { //exchange.Next += UpdateExchangeLastUpdateInDb; exchange.Changed += (e, coin) => Logger.Debug($"{e.Name,-10} {e[coin.Id]}"); //exchange.Changed += StoreCoinValueInDb; CompareTable.AddExchange(exchange); try { Task.Run(() => exchange.StartMonitor(Cts.Token), Cts.Token); } catch (Exception e) { Logger.Error(e); throw; } } IsInitialized = true; }