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>
One abstract battery states the adapter contract (time and cash, an order's
client id from send to cancel, well-formed orders, positions and fills with
fees as costs, key permissions) and runs it on the internal simulator, on
Alpaca's and OKX's documentation samples with stateful fakes, and on the demo
accounts when the user's keys are in the environment (LiveDemo, inconclusive
without them). The OKX sample key lists withdraw, and the adapter reports it.
Service tests cover the accounts created without keys (no request leaves),
stock strategies moving to the paper account only while their ledger is
empty, the simulator funded from the ledgers once, and dividends and splits
applied once each. The whole suite also passes on PostgreSQL.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>