feat: add position size and leverage to Telegram confirmation message

This commit is contained in:
mindesbunister
2025-10-27 01:06:51 +01:00
parent 428b3dc078
commit b82ceb49a4
4 changed files with 7 additions and 5 deletions

2
.env
View File

@@ -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)

View File

@@ -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
}

View File

@@ -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<NextResponse<ExecuteTr
direction: body.direction,
entryPrice: entryPrice,
positionSize: positionSizeUSD,
leverage: config.leverage,
stopLoss: stopLossPrice,
takeProfit1: tp1Price,
takeProfit2: tp2Price,

View File

@@ -20,10 +20,10 @@ services:
# Load from .env file (create from .env.example)
DRIFT_WALLET_PRIVATE_KEY: ${DRIFT_WALLET_PRIVATE_KEY}
DRIFT_ENV: "${DRIFT_ENV:-mainnet-beta}"
DRIFT_ENV: ${DRIFT_ENV:-mainnet-beta}
API_SECRET_KEY: ${API_SECRET_KEY}
SOLANA_RPC_URL: ${SOLANA_RPC_URL}
PYTH_HERMES_URL: "${PYTH_HERMES_URL:-https://hermes.pyth.network}"
PYTH_HERMES_URL: ${PYTH_HERMES_URL:-https://hermes.pyth.network}
# Trading configuration
MAX_POSITION_SIZE_USD: ${MAX_POSITION_SIZE_USD:-50}