public async Task DeleteOrderBookAsync(string assetPairId) { await SynchronizeAsync(async() => { await _lykkeExchange.ApplyAsync(assetPairId, Array.Empty <LimitOrder>()); await _orderBookTraderService.DeleteOrderBookAsync(assetPairId); await _limitOrderService.ClearAsync(assetPairId); } ); }
public Task ApplyOrderBooksAsync() { return(SynchronizeAsync(async() => { foreach (string assetPair in _orderBooks.Keys.ToList()) { if (_orderBooks.TryGetValue(assetPair, out IReadOnlyCollection <LimitOrder> limitOrders)) { try { await _lykkeExchange.ApplyAsync(assetPair, limitOrders); _orderBooks.TryRemove(assetPair, out _); } catch (Exception exception) { _log.Error(exception, "An error occurred while applying order book", assetPair); } LogPrice(assetPair, limitOrders, "Order book applied"); } } })); }