Exemplo n.º 1
0
        public async Task <List <Deposit> > GetNewDeposits()
        {
            var list = new List <Deposit>();

            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.GetDepositsAsync(user,
                                                                                _generalConfig.TradingCurrency, null, start, 0, 10000000);

                    list = BinanceConverter.BinanceToDeposits(binanceDesposits);
                }
            }
            catch (Exception e)
            {
                _log.LogError("Error in getting deposits from Binance: " + e.Message);
            }

            var newDeposits = await _databaseService.AddDeposits(list, Constants.Binance);

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

            return(newDeposits);
        }
Exemplo n.º 2
0
        public async Task <List <Deposit> > GetNewDeposits()
        {
            var list = new List <Deposit>();

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

                    list = BinanceConverter.BinanceToDeposits(binanceDesposits);
                }
            }
            catch (Exception e)
            {
                _log.LogError("Error in getting deposits from Binance: " + e.Message);
            }

            var newDeposits = await _databaseService.AddDeposits(list, Constants.Binance);

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

            return(newDeposits);
        }