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:
Brandon Li
2026-09-26 19:47:32 -05:00
co-authored by Claude Opus 5.5
parent 302e9b4911
commit 02544fbdf5
25 changed files with 1337 additions and 277 deletions
+42 -6
View File
@@ -98,6 +98,44 @@ stores the platform login for each firm.
---
## Instruments: what each firm trades
Each firm's **Instruments** list on the master's Firms page is the one place
that says what it trades — there are no per-machine toggles or banned symbols
any more (the instance's Settings page shows the lists read-only).
- **Futures firms** (Tradovate, TopstepX) list CME roots — the same names on
both platforms; each client turns a root into its own front-month contract.
- **DXtrade firms** list their own symbols (`ETH/USD`), whatever root a batch
drew.
With the scheduler on **Auto**, each futures batch draws one instrument from
the batch firm's list, at random but weighted:
- **Efficiency** — one contract's typical daily move ÷ one tick of spread
(from Yahoo's hourly candles over the past week, measured once a day).
Commissions don't count; they're shown, never used to choose.
- **Session timing** — at the open every instrument gets a 10% floor and the
weights follow efficiency; toward the last entry (14:55 CT) the floor fades
and the weight moves sharply to the fastest movers.
- **12-hour cap** — sizing is unchanged (a contract per $1,000 of leg, up to
the type's max contracts); an instrument whose expected hold for the
batch's leg is 12 h or more is out of the draw (e.g. 6E at a $1,000 leg,
about a week).
- Micros stay out of the draw; drain and extra-day legs trade the micro of a
listed product (MNQ when NQ is listed).
Every draw logs its odds. `GET /api/instruments` shows each firm's list with
entry cost, daily move, hold and chance (`?simulate=10000` runs the real draw
with no orders), and the master's Firms page shows the same next to each
instrument.
Against a master from before the lists, an instance falls back to the old
rules: this machine's enabled instruments less each firm's banned symbols,
and a DXtrade firm's symbol map.
---
## DXtrade firms (Tradeify247)
A DXtrade firm is set up on the master's **Firms** page like any other, plus:
@@ -113,11 +151,9 @@ per-contract fees and the CME calendar.
in its own scheduler *lane*: its own trading hours (closed only around the
daily roll), its own wait-until-flat gate and its own batches, so a
multi-hour crypto position never holds up the futures open.
- **Symbol map** — which DXtrade symbols each CME root may trade as. A `*` row
covers every root (drain and extra-day legs trade `MNQ`, so map it or use
`*`). When a root lists several, the cheapest tradable one right now wins:
spread plus both commissions, divided by its volatility (hourly closes over
the past week, measured once a day).
- **Instruments** — the firm's own symbols (see above). The cheapest
tradable one right now wins: spread plus both commissions, per unit of its
volatility (hourly closes over the past week, measured once a day).
- **Target hold hours** — each leg's notional is sized from that volatility so
its expected hold is about this long (blank = 12 h). The position never
exceeds what the account's available funds can margin at the broker's
@@ -148,7 +184,7 @@ It is read-only unless `DX_CONFIRM=yes DX_ACCOUNT=<code>` are set too, which
adds one minimum-size live round trip.
`npm run check` runs the pure-logic checks (fees, stops, sizing, trading
hours, the instrument selector).
hours, the DXtrade selector, the futures draw and instrument lists).
---