| name | add-instrument |
| description | Add a new tradable instrument to the quant universe, or rename/rotate an existing one (VOO→SXR8, GLD→SGLD→4GLD pattern). Covers legality vetting, script wiring, risk classification, docs, and the ticker-alias map. Use when Jose says "add X to the watchlist", "can we trade X", or an instrument changes ticker/listing. |
Add / Rename Instrument
Instrument changes touch ~8 places; missing one caused real incidents (NATO added outside apply-trades.js → 8 days of broken P&L; SGLD chosen without a currency check → months of FX drag). Follow all steps in order.
Mode A — Add a new instrument
1. Vet before wiring (hard gates, from LEARNINGS 2026-02-06 / 2026-03-27)
If any gate fails, report why and propose the compliant alternative. Stop.
2. Wire the scripts
Grep first — asset lists are constants near the top of each file:
rg -n "SXR8" scripts/*.js | rg -v node_modules
3. Docs
4. Verify
node scripts/fetch-prices.js
node scripts/fetch-history.js
node scripts/generate-quant-signals.js
node scripts/execute-signals.js
node scripts/validate-data.js
node scripts/backtest.js --symbol {SYMBOL}
Never seed a position by editing portfolio.json. Entry happens only when the quant system emits an order and apply-trades.js records it.
Mode B — Rename / rotate an existing holding
Two different operations — pick correctly:
Rename (same exposure, new ticker/listing — e.g. broker migrates GLD→SGLD):
- Old trades stay under the old ticker — never rewrite trade history.
data/.ticker-aliases.json: add old→new in resolve, append history entry with date + reason.
- Update ticker in
portfolio.json holding key ONLY via the alias-aware path; run validate-data.js — check 5 (trades↔holdings) must still reconcile through the alias map.
- Wire the new symbol per Mode A step 2; keep or remove the old symbol from fetch universes depending on whether history is still needed.
- Update ASSETS.md, SIGNALS.md.
Rotation (different instrument, better vehicle — e.g. SGLD→4GLD):
- This is a real SELL + BUY: must flow through
execute-signals.js orders or an explicit Jose-approved manual order, recorded by apply-trades.js with fees.
- Then Mode A for the new instrument, and mark the old one Historical in SIGNALS.md.
- LEARNINGS.md entry if the rotation encodes a lesson (instrument-quality rotations usually do).
Escalation
- Instrument legal but exotic (P2P, prediction markets, fractional art): supported by RULES.md §3 but has no script support — propose the data-source plan to Jose before writing code.
- Can't find a reliable free price source → stop; an asset the pipeline can't price daily cannot enter the universe.