Fix a bit bots

This commit is contained in:
2025-04-22 21:17:34 +02:00
parent 42a4cafd8d
commit ec442c4dff
4 changed files with 17 additions and 16 deletions

View File

@@ -42,11 +42,7 @@ namespace Managing.Application.Trading
? request.Price.Value
: exchangeService.GetPrice(account, request.Ticker, DateTime.Now);
var quantity = balanceAtRisk / price;
var fee = request.IsForPaperTrading
? request.Fee.GetValueOrDefault()
: tradingService.GetFee(account, request.IsForPaperTrading);
var expectedStatus = GetExpectedStatus(request);
// var expectedStatus = GetExpectedStatus(request);
// position.Open = TradingPolicies.OpenPosition(expectedStatus).Execute(async () => { });
var openPrice = request.IsForPaperTrading || request.Price.HasValue
@@ -70,7 +66,7 @@ namespace Managing.Application.Trading
stopLossPrice: stopLossPrice, // Pass determined SL price
takeProfitPrice: takeProfitPrice); // Pass determined TP price
trade.Fee = TradingHelpers.GetFeeAmount(fee, openPrice * quantity, account.Exchange);
//trade.Fee = TradingHelpers.GetFeeAmount(fee, openPrice * quantity, account.Exchange);
position.Open = trade;
var closeDirection = request.Direction == TradeDirection.Long
@@ -88,8 +84,8 @@ namespace Managing.Application.Trading
request.Date,
TradeStatus.Requested);
position.StopLoss.Fee = TradingHelpers.GetFeeAmount(fee,
position.StopLoss.Price * position.StopLoss.Quantity, account.Exchange);
// position.StopLoss.Fee = TradingHelpers.GetFeeAmount(fee,
// position.StopLoss.Price * position.StopLoss.Quantity, account.Exchange);
// Take profit - Use the determined price
position.TakeProfit1 = exchangeService.BuildEmptyTrade(