The strategy contract of SPEC 5.3 (IStrategy, StrategyContext, Intent) is
shared by backtest and live: the context exposes bars only up to the
decision, adjusted and anchored to that day, and reading past it throws.
The engine runs each session as ordered events (corporate actions, open,
session, close), decides on the close and executes at the next open with
the simulator's price lists, slippage tiers, tick and lot rounding,
minimums and no leverage. Corrective and risk hooks are wired in and pass
everything through until Phase 5. One decision cycle can restart from a
recorded book (SPEC 12.3).
A scripted toy strategy reproduces a result computed by hand to the cent
on OKX and Alpaca costs. The Phase 3 class Trading.Strategies becomes
StrategyNames so the Anubis.Strategies namespace can exist.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Splits multiply only the shares held before the ex-date. Old splits in
the table no longer inflate positions bought later; the simulator's book
follows the same split once, together with the ledger.
- Dividends pay the simulator once on the ex-date holdings, and each
payment is marked in the same write, so a failure never pays twice.
- Positions are marked to market before every equity photograph; until
now equity, drawdown and the Conti screen stayed at the last fill.
- A sale with no price keeps its broker stops until it can really leave;
a purchase with no price is dropped.
- A refused sale is retried with pauses of 1, 2, 4, 8 and 15 minutes
instead of every tick, and one failing execution no longer stops the
stop alignment of the whole account.
- On Alpaca a purchase clears the sell stops of every strategy on the
symbol and holds them until it ends.
- OKX order lookups treat only 51603 as unknown; any other failure is an
error, so a lost order is never sent twice.
- The reconcile choice and key removal forms now require the antiforgery
token; the choice re-runs the comparison and is only offered after the
15 minutes; stale differences are dropped.
- A replaced key that cannot withdraw releases the prudent mode.
- Re-entering the same euro capital for Alpaca changes nothing; a new
amount converts only the euro difference at today's rate.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Order manager tests drive the internal simulator turn by turn: the chasing
limit with its post-only steps and aggressive cross, a buy given up, a sale
never given up with its alert, the pace of six sends a minute, Alpaca's
GTC + day stops, the stop-already-passed rule and splits, lost answers,
duplicate fills, refusals and residues. Reconciliation tests cover clean,
healed, prudent mode and its return, align/exclude, unknown orders, stop
coverage, withdraw-capable keys and an unreachable broker.
Two defects found by the tests are fixed: stops were not cleared before an
execution that starts aggressive (Alpaca refuses a buy with a sell stop open,
and a sale must free the quantity), and an order's creation is now recorded
as its first event.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>