Esempio n. 1
0
        public async Task <List <Trade> > GetOrderHistory(DateTime lastChecked)
        {
            var list = new List <Trade>();

            try
            {
                var symbols = await _binanceWebsocketService.GetSymbolStringsAsync();

                foreach (var symbol in symbols)
                {
                    var response = await _binanceWebsocketService.GetAccountTradesAsync(symbol);

                    var ccy2 = symbol.Remove(symbol.Length - _generalConfig.TradingCurrency.Length);

                    var symlist = BinanceConverter.BinanceToTrades(response, _generalConfig.TradingCurrency, ccy2, _log);
                    list.AddRange(symlist);
                }
            }
            catch (Exception e)
            {
                _log.LogError("Error in getting trades from binance: " + e.Message);
            }

            return(list);
        }
Esempio n. 2
0
        public async Task <List <Trade> > GetOrderHistory(DateTime lastChecked)
        {
            var list = new List <Trade>();

            try
            {
                var binanceClient = GetApi();

                using (var user = new BinanceApiUser(_config.Key, _config.Secret))
                {
                    foreach (var symbol in _symbols)
                    {
                        var response = await binanceClient.GetAccountTradesAsync(user, symbol);

                        var ccy2 = symbol.Remove(symbol.Length - _generalConfig.TradingCurrency.Length);

                        var symlist = BinanceConverter.BinanceToTrades(response, _generalConfig.TradingCurrency, ccy2, _log);
                        list.AddRange(symlist);
                    }
                }
            }
            catch (Exception e)
            {
                _log.LogError("Error in getting trades from binance: " + e.Message);
            }

            return(list);
        }