Resolution

All pages

0019 · Saxo as a second live venue, behind the same ladder, signature and HARD rules

Status: accepted, 2026-09-27. The code is src/broker/saxo.ts and src/broker/saxo/ (api.ts holds every Saxo shape, http.ts the call layer and pacing, oauth.ts the connection, routes.ts the routes and the OAuth return). Tests run against a scripted fake (test/helpers/fake-saxo.ts; test/saxo.test.ts). Reference: docs/saxo.md.

Context

The fund could trade live only through IBKR. An owner whose account is at Saxo Bank had no live venue, and the venue interface had only one implementation, so nothing showed which of its guarantees were IBKR's and which were the fund's.

Decision

  1. Saxo implements the same Venue. The approval ladder, the kill switch, the kernel's HARD rules, the signed digest, the go-live terms and the rung check are unchanged and venue-neutral. live.venue in the Record says which venue the owner signed, and the digest names Saxo's instrument (the Uic) where it names IBKR's conid.
  2. The owner's own app, connected by OAuth with PKCE. The owner registers an app at developer.saxo and logs in on Saxo's page. The fund stores no password, refuses any setting named like one, and keeps the tokens sealed in the data directory (0600), bound to the environment and app. SAXO_ENV defaults to sim.
  3. The same guards, in the same order: save before send, a tradable price on an open market, the 2% collar, no margin (cash and available-for-trading both cover a buy), no shorts, EUR only, and the broker's own pre-trade check (Saxo's precheck, IBKR's what-if) bound to the signature with the same drift tolerance. A pre-trade disclaimer blocks; the fund never accepts one for the owner.
  4. A lost answer is never resent. The client order id rides as ExternalReference. IBKR refuses a duplicate cOID; Saxo does not refuse a duplicate reference. So a Saxo order whose answer was lost, or that was being sent when the process stopped, stays unknown until Saxo shows it (it is adopted) or the owner resolves it.
  5. Every uncertain shape in one file. Saxo's field names live only in api.ts. Where the reference is unclear, the reader takes the documented name, then one known alternative, and otherwise returns nothing, which refuses the order rather than guessing. docs/saxo.md lists them.
  6. Pacing under Saxo's limits. Two requests a second, a second between order requests, one retry of a read after a 429, and a pause of every call after a second 429 in a row. An order is never retried.

Alternatives

  • A generic multi-broker library. Rejected: it adds a dependency, and each broker's failure modes (IBKR's reply prompts, Saxo's missing duplicate guard) are what the guarantees are about.
  • Resend a lost Saxo order under the same reference, as with IBKR. Rejected: without a duplicate guard at Saxo, a resend can place the order twice.
  • Accept Saxo's pre-trade disclaimers automatically. Rejected: accepting a KID notice is the owner's act.

Consequences

  • The IBKR venue behaves as before; its texts and tests are unchanged.
  • An unanswered Saxo order needs the owner more often than an IBKR one does, because the fund will not resend it.
  • Live on Saxo is EUR-only until a signed conversion leg to Saxo exists.
  • This venue has never run against a real Saxo account. Its shapes may be wrong in ways the fake cannot show.

Falsifier

Any of: a Saxo order placed twice for one client order id; an order sent without a signature, past the kill switch or a HARD block, or with a precheck that drifted from the signed one; a token or password in the Record, a log, the browser or the repository. And, once it runs against Saxo's simulation: a field in api.ts read wrongly without the order being refused.

Validated by

No spike against Saxo. test/saxo.test.ts against the fake: OAuth and token handling, pacing, the go-live, submit and fill booking, crash recovery by reference, lost answers never resent, precheck drift, and the EUR, collar, margin and short guards. The unchanged IBKR suite.