0009 · Live trading through IBKR's Client Portal Gateway, off until the owner signs it on
Status: accepted, 2026-09-24, by the owner. Supersedes the part of 0007 that shipped no live broker. Tested against a simulated gateway; not yet against IBKR.
Context
The spec keeps every universe on paper until it reaches L4 (§29.4). The owner overrode that on 2026-09-24: the fund must be able to trade real money now. The override is the owner's to make. It changes when real money is at risk, not whether the kernel, the signature and the record apply.
Decision
The first live venue is Interactive Brokers, through the Client Portal Gateway that the owner runs
and logs in to. Resolution talks only to the gateway's local Web API, so it never holds a broker
password. A fund goes live only when the owner signs live:<account>:<terms hash>. The terms fix
the account, the fund's cash, the account's existing holdings, the live order cap, the price collar
and the contract for every instrument.
Guards added for real money:
- Kernel, HARD.
L-LIVE-PRICErefuses prices from the synthetic market or a fallback.L-LIVE-SIZErefuses risk-adding orders abovelive_max_order(1,000 EUR by default). - Venue. It refuses:
- a limit outside
live_collar_pct(2%) of IBKR's price; - a buy the account's available funds do not cover, so nothing is bought on margin;
- a sell the holdings do not cover;
- an instrument outside the signed contract list.
- a limit outside
- Go-live preconditions. The fund must:
- not be the demo;
- have the kill switch released;
- have a flat book;
- have a logged-in session;
- have IBKR available funds of at least the fund's cash.
- Operations.
- No fallback to paper: a live fund without
BROKER=ibkrsends nothing. - An expired approval is never sent late.
- The book is reconciled every five minutes, and two consecutive breaks halt all trading.
- Back to paper only from a flat book.
- Raising the cap or the collar is a loosening and waits out
cooling_days.
- No fallback to paper: a live fund without
Alternatives
- Keep paper until L4. Overridden by the owner.
- TWS API or IB Gateway (socket). Rejected for now: it needs a native client library and a long-lived socket. The Web API is HTTP and matches the rest of the process.
- A broker with API keys (for example Alpaca, Saxo OpenAPI). Rejected as first venue: the universe is European equities, which IBKR covers. An API key would also be a stored broker credential, which the gateway login avoids.
Consequences
- The owner must run Java and the gateway, and log in again each day.
- Positions are the fund's book minus the go-live baseline. A trade the owner places by hand in the same account breaks reconciliation, by design.
- Capital flows are not modelled. To trade a different amount, start a new fund.
Falsifier
This decision is wrong if an IBKR paper-login rehearsal shows any of these:
- an order reaching IBKR without a signature;
- a duplicate order after a crash;
- a fill booked at a different quantity or price than IBKR reports;
- a reconciliation break that IBKR's own screens do not show.