- SQLite DB (better-sqlite3) with firms, account_configs, firm_fees, instruments tables - REST API routes: firms CRUD, account configs CRUD, state, accounts, instruments - Live Tradovate WebSocket client: login, sync, positions, auto-liq thresholds - Dashboard (app/page.tsx): per-firm account list with balance, day P&L, days traded, target progress, and Dead/Inactive/Flat status based on Tradovate auto-liq floors - Account detail page: objectives progress, daily P&L chart, consistency tracking - Per-firm settings page: account configs and instrument fee management - Dead detection uses trailingMaxDrawdownLimit - trailingMaxDrawdown from userAccountAutoLiqs; filters Tradovate sentinel value (999999999 = no limit) - FIFO P&L engine with commission accounting for daily P&L history - Removed manual maxLoss fallback in favour of live Tradovate auto-liq data Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
22 lines
648 B
TypeScript
22 lines
648 B
TypeScript
import { NextRequest, NextResponse } from 'next/server';
|
|
import { getFirmFees } from '@/lib/db';
|
|
|
|
export async function GET(
|
|
_req: NextRequest,
|
|
{ params }: { params: Promise<{ id: string }> }
|
|
) {
|
|
const { id: idStr } = await params;
|
|
const firmId = parseInt(idStr, 10);
|
|
|
|
if (isNaN(firmId)) {
|
|
return NextResponse.json({ error: 'Invalid firm id' }, { status: 400 });
|
|
}
|
|
|
|
try {
|
|
return NextResponse.json(getFirmFees(firmId));
|
|
} catch (err) {
|
|
console.error('[GET /api/firms/:id/instrument-configs]', err);
|
|
return NextResponse.json({ error: 'Failed to fetch fees' }, { status: 500 });
|
|
}
|
|
}
|