public async void Simulation() { ServiceResponse resp = new ServiceResponse(0, "OK"); while (resp.Success) { resp = await _bot.BuyIfConditionsMet(); await _bot.SellIfConditionsMet(); } var profit = await _db.GetProfit(_session.BaseCoin, _session.TargetCoin, _session.Stock); var remaining = await _db.GetUnsoldTransactions(_session.BaseCoin, _session.TargetCoin, _session.Stock); _logger.LogInformation($"Bot has made {profit.Data}"); _logger.LogInformation($"Bot didn't manage to sell a remaining {remaining.Data.Sum(x=> x.QuantityBought)} BTC"); }
public async Task BuyMonitor() { while (true) { try { var response = await _bot.BuyIfConditionsMet(); _logger.LogTrace(response.Message); await Task.Delay(TimeSpan.FromSeconds(_session.Interval)); } catch (Exception ex) { _logger.LogCritical(ex, ex.Message); Program.CoinbotCancellationToken.Cancel(); //logger.Info("There has been problem with buy sequence, please check logs. Application is exiting ..."); //Environment.Exit(0); } } }