private IReadOnlyList <OrderBook> GetWantedActualOrderBooks() { var result = new List <OrderBook>(); var settings = Settings(); var orderBooks = _orderBooksService.GetAll(); foreach (var orderBook in orderBooks) { // Filter by exchanges if (settings.Exchanges.Any() && !settings.Exchanges.Contains(orderBook.Source)) { continue; } // Filter by base, quote and intermediate assets var assetPair = orderBook.AssetPair; var passed = !settings.IntermediateAssets.Any() || settings.IntermediateAssets.Contains(assetPair.Base) || settings.IntermediateAssets.Contains(assetPair.Quote); if (!passed) { continue; } // Filter by expiration time if (DateTime.UtcNow - orderBook.Timestamp < new TimeSpan(0, 0, 0, settings.ExpirationTimeInSeconds)) { result.Add(orderBook); } } return(result); }
public async Task Execute() { var lykkeOrderBooks = _orderBooksService.GetAll() .Where(x => x.Source.Equals(LykkeExchangeName, StringComparison.InvariantCultureIgnoreCase)).ToList(); var lykkeArbitrages = await GetArbitragesAsync(lykkeOrderBooks); RefreshArbitrages(lykkeArbitrages); }
public IActionResult GetAllAsync() { var orderBooks = _orderBooksService.GetAll(); var model = _mapper.Map <List <OrderBookModel> >(orderBooks); return(Ok(model)); }
public override Task <GetAllOrderBooksResponse> GetAll(Empty request, ServerCallContext context) { var orderBooks = _orderBooksService.GetAll(); var response = new GetAllOrderBooksResponse(); response.OrderBooks.AddRange(_mapper.Map <List <OrderBook> >(orderBooks)); return(Task.FromResult(response)); }