public async Task <List <OpenOrder> > GetNewOpenOrders(DateTime lastChecked) { var openOrders = new List <OpenOrder>(); try { var symbols = await _binanceWebsocketService.GetSymbolStringsAsync(); foreach (var symbol in symbols) { var response = await _binanceWebsocketService.GetOpenOrdersAsync(symbol); var ccy2 = symbol.Remove(symbol.Length - _generalConfig.TradingCurrency.Length); var list = BinanceConverter.BinanceToOpenOrders(response, _generalConfig.TradingCurrency, ccy2); openOrders.AddRange(list); } } catch (Exception e) { _log.LogError("Error in getting openOrders from binance: " + e.Message); } var newOrders = await _databaseService.AddOpenOrders(openOrders); return(newOrders); }
public async Task <List <OpenOrder> > GetNewOpenOrders(DateTime lastChecked) { var openOrders = new List <OpenOrder>(); try { var binanceClient = GetApi(); using (var user = new BinanceApiUser(_config.Key, _config.Secret)) { foreach (var symbol in _symbols) { var response = await binanceClient.GetOpenOrdersAsync(user, symbol); var ccy2 = symbol.Remove(symbol.Length - _generalConfig.TradingCurrency.Length); var list = BinanceConverter.BinanceToOpenOrders(response, _generalConfig.TradingCurrency, ccy2); openOrders.AddRange(list); } } } catch (Exception e) { _log.LogError("Error in getting openOrders from binance: " + e.Message); } var newOrders = await _databaseService.AddOpenOrders(openOrders); return(newOrders); }