Balance for bot (#20)

* Add bot balance

* Update amount to trade

* fix initial trading balance

* Update MM modal

* fix backtest

* stop bot if no more balance

* Add constant for minimum trading

* Add constant
This commit is contained in:
Oda
2025-04-28 16:52:42 +02:00
committed by GitHub
parent 967e8410dc
commit 204bd87e6a
39 changed files with 600 additions and 546 deletions

View File

@@ -1,5 +1,5 @@
using MediatR;
using Managing.Domain.Users;
using Managing.Domain.Users;
using MediatR;
using static Managing.Common.Enums;
namespace Managing.Application.ManageBot.Commands
@@ -15,6 +15,7 @@ namespace Managing.Application.ManageBot.Commands
public string AccountName { get; internal set; }
public string MoneyManagementName { get; internal set; }
public User User { get; internal set; }
public decimal InitialTradingBalance { get; internal set; }
public StartBotCommand(BotType botType,
string name,
@@ -24,7 +25,8 @@ namespace Managing.Application.ManageBot.Commands
string accountName,
string moneyManagementName,
User user,
bool isForWatchingOnly = false)
bool isForWatchingOnly = false,
decimal initialTradingBalance = 0)
{
BotType = botType;
Name = name;
@@ -35,6 +37,8 @@ namespace Managing.Application.ManageBot.Commands
AccountName = accountName;
MoneyManagementName = moneyManagementName;
User = user;
InitialTradingBalance = initialTradingBalance > 0 ? initialTradingBalance :
throw new ArgumentException("Initial trading balance must be greater than zero", nameof(initialTradingBalance));
}
}
}