Fix 400 error when starting scheduler with Random symbol

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 <noreply@anthropic.com>
This commit is contained in:
Senofy
2026-03-12 03:52:41 -05:00
co-authored by Claude Sonnet 4.6
parent 245a15666e
commit b7952a83ef
+2 -2
View File
@@ -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);