diff --git a/src/Managing.Application/Bots/BacktestFuturesBot.cs b/src/Managing.Application/Bots/BacktestFuturesBot.cs new file mode 100644 index 00000000..7aaaa1d6 --- /dev/null +++ b/src/Managing.Application/Bots/BacktestFuturesBot.cs @@ -0,0 +1,5 @@ +namespace Managing.Application.Bots; + +public class BacktestFuturesBot +{ +} \ No newline at end of file diff --git a/src/Managing.Application/Bots/FuturesBot.cs b/src/Managing.Application/Bots/FuturesBot.cs new file mode 100644 index 00000000..54398b7b --- /dev/null +++ b/src/Managing.Application/Bots/FuturesBot.cs @@ -0,0 +1,5 @@ +namespace Managing.Application.Bots; + +public class FuturesBot +{ +} \ No newline at end of file diff --git a/src/Managing.Application/Bots/TradingBotGrainState.cs b/src/Managing.Application/Bots/Models/TradingBotGrainState.cs similarity index 100% rename from src/Managing.Application/Bots/TradingBotGrainState.cs rename to src/Managing.Application/Bots/Models/TradingBotGrainState.cs diff --git a/src/Managing.Application/Bots/TradingBotBase.cs b/src/Managing.Application/Bots/TradingBotBase.cs index 56af15b1..b90dfb02 100644 --- a/src/Managing.Application/Bots/TradingBotBase.cs +++ b/src/Managing.Application/Bots/TradingBotBase.cs @@ -2727,51 +2727,6 @@ public class TradingBotBase : ITradingBot } } - /// - /// Gets the trade that was used to close the position - /// - /// The position to check - /// The closing trade, or null if none found - private Trade GetClosingTrade(Position position) - { - // Check which trade was used to close the position - if (position.StopLoss?.Status == TradeStatus.Filled) - { - return position.StopLoss; - } - else if (position.TakeProfit1?.Status == TradeStatus.Filled) - { - return position.TakeProfit1; - } - else if (position.TakeProfit2?.Status == TradeStatus.Filled) - { - return position.TakeProfit2; - } - - // If no specific closing trade is found, create a synthetic one based on the position - // This handles cases where the position was closed manually or by the exchange - if (position.ProfitAndLoss?.Realized != null) - { - var closeDirection = position.OriginDirection == TradeDirection.Long - ? TradeDirection.Short - : TradeDirection.Long; - return new Trade( - DateTime.UtcNow, - closeDirection, - TradeStatus.Filled, - TradeType.StopMarket, - position.Ticker, - position.Open.Quantity, - position.Open.Price, // Use open price as approximation - position.Open.Leverage, - "synthetic-close", - "Position closed" - ); - } - - return null; - } - /// /// Notifies both AgentGrain and PlatformSummaryGrain about bot events using unified event data ///