From 96683497f4af3ba1f2e9a28185f67a8d5b16ff63 Mon Sep 17 00:00:00 2001 From: mindesbunister Date: Tue, 9 Dec 2025 18:42:26 +0100 Subject: [PATCH] fix: Accept market_data_1min action in webhook endpoint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CRITICAL: 1-minute ATR data feed not working - Telegram bot timing out Root cause: - TradingView alert sends action: 'market_data_1min' - Endpoint checked for exact match: 'market_data' - Result: 400 Bad Request, no data cached The fix: - Accept both 'market_data' and 'market_data_1min' - Prevents rejection of 1-minute TradingView alerts - Enables fresh ATR data for manual Telegram trades User symptom: 'long sol' → timeout → fallback to preset ATR 0.43 After fix: 'long sol' → waits for fresh 1min data → uses real ATR Files changed: - app/api/trading/market-data/route.ts line 64-71 --- app/api/trading/market-data/route.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/api/trading/market-data/route.ts b/app/api/trading/market-data/route.ts index 1410dd6..4c7e92e 100644 --- a/app/api/trading/market-data/route.ts +++ b/app/api/trading/market-data/route.ts @@ -61,11 +61,12 @@ export async function POST(request: NextRequest) { adx: body.adx }) - // Validate it's a market data update - if (body.action !== 'market_data') { - console.log(`❌ Invalid action: ${body.action} (expected "market_data")`) + // Validate it's a market data update (accept both variations) + const validActions = ['market_data', 'market_data_1min'] + if (!validActions.includes(body.action)) { + console.log(`❌ Invalid action: ${body.action} (expected ${validActions.join(' or ')})`) return NextResponse.json( - { error: 'Invalid action - expected "market_data"' }, + { error: `Invalid action - expected ${validActions.join(' or ')}` }, { status: 400 } ) }