Commit Graph
2 Commits
Author SHA1 Message Date
Alby96andClaude Opus 5.5 a8defde572 Fix the review findings of the basket engine, command and report
The independent review of Phase 14 found rules the engine applied
differently from the decisions, numbers the report labelled wrongly and
a command that left a trial "running" when interrupted.

Engine:
- The pause after the 9% account stop is read at the decision moment
  (the bar's close), like every other gate: on daily bars it no longer
  blocks one day past the server date change.
- In a one-pair basket, a level closed by the venue's mandatory stop
  closes the other levels at the next execution with their own reason,
  closed_with_stop (counted and labelled in the report); the basket's
  exit stays mandatory_stop, and a two-leg basket keeps orphan_leg.
- The cap of two entries per currency applies to new baskets only,
  never to the averagings of an open basket, and every leg is valued
  at the current mid: a Prudente long basket "come dal vivo" now makes
  its three averagings and Fedele writes no note on them.
- The surrogate of the control chains on the mid when the source has
  an ask, so each mid change keeps its size and the spread stays
  around the mid instead of moving the mid by a spread at each change
  of sign.
- The financing already charged on positions still open at the end is
  part of the run's fees (BacktestRun.AccruedFees, zero for the daily
  engine, kept in stored unit outcomes).

Report: the fee row says what it holds (commission and financing, the
spread is in the prices) and the cost-stress text matches what the
multiplier scales; baskets still open at the end are labelled as such
and left out of the share closed at the target; refusal labels say
what the engine checks; the ECB-price and cost limitations are no
longer printed twice; every count has the Italian thousands separator.

Command: Ctrl+C or SIGTERM cancels the run; the trial is recorded as
failed with "Prova interrotta prima della fine: rilancia «anubis
backtest baskets»." and the command exits 1; a trial that cannot start
is failed instead of thrown, and an unexpected error ends with an
Italian line, never a stack trace. The laboratory fails a leftover
basket trial with an accurate message instead of "Strategia non più
disponibile".

The Table 6.5 test comment no longer claims each price is the only one
that fits the row. The real report is regenerated on the same data and
database as the first run, which now counts as a prior trial.

refs #127 #129 #131

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-04 19:26:24 +01:00
Alby96andClaude Opus 5.5 acc9efe39d Add the basket_reversion family and its trial engine
The trial machinery of Phase 13 judges a family through an ITrialEngine;
the baskets need one so their variants go through the same judge, cost
stress, control and look-ahead check as the daily families.

BasketReversionFamily ("Rientro tra strumenti") has one identifier for
every sub-variant: generation A (the five documented spreads) or B (ten
single symbols), signal, target, distance, growth, averagings, window,
entry threshold, exit rule, profile, open baskets and lot. The choice
axes are decimal codes marked as choices, so the plan never treats them
as a range to explore. Rules() turns parameters into BasketRules and
refuses a combination the family does not accept.

BasketTrialEngine runs the basket engine on the plan's data with the
plan's mode (come_dal_vivo by default) and venue costs (eToro by
default): one equity point a day on the same days for every variant,
260 points a year, zero as the comparison (the account is not long
anything), a surrogate that flips each day's changes for the control,
and a look-ahead check that compares the decisions taken before each
cut with those taken on the cut data. Its fingerprint carries the
market, the engine version, the costs and the mode.

refs #129

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-04 18:17:13 +01:00