Lucid's users moved to their own Tradovate hosts (demo-api.lucid.ninjatrader.com, seen 2026-11-01). The login still answers on live.tradovateapi.com, but the shared demo socket drops a Lucid session right after its authorize (close 1006, no status), so every Lucid firm sat at "Connecting…" on every machine. The login answer now names the hosts (apiHosts, orgName "LucidTrading"), and the web trader follows them. A Tradovate client now opens its socket and makes its account, contract, fee and report calls on the hosts its own login names; a login without apiHosts, or with a value that isn't a plain host name, keeps demo.tradovateapi.com and rpt-demo.tradovateapi.com. A renewal answer without apiHosts keeps the login's. The shared contract cache still resolves with a client on the shared hosts when there is one; a client on its organization's own only stands in. Login, renewal and the quote feed are unchanged: Lucid's live and md hosts are the shared ones. The debug routes follow the same hosts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
34 lines
1.3 KiB
TypeScript
34 lines
1.3 KiB
TypeScript
import { NextRequest, NextResponse } from 'next/server';
|
|
import { getClients } from '@/lib/clients';
|
|
import axios from '@/lib/http-client';
|
|
import { SHARED_DEMO_HOST } from '@/lib/tradovate-helpers';
|
|
|
|
export async function GET(
|
|
req: NextRequest,
|
|
{ params }: { params: Promise<{ id: string }> }
|
|
) {
|
|
try {
|
|
const { id: firmId } = await params;
|
|
const clients = getClients();
|
|
const client = clients.get(firmId) as any;
|
|
if (!client) return NextResponse.json({ error: 'Client not found' }, { status: 404 });
|
|
|
|
const symbol = req.nextUrl.searchParams.get('symbol') ?? 'NQ';
|
|
const accessToken = client.accessInfo?.accessToken;
|
|
if (!accessToken) return NextResponse.json({ error: 'Not authenticated' }, { status: 401 });
|
|
|
|
const res = await axios.get(
|
|
`https://${client.serviceHost?.() ?? SHARED_DEMO_HOST}/v1/contract/suggest?t=${encodeURIComponent(symbol)}&l=20`,
|
|
{ headers: { Authorization: `Bearer ${accessToken}` } }
|
|
);
|
|
|
|
return NextResponse.json({
|
|
symbol,
|
|
contracts: res.data,
|
|
recentEntityEvents: client.recentEntityEvents ?? [],
|
|
});
|
|
} catch (err: any) {
|
|
return NextResponse.json({ error: err?.message }, { status: 500 });
|
|
}
|
|
}
|