fix: use actual symbol-specific leverage in notifications

Fixed Telegram notification showing wrong leverage (10x instead of 20x).

Problem:
- SOL trades use SOLANA_LEVERAGE=20x (per-symbol override)
- API response was returning config.leverage (global default 10x)
- n8n workflow displayed incorrect leverage value

Changes:
- Line 345: Use 'leverage' variable (from getPositionSizeForSymbol)
- Line 448: ActiveTrade uses actual leverage
- Line 522: ExecuteTradeResponse uses actual leverage
- Line 557: Database createTrade() uses actual leverage

Now notifications correctly show 20x for SOL trades.
This commit is contained in:
mindesbunister
2025-11-12 11:42:51 +01:00
parent bba58da8fa
commit 74df461556

View File

@@ -342,7 +342,7 @@ export async function POST(request: NextRequest): Promise<NextResponse<ExecuteTr
direction: body.direction, direction: body.direction,
entryPrice: openResult.fillPrice!, entryPrice: openResult.fillPrice!,
positionSizeUSD: positionSizeUSD, positionSizeUSD: positionSizeUSD,
leverage: config.leverage, leverage: leverage, // Use actual symbol-specific leverage
stopLossPrice: 0, // Not applicable for phantom stopLossPrice: 0, // Not applicable for phantom
takeProfit1Price: 0, takeProfit1Price: 0,
takeProfit2Price: 0, takeProfit2Price: 0,
@@ -445,7 +445,7 @@ export async function POST(request: NextRequest): Promise<NextResponse<ExecuteTr
entryPrice, entryPrice,
entryTime: Date.now(), entryTime: Date.now(),
positionSize: positionSizeUSD, positionSize: positionSizeUSD,
leverage: config.leverage, leverage: leverage, // Use actual symbol-specific leverage
stopLossPrice, stopLossPrice,
tp1Price, tp1Price,
tp2Price, tp2Price,
@@ -519,7 +519,7 @@ export async function POST(request: NextRequest): Promise<NextResponse<ExecuteTr
direction: body.direction, direction: body.direction,
entryPrice: entryPrice, entryPrice: entryPrice,
positionSize: positionSizeUSD, positionSize: positionSizeUSD,
leverage: config.leverage, leverage: leverage, // Use actual symbol-specific leverage, not global config
stopLoss: stopLossPrice, stopLoss: stopLossPrice,
takeProfit1: tp1Price, takeProfit1: tp1Price,
takeProfit2: tp2Price, takeProfit2: tp2Price,
@@ -554,7 +554,7 @@ export async function POST(request: NextRequest): Promise<NextResponse<ExecuteTr
direction: body.direction, direction: body.direction,
entryPrice, entryPrice,
positionSizeUSD: positionSizeUSD, positionSizeUSD: positionSizeUSD,
leverage: config.leverage, leverage: leverage, // Use actual symbol-specific leverage, not global config
stopLossPrice, stopLossPrice,
takeProfit1Price: tp1Price, takeProfit1Price: tp1Price,
takeProfit2Price: tp2Price, takeProfit2Price: tp2Price,