Fixes for bots running (#22)

* Fixes for bots running

* Up botmanager

* Add cooldown

* Refact can open position

* Add cooldown Period and MaxLossStreak

* Add agentName

* Add env variable for botManager

* Always enable Botmanager

* Fix bot handle

* Fix get positions

* Add Ticker url

* Dont start stopped bot

* fix
This commit is contained in:
Oda
2025-05-09 17:40:31 +02:00
committed by GitHub
parent a8eb0aaf02
commit 7c38c27b4a
54 changed files with 5164 additions and 641 deletions

View File

@@ -1,44 +1,20 @@
using Managing.Domain.Users;
using Managing.Application.Bots;
using Managing.Domain.Users;
using MediatR;
using static Managing.Common.Enums;
namespace Managing.Application.ManageBot.Commands
{
public class StartBotCommand : IRequest<string>
{
public string Name { get; }
public BotType BotType { get; }
public Ticker Ticker { get; internal set; }
public Timeframe Timeframe { get; internal set; }
public bool IsForWatchingOnly { get; internal set; }
public string Scenario { get; internal set; }
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 TradingBotConfig Config { get; }
public User User { get; }
public StartBotCommand(BotType botType,
string name,
Ticker ticker,
string scenario,
Timeframe timeframe,
string accountName,
string moneyManagementName,
User user,
bool isForWatchingOnly = false,
decimal initialTradingBalance = 0)
public StartBotCommand(TradingBotConfig config, string name, User user)
{
BotType = botType;
Config = config;
Name = name;
Scenario = scenario;
Ticker = ticker;
Timeframe = timeframe;
IsForWatchingOnly = isForWatchingOnly;
AccountName = accountName;
MoneyManagementName = moneyManagementName;
User = user;
InitialTradingBalance = initialTradingBalance > 0 ? initialTradingBalance :
throw new ArgumentException("Initial trading balance must be greater than zero", nameof(initialTradingBalance));
}
}
}