fix: Accept market_data_1min action in webhook endpoint
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
This commit is contained in:
@@ -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 }
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user