Fix getbalance + fix get orders for bot

This commit is contained in:
2025-04-21 12:15:53 +02:00
parent 3113e5d278
commit 868c7bdb65
13 changed files with 140 additions and 90 deletions

View File

@@ -171,7 +171,7 @@ public class TradingBot : Bot, ITradingBot
{
Logger.LogInformation($"____________________{Name}____________________");
Logger.LogInformation(
$"Time : {DateTime.Now} - Server time {DateTime.Now.ToUniversalTime()} - Bot : {Name} - Type {BotType} - Ticker : {Ticker}");
$"Time : {DateTime.Now} - Server time {DateTime.Now.ToUniversalTime()} - Last candle : {OptimizedCandles.Last().Date} - Bot : {Name} - Type {BotType} - Ticker : {Ticker}");
}
var previousLastCandle = OptimizedCandles.LastOrDefault();
@@ -646,11 +646,10 @@ public class TradingBot : Bot, ITradingBot
{
try
{
var test = await ExchangeService.CancelOrder(Account, Ticker);
var openOrders = await ExchangeService.GetOpenOrders(Account, Ticker);
if (openOrders.Any())
{
// TODO: Check if position is open, do not cancel orders if position still open
Logger.LogInformation($"Canceling all orders for {Ticker}");
await ExchangeService.CancelOrder(Account, Ticker);
var closePendingOrderStatus = await ExchangeService.CancelOrder(Account, Ticker);