Files
managing-apps/src/Managing.Application/Abstractions/ITradingBot.cs

49 lines
1.7 KiB
C#

using Managing.Domain.Accounts;
using Managing.Domain.Bots;
using Managing.Domain.Candles;
using Managing.Domain.Indicators;
using Managing.Domain.Trades;
using static Managing.Common.Enums;
namespace Managing.Application.Abstractions
{
public interface ITradingBot
{
TradingBotConfig Config { get; set; }
Account Account { get; set; }
Dictionary<string, LightSignal> Signals { get; set; }
Dictionary<Guid, Position> Positions { get; set; }
Dictionary<DateTime, decimal> WalletBalances { get; set; }
DateTime PreloadSince { get; set; }
int PreloadedCandlesCount { get; set; }
long ExecutionCount { get; set; }
Candle LastCandle { get; set; }
Task Run();
int GetWinRate();
decimal GetProfitAndLoss();
decimal GetTotalFees();
Task LoadAccount();
Task LoadLastCandle();
Task<Position> OpenPositionManually(TradeDirection direction);
Task CloseTrade(LightSignal signal, Position position, Trade tradeToClose, decimal lastPrice,
bool tradeClosingPosition = false);
/// <summary>
/// Gets the current trading bot configuration.
/// </summary>
/// <returns>A copy of the current configuration</returns>
TradingBotConfig GetConfiguration();
/// <summary>
/// Updates the trading bot configuration with new settings.
/// </summary>
/// <param name="newConfig">The new configuration to apply</param>
/// <returns>True if the configuration was successfully updated, false otherwise</returns>
Task<bool> UpdateConfiguration(TradingBotConfig newConfig);
Task LogInformation(string message);
Task LogWarning(string message);
}
}