Fix decimal in amount to trade
This commit is contained in:
@@ -35,7 +35,8 @@ namespace Managing.Application.Trading.Handlers
|
||||
position.InitiatorIdentifier = request.InitiatorIdentifier;
|
||||
|
||||
// Always use BotTradingBalance directly as the balance to risk
|
||||
decimal balanceToRisk = request.AmountToTrade;
|
||||
// Round to 2 decimal places to prevent precision errors
|
||||
decimal balanceToRisk = Math.Round(request.AmountToTrade, 2);
|
||||
|
||||
// Minimum check
|
||||
if (balanceToRisk < Constants.GMX.Config.MinimumPositionAmount)
|
||||
@@ -105,7 +106,7 @@ namespace Managing.Application.Trading.Handlers
|
||||
if (!request.IsForPaperTrading)
|
||||
{
|
||||
await tradingService.InsertPositionAsync(position);
|
||||
|
||||
|
||||
// Notify platform summary about the opened position
|
||||
try
|
||||
{
|
||||
@@ -119,7 +120,7 @@ namespace Managing.Application.Trading.Handlers
|
||||
Volume = position.Open.Price * position.Open.Quantity * position.Open.Leverage,
|
||||
Direction = position.OriginDirection
|
||||
};
|
||||
|
||||
|
||||
await platformGrain.OnPositionOpenedAsync(positionOpenedEvent);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user