What an account did while the bot was off is now written before the splits and
the dividends of those days, once and without acting on it; an attempt cut
halfway is taken up from the same point. Until then the account is not valued
at today's price, the guard keeps the last figures it knew with their time,
and a stop order only cancels what is open. Protective sales of the archive
are not continued, and the rest of a stop that fired in part is sold.
Also the decisions of the phase (ADR 0020), the manuals and the dates under
the equity chart.
refs #69#72#75
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The independent review found that a rebuild cut halfway was never finished
(stops canceled or lowered), that old stop executions replayed from the broker
queued a real sale, that a pending "close all" survived the restore, and that
reconciliation and corporate actions touched accounts not rebuilt yet. The
rebuild now keeps its starting point until it ends, protects the bot before the
first row, meets the splits at their date and leaves the ledger alone until it
is done. Dividends count the shares of after a split. A failed restore of a
missing SQLite file leaves no empty database, and a failed migration can be
tried again from the choice page.
refs #69#75
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Relative momentum among coins and all-time highs on stocks are now in the
code as candidates: they collect signals, have no share, no capital and no
order path, and every way forward refuses them. The crypto one ran the
protocol once and failed it (DSR 0.744, worst fall 35.3%), so it is archived
and decides nothing; the stock one waits for the Alpaca history.
refs #74
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>