From b7952a83efb4cfed89563e06b5054df7806b44ab Mon Sep 17 00:00:00 2001 From: Senofy <63175905+Senofy@users.noreply.github.com> Date: Thu, 12 Mar 2026 03:52:41 -0500 Subject: [PATCH] Fix 400 error when starting scheduler with Random symbol MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Skip POINT_VALUES validation for 'Random' — the symbol is resolved to a real instrument inside runTrade before any point value lookup. Co-Authored-By: Claude Sonnet 4.6 --- app/api/trade/route.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/api/trade/route.ts b/app/api/trade/route.ts index c7789e8..c4e7d11 100644 --- a/app/api/trade/route.ts +++ b/app/api/trade/route.ts @@ -11,14 +11,14 @@ export async function POST(req: NextRequest) { return NextResponse.json({ error: 'Missing required fields: action, symbol' }, { status: 400 }); } - if (!POINT_VALUES[symbol]) { + if (symbol !== 'Random' && !POINT_VALUES[symbol]) { return NextResponse.json({ error: `Unknown symbol: ${symbol}` }, { status: 400 }); } // Execute trade immediately for all eligible accounts const results = await runTrade(action, symbol); - // (Re)start the 60-second scheduler with this action + symbol + // (Re)start the scheduler with this action + symbol startScheduler(action, symbol); return NextResponse.json(results);