Fase 12 — Dati e matematica dei panieri #187

Merged
Alby96 merged 6 commits from fase-12 into main 2026-12-04 11:29:05 +01:00
Owner

Prepara i dati e i conti della logica di rientro tra strumenti, solo per la ricerca: nessuna strategia nuova gira. Scelte nell'ADR 0028.

Cosa cambia

  • Giunto nel giudice delle prove (#118). ITrialEngine dà al giudice tutto ciò che prima prendeva dai dati giornalieri; DailyTrialEngine rifà il comportamento di prima. Famiglie di sola ricerca (IResearchFamily, senza strategia e quindi senza ordini), assi a scelta che la regola dell'altopiano non media mai, sezione facoltativa dei panieri in fondo al rapporto.
  • Matematica dei panieri (#119), codice puro in src/Anubis/Baskets/:
    • otto valute e 28 coppie in un solo elenco; orologio del server (New York + 7), fine settimana, orario e pausa giornaliera;
    • 378 relazioni (56 catene, 112 rapporti, 210 disgiunte); appendice B; gli otto spread documentati;
    • indici in pip e in punti base, z-score, Rvol, correlazione, β;
    • somma dei pip, prezzo comune d'uscita, distanze, escursione dello stop, valore del pip, unità alzate al minimo, esposizione, regola dei tre costi;
    • stati, stili e profili Fedele e Prudente.
  • Barre più corte di un giorno (#120):
    • durate da 15 e 30 minuti e da 1, 4 e 8 ore; aggregazione esatta che non riempie mai un buco;
    • calendari 24×7, 24×5 e di borsa; un insieme di barre a colonne;
    • anubis data ecb: le 28 coppie dai cambi della BCE;
    • anubis data fx: i file a un minuto di Dukascopy e HistData, con le barre a 15 minuti.

Prove

  • Tre rapporti d'oro (sma_cross, crypto_trend, una variante fuori griglia) scritti prima del giunto e confermati dalla CI su Linux su quel solo commit (04bb573). Restano uguali byte per byte. Anche le impronte dei piani delle sette famiglie non cambiano.

  • 94 casi sulla matematica dei panieri. Ognuno dei numeri del documento ha la sua prova:

    • tabelle 4.5, 4.12 e 6.9;
    • l'uscita AUDUSD a 0,69089;
    • l'appendice B riga per riga;
    • le quattro date con l'ora legale sfasata.

    Una prova di proprietà su 200 serie controlla che niente guardi avanti.

  • 22 casi sui dati. USDJPY vale 176,79 / 1,1193 sul giorno di prova, e le barre a 15 minuti coincidono con quelle calcolate a mano nei due formati.

  • ./tasks.ps1 check in locale: 837 test verdi su SQLite.

  • La prova locale su PostgreSQL non è stata possibile: Docker Desktop su questo PC è caduto da solo con la memoria quasi esaurita. PostgreSQL e immagine li fa la CI di questa pull request.

  • Revisione indipendente con verifica a contraddittorio: 5 problemi confermati e corretti, 7 respinti. La correzione importante (storico BCE rotto) è stata provata rompendola apposta.

Da sapere
I formati dei file a un minuto vengono da conoscenza generale, e i campioni delle prove sono costruiti a mano: vanno verificati sul primo file vero (docs/API-NOTES.md).

refs #118, refs #119, refs #120, refs #121

🤖 Generated with Claude Code

Prepara i dati e i conti della logica di rientro tra strumenti, solo per la ricerca: nessuna strategia nuova gira. Scelte nell'ADR 0028. **Cosa cambia** - **Giunto nel giudice delle prove (#118).** `ITrialEngine` dà al giudice tutto ciò che prima prendeva dai dati giornalieri; `DailyTrialEngine` rifà il comportamento di prima. Famiglie di sola ricerca (`IResearchFamily`, senza strategia e quindi senza ordini), assi a scelta che la regola dell'altopiano non media mai, sezione facoltativa dei panieri in fondo al rapporto. - **Matematica dei panieri (#119)**, codice puro in `src/Anubis/Baskets/`: - otto valute e 28 coppie in un solo elenco; orologio del server (New York + 7), fine settimana, orario e pausa giornaliera; - 378 relazioni (56 catene, 112 rapporti, 210 disgiunte); appendice B; gli otto spread documentati; - indici in pip e in punti base, z-score, `Rvol`, correlazione, β; - somma dei pip, prezzo comune d'uscita, distanze, escursione dello stop, valore del pip, unità alzate al minimo, esposizione, regola dei tre costi; - stati, stili e profili Fedele e Prudente. - **Barre più corte di un giorno (#120):** - durate da 15 e 30 minuti e da 1, 4 e 8 ore; aggregazione esatta che non riempie mai un buco; - calendari 24×7, 24×5 e di borsa; un insieme di barre a colonne; - `anubis data ecb`: le 28 coppie dai cambi della BCE; - `anubis data fx`: i file a un minuto di Dukascopy e HistData, con le barre a 15 minuti. **Prove** - Tre rapporti d'oro (`sma_cross`, `crypto_trend`, una variante fuori griglia) scritti **prima** del giunto e confermati dalla CI su Linux su quel solo commit (04bb573). Restano uguali byte per byte. Anche le impronte dei piani delle sette famiglie non cambiano. - 94 casi sulla matematica dei panieri. Ognuno dei numeri del documento ha la sua prova: - tabelle 4.5, 4.12 e 6.9; - l'uscita AUDUSD a 0,69089; - l'appendice B riga per riga; - le quattro date con l'ora legale sfasata. Una prova di proprietà su 200 serie controlla che niente guardi avanti. - 22 casi sui dati. USDJPY vale 176,79 / 1,1193 sul giorno di prova, e le barre a 15 minuti coincidono con quelle calcolate a mano nei due formati. - `./tasks.ps1 check` in locale: 837 test verdi su SQLite. - La prova locale su PostgreSQL non è stata possibile: Docker Desktop su questo PC è caduto da solo con la memoria quasi esaurita. PostgreSQL e immagine li fa la CI di questa pull request. - Revisione indipendente con verifica a contraddittorio: 5 problemi confermati e corretti, 7 respinti. La correzione importante (storico BCE rotto) è stata provata rompendola apposta. **Da sapere** I formati dei file a un minuto vengono da conoscenza generale, e i campioni delle prove sono costruiti a mano: vanno verificati sul primo file vero (`docs/API-NOTES.md`). refs #118, refs #119, refs #120, refs #121 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Alby96 added this to the Fase 12 — Dati e matematica dei panieri (solo ricerca) milestone 2026-12-04 10:56:15 +01:00
Alby96 added 6 commits 2026-12-04 10:56:15 +01:00
Record the golden reports of the trial judge before the seam
ci / test (postgres) (push) Successful in 8m10s
ci / test (sqlite) (push) Successful in 8m5s
ci / image (push) Successful in 2m34s
04bb5737d6
Three reports, byte for byte, with the elapsed seconds set to zero: the average
cross with prior trials, the crypto_trend protocol and a judged variant outside
the grid. The seam between the judge and the engines must leave them unchanged.

refs #118

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The basket maths and the ECB crosses both read the currency order, the pairs
and their pip from here.

refs #119

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The trial judge was tied to daily bars in many places, so the basket engine of
Phase 14 could not be judged by it. TrialRunner.Run now has an overload that
takes an IResearchFamily and an ITrialEngine (one variant, the window's
sessions, periods per year, data fingerprint, instruments, benchmark,
look-ahead check, limitations, expectations). The old signature is a wrapper
over DailyTrialEngine, which builds the options once and keeps every engine
call in today's order, so the golden reports stay byte for byte the same.

IResearchFamily is the base of IStrategyFamily without Create; ParameterGrid.Of,
StrategyParameters.Of and TrialRunner.Limitations take it. ParameterSpec.Choices
marks a choice axis: the plateau rule only averages variants with the same
value there, numeric axes keep one step. BacktestRun.Baskets and the report's
optional Baskets section (last field, left out when empty) carry units, levels,
legs and exit reason. No plan field changes: plan hashes recorded before the
seam are checked by a test.

refs #118

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pure code in src/Anubis/Baskets for the basket reversion family of the new
route, so the engine of phase 14 and the eToro Demo of phase 20 share one
home for the arithmetic of the research document:

- ServerClock: New York + 7 h, the server day changing at 17:00 New York,
  half-open weekend rule, hourly window and daily venue pause.
- Relations: chain, ratio and disjoint couples (56 + 112 + 210 = 378),
  appendix B in the document's row order, the eight documented spreads,
  the index sign and the 14-pair list.
- BasketIndex: pip and log basis-point index, sample z-score, Rvol with
  its filter, correlation of log returns and the OLS hedge ratio; every
  value at bar t reads bars up to t only.
- BasketMath (decimal): pip sum, common exit, distance scale with no
  addition after the last level, stop excursion of table 4.12, pip value,
  equal units raised to the venue minimum, exposure, three-costs rule.
- Styles: pair states, the four styles, the Fedele and Prudente profiles.

Every acceptance criterion of the item has a named test with the
document's numbers, plus a fixed-seed property test that nothing at a
closed bar depends on later bars.

refs #119

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Phase 12 needs intraday bars and the 28 currency pairs for the basket
research, without touching the daily backtest engine.

- Timeframes gain 15m, 30m, 1h, 4h, 8h with Length and IsIntraday; the
  CSV import checks any intraday timeframe minute-style at its length
  instead of sending it to the daily check.
- BarAggregator builds longer bars in decimal on UTC epoch buckets,
  never fills a gap and leaves out a bucket that has not closed.
- Bar calendars (24x7, 24x5 FX from Sunday to Friday 17:00 New York,
  exchange sessions) and BarDataset: a common clock in double columns,
  NaN where a series has no bar, optional ask columns, Through that only
  shows closed bars, and a fingerprint of the data.
- EcbCrosses derives the 28 pairs (from the shared Baskets list) from
  the seven ECB rates; "anubis data ecb" writes them under research/ecb
  from the same cached zip as "backtest base", whose loader moves into
  the library with its output unchanged.
- CsvImporter.Parse is split out of ImportAsync and mappings accept a
  fixed offset such as UTC-05:00.
- "anubis data fx" reads Dukascopy and HistData one-minute files,
  refuses anything else in Italian, drops bars outside the FX week and
  writes the 1m and 15m series. The formats come from general knowledge:
  the fixtures are constructed samples, as API-NOTES says.

refs #120

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fix what the independent review of Phase 12 found, and close the phase
ci / test (postgres) (push) Successful in 7m31s
ci / test (sqlite) (push) Successful in 6m0s
ci / test (postgres) (pull_request) Successful in 7m15s
ci / test (sqlite) (pull_request) Successful in 6m8s
ci / image (push) Successful in 1m45s
ci / image (pull_request) Successful in 1m6s
8d02d02876
- A flat window has no z-score even when its mean misses the common value by
  one rounding step (it gave a meaningless z of about 0.995).
- A broken ECB history (a maintenance page, a cut download, a damaged cached
  copy) is refused in Italian instead of crashing `data ecb`, and a download
  is checked and moved into place in one step, so it never replaces the good
  copy.
- A fixed time zone with 60 or more minutes is refused instead of being read
  as the next hour.
- `data fx` says why when every bar of the file falls outside the market week.

ADR 0028 records the choices of the phase; ROADMAP and STATE mark it done.

refs #118, refs #119, refs #120, refs #121

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Alby96 merged commit e0a438a0b2 into main 2026-12-04 11:29:05 +01:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: BalboSoft/Anubis#187