From b82ceb49a43cbd9d1427603f983b98be14b7001d Mon Sep 17 00:00:00 2001 From: mindesbunister Date: Mon, 27 Oct 2025 01:06:51 +0100 Subject: [PATCH] feat: add position size and leverage to Telegram confirmation message --- .env | 2 +- Money_Machine.json | 4 ++-- app/api/trading/execute/route.ts | 2 ++ docker-compose.yml | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.env b/.env index fe1eb88..143b96e 100644 --- a/.env +++ b/.env @@ -105,7 +105,7 @@ TAKE_PROFIT_2_PERCENT=0.8 # Take Profit 2 Size: What % of remaining position to close at TP2 # Example: 100 = close all remaining position -TAKE_PROFIT_2_SIZE_PERCENT=100 +TAKE_PROFIT_2_SIZE_PERCENT=50 # Emergency Stop: Hard stop if this level is breached # Example: -2.0% on 10x = -20% account loss (rare but protects from flash crashes) diff --git a/Money_Machine.json b/Money_Machine.json index 122dd26..849ce50 100644 --- a/Money_Machine.json +++ b/Money_Machine.json @@ -176,7 +176,7 @@ "values": [ { "name": "message", - "stringValue": "🟢 TRADE OPENED\\n\\nšŸ“Š Symbol: {{ $('Parse Signal').item.json.symbol }}\\n{{ $('Parse Signal').item.json.direction === 'long' ? 'šŸ“ˆ' : 'šŸ“‰' }} Direction: {{ $('Parse Signal').item.json.direction.toUpperCase() }}\\nā° Time: {{ $now.toFormat('HH:mm:ss') }}\\n\\nāœ… Position is being monitored" + "stringValue": "🟢 TRADE OPENED\\n\\nšŸ“Š Symbol: {{ $('Parse Signal').item.json.symbol }}\\n{{ $('Parse Signal').item.json.direction === 'long' ? 'šŸ“ˆ' : 'šŸ“‰' }} Direction: {{ $('Parse Signal').item.json.direction.toUpperCase() }}\\n\\nšŸ’µ Position: ${{ $('Execute Trade').item.json.positionSize }}\\n⚔ Leverage: {{ $('Execute Trade').item.json.leverage }}x\\n\\nšŸ’° Entry: ${{ $('Execute Trade').item.json.entryPrice.toFixed(4) }}\\nšŸŽÆ TP1: ${{ $('Execute Trade').item.json.takeProfit1.toFixed(4) }} ({{ $('Execute Trade').item.json.tp1Percent }}%)\\nšŸŽÆ TP2: ${{ $('Execute Trade').item.json.takeProfit2.toFixed(4) }} ({{ $('Execute Trade').item.json.tp2Percent }}%)\\nšŸ›‘ SL: ${{ $('Execute Trade').item.json.stopLoss.toFixed(4) }} ({{ $('Execute Trade').item.json.stopLossPercent }}%)\\n\\nā° {{ $now.toFormat('HH:mm:ss') }}\\nāœ… Position monitored" } ] }, @@ -259,7 +259,7 @@ { "parameters": { "chatId": "579304651", - "text": "={{ `🟢 TRADE OPENED\\n\\nšŸ“Š Symbol: ${$('Parse Signal').item.json.symbol}\\n${$('Parse Signal').item.json.direction === 'long' ? 'šŸ“ˆ' : 'šŸ“‰'} Direction: ${$('Parse Signal').item.json.direction.toUpperCase()}\\n\\nšŸ’° Entry: $${$json.entryPrice.toFixed(4)}\\nšŸŽÆ TP1: $${$json.takeProfit1.toFixed(4)} (${$json.tp1Percent}%)\\nšŸŽÆ TP2: $${$json.takeProfit2.toFixed(4)} (${$json.tp2Percent}%)\\nšŸ›‘ SL: $${$json.stopLoss.toFixed(4)} (${$json.stopLossPercent}%)\\n\\nā° ${$now.toFormat('HH:mm:ss')}\\nāœ… Position monitored` }}", + "text": "{{ `🟢 TRADE OPENED\\n\\nšŸ“Š Symbol: ${$('Parse Signal').item.json.symbol}\\n${$('Parse Signal').item.json.direction === 'long' ? 'šŸ“ˆ' : 'šŸ“‰'} Direction: ${$('Parse Signal').item.json.direction.toUpperCase()}\\n\\nšŸ’° Entry: $${$json.entryPrice.toFixed(4)}\\nšŸŽÆ TP1: $${$json.takeProfit1.toFixed(4)} (${$json.tp1Percent}%)\\nšŸŽÆ TP2: $${$json.takeProfit2.toFixed(4)} (${$json.tp2Percent}%)\\nšŸ›‘ SL: $${$json.stopLoss.toFixed(4)} (${$json.stopLossPercent}%)\\n\\nā° ${$now.toFormat('HH:mm:ss')}\\nāœ… Position monitored` }}", "additionalFields": { "appendAttribution": false } diff --git a/app/api/trading/execute/route.ts b/app/api/trading/execute/route.ts index 2144967..b401dd8 100644 --- a/app/api/trading/execute/route.ts +++ b/app/api/trading/execute/route.ts @@ -28,6 +28,7 @@ export interface ExecuteTradeResponse { direction?: 'long' | 'short' entryPrice?: number positionSize?: number + leverage?: number stopLoss?: number takeProfit1?: number takeProfit2?: number @@ -221,6 +222,7 @@ export async function POST(request: NextRequest): Promise