Instruments: each firm's list from the master, and a session-aware futures draw
- lib/instrument-specs.ts (pure, tested): the CME specs — point value, tick size, one-tick spread, Yahoo ticker — replacing POINT_VALUES; the draw's maths; the 12-hour hold cap; the micro for drain and extra-day legs; reading a firm's list (the master's, or the old rules against an older master: this machine's enabled set less bans, the symbol map). - lib/instruments.ts: the one module the trading paths ask. Measures every future's daily move from Yahoo's hourly candles once per trade date, and shows entry cost (a tick of spread plus Tradovate's fee parameters or TopstepX's last measured fill) without ever choosing by it. - Futures Auto draws one root per batch from the batch firm's list: movement per dollar of spread early in the session with a 10% floor each, sliding to the fastest movers by the last entry; nothing expected to hold 12h or more; micros only if nothing else is listed. Every draw logs its odds. - The batch is chosen before its instrument, and a group that can't trade anything yields to the next. Copy trade matches the held contract against the listed roots and won't copy an instrument it can't identify. Manual legs, manual orders and drain/extra-day legs follow the lists. - DXtrade firms rank their own list whatever root was drawn. - Capabilities, the dashboard's trade bar and contract resolves follow the lists; the trade bar and scheduler default to Auto. The master link reconnects when master_dashboard_url changes, and the catalog drops ?since after a switch so two masters' versions can't collide. - Reports carry each futures firm's instrumentStats for the master's Firms page; GET /api/instruments shows them (?simulate=N runs the draw, no orders); the Settings page shows the lists read-only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
302e9b4911
commit
02544fbdf5
+11
-10
@@ -498,9 +498,9 @@ function FirmRows({ state, firm, hideDead, privacy, sortKey, sortDir, tradeSymbo
|
||||
<td className="px-4 py-3.5">
|
||||
<div className="flex items-center gap-2.5">
|
||||
<span className="font-bold text-sm text-slate-800">{firm.firm}</span>
|
||||
{firm.bannedSymbols?.includes(tradeSymbol) && (
|
||||
<span className="text-xs bg-red-100 text-red-700 px-1.5 py-0.5 rounded font-semibold">
|
||||
{tradeSymbol} BANNED
|
||||
{firm.platform !== 'dxtrade' && tradeSymbol !== 'Auto' && !firm.instruments?.includes(tradeSymbol) && (
|
||||
<span className="text-xs bg-red-100 text-red-700 px-1.5 py-0.5 rounded font-semibold" title="Not on this firm's instrument list (master Firms page) — it sits this symbol out">
|
||||
{tradeSymbol} not listed
|
||||
</span>
|
||||
)}
|
||||
{firm.platform === 'topstepx' && (
|
||||
@@ -629,7 +629,7 @@ export default function Home() {
|
||||
const [sortDir, setSortDir] = useState<SortDir>('asc');
|
||||
|
||||
// Trade controls
|
||||
const [scheduler, setScheduler] = useState<SchedulerStatus>({ running: false, action: 'Buy', symbol: 'NQ', lastRun: null, intervalSeconds: 60, stopAfterAll: false });
|
||||
const [scheduler, setScheduler] = useState<SchedulerStatus>({ running: false, action: 'Buy', symbol: 'Auto', lastRun: null, intervalSeconds: 60, stopAfterAll: false });
|
||||
const [enabledSymbols, setEnabledSymbols] = useState<string[]>([]);
|
||||
const [tradeSymbol, setTradeSymbol] = useState('');
|
||||
const [tradeAction, setTradeAction] = useState<'Buy' | 'Sell' | 'Auto'>('Buy');
|
||||
@@ -681,12 +681,13 @@ export default function Home() {
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
// The roots this machine's futures firms list; 'Auto' draws among
|
||||
// each batch firm's list and leads the dropdown.
|
||||
fetch('/api/instruments')
|
||||
.then((r) => r.json() as Promise<{ symbol: string; enabled: boolean }[]>)
|
||||
.then((instruments) => {
|
||||
const syms = instruments.filter((i) => i.enabled).map((i) => i.symbol);
|
||||
setEnabledSymbols(syms);
|
||||
setTradeSymbol((prev) => prev || syms[0] || 'NQ');
|
||||
.then((r) => r.json() as Promise<{ roots: string[] }>)
|
||||
.then(({ roots }) => {
|
||||
setEnabledSymbols(roots ?? []);
|
||||
setTradeSymbol((prev) => prev || 'Auto');
|
||||
})
|
||||
.catch(() => {});
|
||||
|
||||
@@ -839,8 +840,8 @@ export default function Home() {
|
||||
onChange={(e) => setTradeSymbol(e.target.value)}
|
||||
className="rounded-lg border border-slate-200 bg-slate-50 px-2.5 py-1.5 text-sm font-mono text-slate-800 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
>
|
||||
{enabledSymbols.map((s) => <option key={s} value={s}>{s}</option>)}
|
||||
<option value="Auto">Auto</option>
|
||||
{enabledSymbols.map((s) => <option key={s} value={s}>{s}</option>)}
|
||||
</select>
|
||||
<div className="flex rounded-lg border border-slate-200 overflow-hidden text-sm font-semibold">
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user