示例#1
0
        public async Task <List <Withdrawal> > GetNewWithdrawals()
        {
            // no api call
            var list = new List <Withdrawal>();

            try
            {
                var binanceClient = GetApi();
                var lastChecked   = _databaseService.GetLastChecked("Binance.DepositCheck");
                using (var user = new BinanceApiUser(_config.Key, _config.Secret))
                {
                    var start            = Helpers.Helpers.DateTimeToUnixTimestamp(lastChecked);
                    var binanceDesposits = await binanceClient.GetWithdrawalsAsync(user, _generalConfig.TradingCurrency, null, start, 0, 10000000);

                    list = BinanceConverter.BinanceToWithdrawals(binanceDesposits);
                }
            }
            catch (Exception e)
            {
                _log.LogError("Error in getting withdrawals from binance: " + e.Message);
            }

            var newWithdrawals = await _databaseService.AddWithdrawals(list, Constants.Binance);

            await _databaseService.AddLastChecked("Binance.WithdrawalCheck", DateTime.Now);

            return(newWithdrawals);
        }
示例#2
0
        public async Task <List <Withdrawal> > GetNewWithdrawals()
        {
            // no api call
            var list = new List <Withdrawal>();

            try
            {
                var binanceClient = GetApi();

                using (var user = new BinanceApiUser(_config.Key, _config.Secret))
                {
                    var binanceDesposits = await binanceClient.GetWithdrawalsAsync(user, "BTC");

                    list = BinanceConverter.BinanceToWithdrawals(binanceDesposits);
                }
            }
            catch (Exception e)
            {
                _log.LogError("Error in getting withdrawals from binance: " + e.Message);
            }

            var newWithdrawals = await _databaseService.AddWithdrawals(list, Constants.Binance);

            await _databaseService.AddLastChecked("Binance.WithdrawalCheck", DateTime.Now);

            return(newWithdrawals);
        }