Commit Graph
100 Commits
Author SHA1 Message Date
Alby96andClaude Opus 5.5 e302f0cd80 Mark phase 10 as done after the user's yes
ci / test (postgres) (push) Successful in 6m51s
ci / image (push) Successful in 2m11s
ci / test (postgres) (pull_request) Successful in 6m6s
ci / image (pull_request) Successful in 45s
ci / test (sqlite) (push) Successful in 4m54s
ci / test (sqlite) (pull_request) Successful in 4m56s
The user approved the merge and the fase-10 tag on 3 December 2026:
STATE and ROADMAP say phase 10 is complete and phase 11 comes next.

refs #81

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 19:23:18 +01:00
Alby96andClaude Opus 5.5 195f3e51af Point the runbook to moving between databases
ci / test (postgres) (push) Successful in 5m55s
ci / test (postgres) (pull_request) Successful in 5m45s
ci / test (sqlite) (pull_request) Successful in 4m36s
ci / image (push) Successful in 1m23s
ci / image (pull_request) Successful in 1m5s
ci / test (sqlite) (push) Successful in 4m44s
The runbook's database page now says how to move to another database
with db export and db import, and where the Windows trial data goes,
as issue #78 asked.

refs #78

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 18:13:07 +01:00
Alby96andClaude Opus 5.5 c27e8194d3 Say in the diary where the server runs, as Settings does
ci / test (postgres) (push) Successful in 5m31s
ci / test (postgres) (pull_request) Successful in 5m12s
ci / image (push) Successful in 2m16s
ci / image (pull_request) Successful in 1m4s
ci / test (sqlite) (push) Successful in 4m24s
ci / test (sqlite) (pull_request) Successful in 4m43s
Outside a container the diary said "in Docker": it now says
"fuori dal container (sviluppo)", from the same options as Settings
(ADR 0022). Found by the second independent review.

refs #114

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 17:45:27 +01:00
Alby96andClaude Opus 5.5 e9ac6dccc9 Phase 10: new course and Docker only
Record the course the user chose on 2 December 2026 and make the
container the only form of Anubis.

- ADR 0021-0026: new roadmap (phases 10-24, readings per phase, the
  spec-to-ADR table, merge and tag only after the user's yes),
  Docker only, maths-only decisions, bans turned into limits on margin
  accounts, eToro Demo as currency venue and forward tests, strategy
  championship. ROADMAP rewritten from phase 10; STATE, CLAUDE.md,
  SVILUPPO, README, API-NOTES and the manuals without the desktop.
- Remove the desktop: Anubis.Desktop, Anubis.Setup, deploy/windows,
  release-win and desktop-win, config.toml, PlatformKind,
  ANUBIS_PLATFORM, DPAPI with the ProtectedData package and the
  first-run wizard. Outside a container the server needs --data-dir,
  listens on 127.0.0.1 only and refuses foreign hosts; server and guard
  refuse --platform desktop with an Italian message and exit code 2.
  The demo keeps its key in a file and its error-page choices need no
  startup password. The diagnostics report says where the server runs
  from its own environment.
- Lighter image: restore and publish for linux-x64 only, and leave out
  the Windows libraries ONNX Runtime copies anyway (829 MB to 410 MB on
  disk, /app from 282 MB to 42 MB). Rotating Docker logs in the Unraid
  template, the manual and the compose; backtest and learning run as
  one-shot commands. tasks dev uses artifacts/dev-data.

refs #113 #114 #115 #78 #80 #81

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 17:35:17 +01:00
Alby96 3c57b3e84c CI: anche i dati del servizio PostgreSQL stanno in memoria (#112)
ci / test (postgres) (push) Successful in 4m53s
ci / image (push) Successful in 1m25s
ci / test (sqlite) (push) Successful in 4m23s
2026-12-03 15:33:29 +01:00
Alby96andClaude Opus 5.5 46e4a2bf6a Keep the data of the CI's PostgreSQL service in memory
ci / test (postgres) (push) Successful in 5m50s
ci / test (postgres) (pull_request) Successful in 5m40s
ci / test (sqlite) (pull_request) Successful in 5m0s
ci / image (push) Successful in 2m37s
ci / image (pull_request) Successful in 1m0s
ci / test (sqlite) (push) Successful in 5m11s
The PostgreSQL job of the Phase 9 CI failed once on a read timeout while a
test connected: the service log showed the runner's disk stalled, with a
25-second checkpoint even with fsync off and a forced DROP DATABASE
waiting on a stuck backend. The data of the service now live on a tmpfs
at /var/lib/postgresql, which holds PGDATA in PostgreSQL 18, like the
SQLite test databases already do (ADR 0019).

Tried in the CI's SDK container against postgres:18 with the same
options: 706 tests passed of 709 (3 skipped), peak use 295 MB, no stall.
The limit is 1 GB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 14:29:00 +01:00
Alby96 db563a0ebf Fase 9 — Rifinitura e consegna in Docker (#111)
ci / test (postgres) (push) Successful in 7m30s
ci / image (push) Successful in 2m21s
ci / test (sqlite) (push) Successful in 5m8s
2026-12-03 14:07:14 +01:00
Alby96andClaude Opus 5.5 76c19d533b Let the tests run their fake tools from the CI's memory folder
ci / test (postgres) (push) Successful in 7m50s
ci / test (sqlite) (pull_request) Successful in 5m24s
ci / image (push) Successful in 3m54s
ci / test (postgres) (pull_request) Successful in 7m19s
ci / image (pull_request) Successful in 1m36s
ci / test (sqlite) (push) Successful in 5m23s
Docker mounts a tmpfs noexec by default. The publish script tests of
Phase 9 write fake git and docker into the temp folder and run them;
on /test-tmp they could not, the real git ran instead and 18 tests
failed. Reproduced in the CI's SDK container: 18 of 37 delivery tests
fail without exec, all 37 pass with it. ADR 0019 says why.

refs #75

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 13:13:23 +01:00
Alby96andClaude Opus 5.5 4aea2d0be7 Merge main into fase-9: SQLite test databases in memory on the CI
ci / test (postgres) (push) Failing after 6m53s
ci / image (push) Skipped
ci / test (postgres) (pull_request) Failing after 7m47s
ci / test (sqlite) (pull_request) Canceled after 1m49s
ci / image (pull_request) Canceled after 0s
ci / test (sqlite) (push) Failing after 5m26s
The CI of Phase 9 failed on seven tests that start the server on a SQLite
file: on the runner's disk the migrations alone took 24 seconds, past the
30-second start limit. PR #110 (ADR 0019), now in main, keeps the test
databases in a tmpfs folder on the CI. STATE.md no longer lists #110 as
waiting for the user.

refs #75

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 12:51:40 +01:00
Alby96 34cf307b74 CI: i database SQLite delle prove stanno in memoria (#110)
ci / test (postgres) (push) Successful in 5m33s
ci / image (push) Successful in 4m5s
ci / test (sqlite) (push) Successful in 4m24s
2026-12-03 12:51:14 +01:00
Alby96andClaude Fable 5.2 f3a603d491 Close Phase 9 and record the new route of 2 December 2026
ci / test (postgres) (push) Failing after 7m12s
ci / image (push) Skipped
ci / test (postgres) (pull_request) Failing after 7m46s
ci / image (pull_request) Skipped
ci / test (sqlite) (push) Successful in 11m19s
ci / test (sqlite) (pull_request) Successful in 10m6s
Phase 9 ends with its last documents: the review fixes in ADR 0020
(points 35-49), the publication rule in SVILUPPO.md and the state.

The user changed the project's route on 2 December 2026: maths-only
decisions, the basket mean-reversion logic of a research document, a
championship of strategies, leverage and short selling only on margin
accounts that can never be real, currencies on the eToro Demo, and
Docker only. The approved plan (phases 10-24) and the document now live
in docs/piani and docs/ricerca, so the route does not stay on one disk.
STATE.md points the next session to Phase 10 "Nuova rotta: solo Docker";
ROADMAP.md marks the old desktop phase as superseded and keeps #70 and
#71 open while they wait for the user.

refs #75

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-12-03 11:40:39 +01:00
Alby96andClaude Opus 5.5 8d7efe425d Settle what the checks of the review fixes found
A difference that comes and goes no longer makes the account ask about a stop
the user has already chosen on. The balance of the restrictions adds each
period to what was published, so a change of capital does not rewrite the
past. An image is published only under a tag that exists, and a file that is
not part of it no longer marks it as unclean.

refs #70 #74 #75

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 23:16:14 +01:00
Alby96andClaude Opus 5.5 d26d945818 Merge branch 'fase9-fix-ombra' into fase-9
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 23:12:28 +01:00
Alby96andClaude Opus 5.5 76b64ef147 Replay the past of a rebuilt account in its order
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>
2026-12-01 22:58:08 +01:00
Alby96 e58a26e8fa Merge branch 'fase9-fix-conti' into fase-9 2026-12-01 22:28:59 +01:00
Alby96andClaude Opus 5.5 3543f29aba Judge the variant in use and count the shadow cases for what they are
The quarterly review judged the best variant of the grid instead of the one
that trades: the plan now fixes the variant in use and the protocol measures
that one, while the tries are still those of the grid. A failure while the
history is prepared is a reason in the report and no longer stops the review,
and a strategy whose protocol does not exist says so when its data are there.

The volatility improvement compared books of different days and stages: the
book keeps its stage and its previous day, and a case without a book valid on
its day is left out. Fewer than six months give no interval, the others use
the clustered error with the Student t.

The restriction balance counts a case in the period in which its outcome
became known, so no case is lost or counted twice between two reviews.

The contact given to the SEC travels only on the client that never follows a
redirect, so it cannot reach another site.

refs #75

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 22:26:06 +01:00
Alby96andClaude Opus 5.5 5ef54b6f2a Finish an interrupted rebuild and replay the past without acting on it
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>
2026-12-01 22:15:34 +01:00
Alby96andClaude Opus 5.5 81d6c5f667 Fix what the review of Phase 9 found in accounts, access, capital, health and publication
A position left out together with its stop kept the account prudent for good: the
stop was still asked for shares that no longer exist. The cover required now stops
at what the account holds, the stops are compared again after the choice, and where
one is still missing Align takes the excluded position up again. After the choice
the account waits for the stop with its own reason, so it returns to normal by
itself also past the 15 minutes; a new difference still gets its own 15 minutes.

A right password alone no longer clears the wrong second-factor codes: it takes
back only its own attempt.

Capital and shares are planned and written in one transaction, so overlapping
changes cannot apply twice and an interruption leaves nothing halfway; sending the
same figures again completes what an old one left. The cash that purchases under
way still hold is no longer given away, counted as the risk engine counts it.

/health said healthy when the trading engine had failed to start. It now says so at
once, or after ten minutes of a stalled start, and the host tries the start again
every minute; the guard still sees a start that does not move.

The image of the manual publication says its version and its commit, marked when
the tree is dirty, and publish.sh refuses before any login an image that does not
come from the commit of the tag.

refs #75

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 22:07:46 +01:00
Alby96andClaude Opus 5.5 24e20584d4 Write the manuals and fix what following them found
The manual, the runbook and the go-live list are written and checked claim by
claim against the code, and the installation is done from zero by following
them on both engines. That found real defects, now fixed:

- with SQLite a missing database file left no way to restore a backup: the
  choices appear, and the file is created only by the user's choice;
- an account whose difference vanished after the 15 minutes stayed prudent
  with no button, a missing stop could be left out for good, and a choice
  made while the broker was silent used old numbers;
- after "Ferma tutto" the positions could not be closed without restarting;
- a refused key looked like a silent broker: it has its own notice now;
- the split of the capital between the strategies of a broker (SPEC 13.5)
  could not be changed from the interface.

refs #72 #68

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 21:38:33 +01:00
Alby96andClaude Opus 5.5 2257c3e16c Review the base strategies every three months
Every quarter the base strategies are tried again on the longer history with
the slippage in force, compared with how they did live, and the report is
published in the laboratory with the base rates measured again and the balance
of the restrictions of 10.5. In observation the outcome replaces the old one and
a strategy that passed goes to simulation after its 90 days; with capital
nothing moves but the demotion condition of 12.3. A restart halfway goes on and
the review concludes once; the outcome of a review survives a restart with an
older build.

refs #74

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 20:59:20 +01:00
Alby96andClaude Opus 5.5 79bb194de0 Compute the improvements of 8.7 in shadow on the examples
Each improvement is measured on the signals the bot already collects, in its own
savepoint after the decision, so no order depends on it: the correlation filter,
the volatility cap, the sector cap, the market filter, the entry time and the
choice of the model. The laboratory shows how many cases each one has and how far
to trust it. Sectors come from the SEC only with a contact given by the user.

refs #74

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 20:31:15 +01:00
Alby96andClaude Opus 5.5 fb0ab223a5 Put the candidate strategies in observation without capital
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>
2026-12-01 19:52:24 +01:00
Alby96andClaude Opus 5.5 9d1a4f2f69 Export the operations for the tax return
Every execution, dividend and correction of a world, with its value in euro
at the ECB rate of its own Italian day or the last one before it, and for
sales the cost of what was sold. Costs come from the executions of the whole
account, so the method (LIFO by default, or FIFO) can be changed at any
time. A missing rate leaves the cell empty and says so.

The ECB download no longer leaves holes after a pause, and each execution
keeps the reference rate in force when it happened (SPEC 6.8).

refs #73

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 19:33:10 +01:00
Alby96andClaude Opus 5.5 3cd214ae78 Publish the image on version tags and test what is delivered
A v* tag now builds, tries and publishes the image: the version must be the
one of Directory.Build.props, latest only moves forward and the registry
token is in one step, given to docker on its input. The same script works by
hand. The image says its version and commit, and its health check also
covers the engine loop and the live prices.

The Unraid template is final: a test compares it with appendix E and with
the variables the loader really reads, and another reads the workflow.

refs #70
refs #71

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 19:21:40 +01:00
Alby96andClaude Opus 5.5 4d92a39fef Close what the security review found
A session alone could change the password, switch the second factor on or
off, send the key of the language model to another address and remove the
rules that stop purchases. Each now needs the password and the code, with
one limit on wrong attempts that a restart of the services does not clear,
and the other sessions end when the password or the factor changes.

Requests to the brokers pass a list of allowed calls, never follow a
redirect with a key and are signed by one client only. Pages are closed by
default, nothing is cached, requests are limited to 1 MB, secrets are
masked in logs and notifications, exported tables cannot run as formulas,
archives carry no sessions and the container refuses to run as root.

refs #68

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 19:11:11 +01:00
Alby96andClaude Opus 5.5 4897594b87 Rebuild the state from the brokers after a restore and refuse an older copy
A restore, an import or an adopted database restarts protected: the engine
stays stopped, reads from the broker what the archive does not know (orders,
stops, executions, also from the OKX history up to 89 days), cancels orders
left working, protects what it finds and waits for the user. Strategies with
real money stay exit only until confirmed again. The database of before the
restore, put back by mistake, is refused by its fingerprint.

A failed migration leaves the engine off with one backup and a way to try
again; an archive is checked whole before the database is touched; a changed
secret key no longer crashes anything, and "anubis access reset" gives the
access back to whoever holds the computer. The image runs the db and access
commands without the guard.

refs #69

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 18:52:08 +01:00
Alby96andClaude Opus 5.5 e8b3500db6 Keep the test databases of the CI in memory
ci / test (postgres) (push) Successful in 6m54s
ci / test (postgres) (pull_request) Successful in 6m51s
ci / image (push) Successful in 1m0s
ci / image (pull_request) Successful in 1m40s
ci / test (sqlite) (push) Successful in 5m17s
ci / test (sqlite) (pull_request) Successful in 7m17s
The disk of the runner stops for seconds under load, and the health check of a
test rightly answered "unavailable" after five. PostgreSQL was already spared
the syncs (ADR 0015); the SQLite tests now use a temporary folder in memory, and
the health test looks at the answer it settles on (ADR 0019).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 17:31:13 +01:00
Alby96 3da9b00f44 Merge pull request 'Fase 8 — Apprendimento' (#109) from fase-8 into main
ci / test (postgres) (push) Successful in 5m53s
ci / image (push) Successful in 47s
ci / test (sqlite) (push) Successful in 8m3s
2026-12-01 16:58:03 +01:00
Alby96andClaude Opus 5.5 3eabc7713e Let the tests ride out a busy server
ci / test (postgres) (push) Successful in 5m36s
ci / test (postgres) (pull_request) Successful in 5m57s
ci / test (sqlite) (pull_request) Successful in 7m11s
ci / image (push) Successful in 1m21s
ci / image (pull_request) Successful in 59s
ci / test (sqlite) (push) Successful in 7m14s
On a loaded runner a forced DROP DATABASE gave up on an autovacuum slow to
leave, and failed a test that had already passed: the cleanup is tried again, as
the creation already is. The feed test gets time for its slow reader on a
computer at full load.

refs #67

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 15:16:39 +01:00
Alby96andClaude Opus 5.5 c7e462b6f4 Fix what a second independent reading of the Phase 8 fixes found
ci / test (postgres) (push) Failing after 6m9s
ci / image (push) Skipped
ci / test (postgres) (pull_request) Successful in 5m51s
ci / image (pull_request) Successful in 1m51s
ci / test (sqlite) (push) Successful in 7m6s
ci / test (sqlite) (pull_request) Successful in 7m3s
One funded signal was enough to start the model for good, because the interval
of a few cases had no width: it now takes a hundred, weighed among themselves.
A computer always off at 03:00 never made the night of the model: a job to make
up for counts from the first start that knows it, and the night waits for the
bars of the absence. Stories are seen as they were when the decision was due, a
report already out does not close a label, an undone promotion starts the trial
again, and the trade card finds the estimate of an example born earlier.

ADR 0018 point 18 has the list; each defect has its test.

refs #67

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 14:27:03 +01:00
Alby96andClaude Opus 5.5 0b0f4a5e75 Fix what the independent review of Phase 8 found and close the phase
ci / test (postgres) (push) Successful in 6m37s
ci / test (postgres) (pull_request) Successful in 5m40s
ci / test (sqlite) (pull_request) Successful in 7m31s
ci / image (push) Successful in 2m29s
ci / image (pull_request) Successful in 59s
ci / test (sqlite) (push) Successful in 7m51s
Two reviewers with a clean context read the engine and the screens. The
isotonic calibration took its floor from the first step, even of two cases, so
with few winners it flattened every estimate: the first model is rebuilt with
the fix. Learning failures no longer forget the multiplier an operation was
born with, nor stop a decision or the nightly check; recovered decisions read
the outside world as it was when due; models estimate only the strategies they
studied; a newer history does not repeat what was lived. The screens count
examples instead of verifications, show the next threshold and never round an
alarm to 50%; two forms now check the antiforgery token.

Each defect has its test, on both engines. ADR 0018 point 17 has the list.

refs #67

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 13:36:26 +01:00
Alby96andClaude Opus 5.5 f69943f70a Show what the model knows on its own screen and let the user set it aside
The Apprendimento screen says in plain words whether the model counts, how
well its probabilities hold, which clues it weighs, how the challenger is
doing and what it has learned. Thresholds, set-aside and the undo of a
promotion live in Impostazioni; anything that shrinks less with real money
asks for the phrase. The new tests also caught a wrong column name that
broke the Panoramica as soon as the first model existed.

refs #66

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 12:44:37 +01:00
Alby96andClaude Opus 5.5 14e8a872dc Learn slippage from real executions and say discoveries in plain words
The monthly regression raises an estimate by itself and lowers one only on
real money and with the confirmation of the user in the Laboratorio. The
table of what news does to prices and the fixed list of questions on the
clues are informative only.

refs #65

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 12:15:20 +01:00
Alby96andClaude Opus 5.5 df21962da3 Let the model shrink entries once it has earned it and watch it every night
The multiplier is the last corrective and is fixed when an operation is
born. Until the criteria of SPEC 11.5 are met the estimates are only noted
beside each operation. Every night the outcomes are labelled and the model
is checked (precision, ADWIN on the error, clues never studied) and set
aside when it is wrong; every Sunday a challenger is trained or judged.

refs #64

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 12:02:55 +01:00
Alby96andClaude Opus 5.5 99ff2d9402 Train the learning model at home and ship the first one with its validation
Logistic regression, boosted trees and random forest, calibration, purged
validation and the choice by mean gain per proposed operation (refs #63).
The first model comes from the crypto history: nothing better than the base
rate, so it starts in observation as the report says.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 11:34:41 +01:00
Alby96andClaude Opus 5.5 9cd1357e9b Archive every entry intent as a learning example with its clues and label
One example for the first entry intent of a strategy, executed or not and also
in observation, saved in the transaction of the decision with the clues known at
that moment. The label is the operation simulated alone at full size, net of
costs, so it does not depend on what the bot did with the signal (ADR 0018).

refs #62

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 11:07:32 +01:00
Alby96 632252f95c Merge pull request 'Fase 7: correzioni della revisione indipendente e chiusura' (#108) from fase-7 into main
ci / test (postgres) (push) Successful in 4m9s
ci / image (push) Successful in 1m26s
ci / test (sqlite) (push) Successful in 4m34s
2026-12-01 10:38:11 +01:00
Alby96andClaude Opus 5.5 a3ff8ea6b7 Fix what the independent review of Phase 7 found and close the phase (refs #61)
ci / test (postgres) (push) Successful in 4m14s
ci / test (postgres) (pull_request) Successful in 4m22s
ci / image (push) Successful in 2m51s
ci / image (pull_request) Successful in 50s
ci / test (sqlite) (push) Successful in 4m41s
ci / test (sqlite) (pull_request) Successful in 4m33s
Linking missed Italian elisions, "The" names and common aliases; keywords
missed words after an apostrophe; stories about two companies merged and
confirmed each other; a story that became serious late was measured from its
first article. The news round delayed the engine and the risk check, and the
classifier ran inside the database writer. The earnings row started and ended
on the wrong sessions, the one-step comparison ignored it, and a purchase was
said to be put off when it was not, or sent at the open. ADR 0017 records the
choices; what depends on the user is in #107 and #55.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 09:49:14 +01:00
Alby96andClaude Opus 5.5 61878c2023 Keep broken model answers and articles from stopping the news (refs #58, refs #61)
The independent review of phase 7 found that an answer with half a Unicode
character, or of an unexpected shape, escaped the validation as an exception:
its cost was lost, it was paid again every two minutes past the daily cap, and
the diary of the news stopped. The same happened to the whole round with an
article cut in the middle of an emoji.

Such answers are now refused like any other, the cost is written before the
request leaves and settled with what the service used, never clamped to the
estimate, and neither the analyst nor one source can stop the others. The
estimate counts every byte as a token, so it is a true worst case. Summaries
with bare domains or invisible characters are refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 09:24:36 +01:00
Alby96 ae4ae4ed92 Merge pull request 'Esercitazione della guardia: il motore della prova non esce più dal computer' (#103) from drill-offline into main
ci / test (postgres) (push) Successful in 3m42s
ci / image (push) Successful in 2m0s
ci / test (sqlite) (push) Successful in 4m28s
2026-11-28 18:45:34 +01:00
Alby96 a7ff173771 Merge pull request 'CI: l'esercitazione della guardia aspetta che la vendita sia partita' (#101) from guard-drill-sale into main
ci / test (postgres) (push) Successful in 3m36s
ci / image (push) Successful in 1m32s
ci / test (sqlite) (push) Successful in 4m12s
2026-11-28 18:45:25 +01:00
Alby96 974ebd863f Merge remote-tracking branch 'origin/main' into drill-offline
ci / test (postgres) (push) Successful in 4m15s
ci / test (postgres) (pull_request) Successful in 4m1s
ci / image (push) Successful in 1m52s
ci / image (pull_request) Successful in 1m6s
ci / test (sqlite) (push) Successful in 4m20s
ci / test (sqlite) (pull_request) Successful in 4m28s
# Conflicts:
#	src/Anubis/Data/MarketDataService.cs
2026-11-28 16:35:02 +01:00
Alby96 b49e3c2899 Merge remote-tracking branch 'origin/main' into guard-drill-sale
ci / test (postgres) (pull_request) Successful in 3m41s
ci / image (pull_request) Successful in 2m8s
ci / test (postgres) (push) Successful in 3m40s
ci / image (push) Successful in 57s
ci / test (sqlite) (pull_request) Successful in 4m21s
ci / test (sqlite) (push) Successful in 4m1s
2026-11-28 16:31:46 +01:00
Alby96 181b329303 Merge pull request 'Fase 7: analista facoltativo con il modello linguistico (#58)' (#106) from fase-7 into main
ci / test (postgres) (push) Successful in 3m32s
ci / image (push) Successful in 1m29s
ci / test (sqlite) (push) Successful in 4m4s
2026-11-28 16:04:49 +01:00
Alby96andClaude Opus 5.5 dcebfb61e1 Read the news again with an optional language model, capped and schema-bound (refs #58)
ci / test (postgres) (push) Successful in 3m33s
ci / image (push) Successful in 2m55s
ci / test (postgres) (pull_request) Successful in 3m42s
ci / image (pull_request) Successful in 2m2s
ci / test (sqlite) (push) Successful in 4m16s
ci / test (sqlite) (pull_request) Successful in 4m36s
The analyst of SPEC 10.2 point 5 sends the fresh stories about held and
candidate instruments to Anthropic, an OpenAI-compatible service or Ollama,
eight to a request, over plain HTTP with no SDK. The news text travels as
escaped JSON data; only the appendix B schema is kept, instruments not
already linked are dropped, and a verdict can only add a restriction.
Each request goes out only if its worst-case cost still fits under the
daily cap; verdicts are cached by content hash. Without a key nothing is
asked and the rules work as before. ADR 0014 point 15.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 12:41:39 +01:00
Alby96 4449ec7a0a Merge pull request 'Fase 7: schermata Notizie e mercato e impostazioni di notizie e calendario (#60)' (#105) from fase-7 into main
ci / test (postgres) (push) Successful in 4m24s
ci / image (push) Successful in 1m34s
ci / test (sqlite) (push) Successful in 5m19s
2026-11-17 16:50:56 +01:00
Alby96andClaude Opus 5.5 959fe6ccba Show the news and the market, and set news and calendar from the settings (refs #60)
ci / test (postgres) (pull_request) Successful in 9m38s
ci / test (sqlite) (pull_request) Successful in 5m26s
ci / image (pull_request) Successful in 2m23s
ci / test (postgres) (push) Successful in 9m28s
ci / image (push) Successful in 1m56s
ci / test (sqlite) (push) Successful in 5m3s
The news screen of SPEC 13 lists what the bot read in the last 24 hours and
what it did about each story, with the three filters of the mockup, the mood
of the market, the calendar with the effect of each event, the sources and
the spending of the day. Each note of the bot now keeps its action sentence
and the end of its restriction, so the screen shows the decision as it was.

Settings gain a news section: the rows of SPEC 10.5, the sources (enable and
trust), the key and daily cap of the language model, the Finnhub and FRED
keys and the central bank meetings. The demo seeds the F.9 data and matches
the mockup; the overview tile now shows the real news that matter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 15:43:09 +01:00
Alby96 f4f10a46dd Merge pull request 'Fase 7: regole di 10.5 e stato per strumento (#59)' (#104) from fase-7 into main
ci / test (postgres) (push) Successful in 3m39s
ci / image (push) Successful in 1m39s
ci / test (sqlite) (push) Successful in 4m33s
2026-11-17 14:36:41 +01:00
Alby96andClaude Opus 5.5 b087dd215b Apply the SPEC 10.5 news and calendar rules to new entries (refs #59)
ci / test (postgres) (push) Successful in 8m20s
ci / test (postgres) (pull_request) Successful in 8m13s
ci / image (push) Successful in 2m5s
ci / image (pull_request) Successful in 2m6s
ci / test (sqlite) (push) Successful in 4m25s
ci / test (sqlite) (pull_request) Successful in 4m38s
Confirmed serious events hold new purchases of an instrument for 72 hours
and keep its stop where it is; confirmed negative news holds them for 24
hours; an unconfirmed rumour only gets a diary note and a check two hours
later. Coming earnings keep mean reversion out and macro figures hold
entries around their release, now in the live engine too. The strictest
row wins, every row can be switched off in the settings, and windows count
from the fact, so after an absence only effects still in force apply.

A held purchase moves to the end of its restriction while the order is
still valid and keeps its first due time, so the price drift check of
SPEC 5.6 still compares with the decision. Each restriction is written to
the diary once, with its motive. The per-instrument state keeps the tone
over one and three days, the story count against its norm and the active
restriction.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 17:39:26 +01:00
Alby96andClaude Opus 5.5 a5a6918dae Keep the guard drill's engine off the internet (refs #102)
ci / test (postgres) (push) Successful in 3m38s
ci / test (postgres) (pull_request) Failing after 4m7s
ci / image (pull_request) Skipped
ci / image (push) Successful in 1m25s
ci / test (sqlite) (push) Successful in 4m6s
ci / test (sqlite) (pull_request) Successful in 4m24s
Since Phase 7 the drill's child engine read the real news feeds every two
minutes and downloaded the ONNX tone model, and it already asked the ECB,
the mood and calendar sources and the Binance archives. The drill is meant
to stay on the computer (ADR 0012 point 5) and that extra work loaded the
slow CI runner while the drill timed the engine.

Under a guard with the drill's loopback OKX, the market data now runs
offline: no news job, no model, and every request goes through a
loopback-only handler that answers anything else with a final 403, so no
source retries with back-off and the engine keeps its pace. No new
variable: the drill is recognised by the same conditions as its fake OKX.

The drill gains an eighth check (no news read, no model downloaded), and a
test runs every market data job, a history round and a news round as the
drill builds them and finds only loopback requests on the network. ADR 0016.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 09:41:45 +01:00
Alby96andClaude Opus 5.5 4e0711c988 Start the drill's guard watch only once the sale has left (refs #100)
ci / test (postgres) (push) Successful in 4m2s
ci / test (postgres) (pull_request) Successful in 4m24s
ci / test (sqlite) (pull_request) Successful in 6m24s
ci / image (push) Successful in 2m50s
ci / image (pull_request) Successful in 1m31s
ci / test (sqlite) (push) Successful in 4m45s
The drill's sale leaves only at the engine's whole-minute pulse, up to a minute
after the engine is running. The guard was already watching with a 20 s silence,
while a turn of the main loop may take up to 45 s by design. On a loaded runner
(run 331) a slow turn made the guard step in at 15:19:56, before the sale due at
15:20:00, so the half-done sale the drill checks never existed.

The drill now waits for the sale order to be taken by the broker (or the engine
to die) before it starts the guard's watch. The engine's messages reach the guard
all along, the seven checks stay the same, and the waits go through IClock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:48:55 +01:00
Alby96 a77aa1b7eb Merge pull request 'CI: il PostgreSQL dei test non si riavvia più a metà della suite' (#99) from ci-postgres into main
ci / test (postgres) (push) Successful in 3m39s
ci / image (push) Successful in 49s
ci / test (sqlite) (push) Successful in 4m57s
2026-11-15 16:27:28 +01:00
Alby96andClaude Opus 5.5 63ae9d580a Merge main into ci-postgres (refs #98)
ci / test (postgres) (push) Successful in 4m8s
ci / test (postgres) (pull_request) Successful in 3m44s
ci / test (sqlite) (pull_request) Failing after 5m38s
ci / image (pull_request) Skipped
ci / image (push) Successful in 1m6s
ci / test (sqlite) (push) Successful in 5m16s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 15:59:26 +01:00
Alby96 a66e3439d8 Merge pull request 'Fase 7: raccolta, collegamento e primo giudizio delle notizie, con il classificatore ONNX' (#97) from fase-7 into main
ci / test (postgres) (push) Failing after 7m44s
ci / image (push) Skipped
ci / test (sqlite) (push) Successful in 5m36s
2026-11-15 15:34:38 +01:00
Alby96andClaude Opus 5.5 74809068af Turn off disk syncs on the CI test PostgreSQL (refs #98)
ci / test (postgres) (push) Successful in 3m13s
ci / test (postgres) (pull_request) Successful in 3m41s
ci / test (sqlite) (pull_request) Successful in 4m28s
ci / image (push) Successful in 1m46s
ci / image (pull_request) Successful in 1m1s
ci / test (sqlite) (push) Successful in 4m23s
With the restarts gone, a rerun still failed 7 tests on read timeouts. The
server log shows why: every DROP DATABASE of the tests forces an immediate
checkpoint, one at a time, and on the runner's disk the sync alone took up
to 37 seconds, so queued drops passed the client's 30-second timeout. The
service is a throwaway, so initdb now sets fsync, synchronous_commit and
full_page_writes off. docker-compose.yml and real databases keep them on.
ADR 0015 updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 15:27:48 +01:00
Alby96andClaude Opus 5.5 73f2345047 Back to the normal CI jobs after the stress run (refs #98)
ci / test (sqlite) (pull_request) Successful in 4m56s
ci / test (postgres) (push) Failing after 9m37s
ci / image (push) Skipped
ci / test (postgres) (pull_request) Successful in 8m44s
ci / image (pull_request) Successful in 1m21s
ci / test (sqlite) (push) Successful in 4m34s
Reverts the temporary three-round job. With --init and the shorter pg_isready,
three PostgreSQL suites on one server passed with no restart (run 321), where
the same run without them restarted the server four times (run 315). The
Docker events in the service log step stay.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 14:25:59 +01:00
Alby96andClaude Opus 5.5 6ea303e1dc Run the test PostgreSQL behind an init and let pg_isready give up before Docker (refs #98)
ci / test (postgres) (pull_request) Skipped
ci / image (pull_request) Waiting for needed jobs
ci / test (postgres) (push) Successful in 23m7s
ci / image (push) Skipped
The server log of a failing job shows every restart as 'untracked child
process exited with exit code 2'. A health check that outlives its 3-second
timeout leaves pg_isready to PostgreSQL, which is PID 1 in its container;
when pg_isready exits the postmaster takes it for a crashed backend and
restarts every connection. --init reaps such orphans, and pg_isready -t 5
under a 15-second timeout is never cut off. Same change in docker-compose.yml.
ADR 0015.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 13:03:44 +01:00
Alby96andClaude Opus 5.5 1aede2fc1c Let the server test accept the news feeds and the pinned model host (refs #57)
ci / test (postgres) (push) Successful in 11m31s
ci / test (postgres) (pull_request) Successful in 10m7s
ci / test (sqlite) (pull_request) Successful in 5m13s
ci / image (push) Successful in 3m12s
ci / image (pull_request) Successful in 1m46s
ci / test (sqlite) (push) Successful in 5m26s
The news collector runs alongside the market data in the server test, so its
feeds and the Hugging Face download of the classifier can reach the fake network
before the assertion: they are the hosts the code declares, nothing else.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 12:44:05 +01:00
Alby96andClaude Opus 5.5 72f4cbe0a5 TEMPORARY: run the PostgreSQL suite three times on one server, push only (refs #98)
ci / test (postgres) (pull_request) Skipped
ci / image (pull_request) Waiting for needed jobs
ci / test (postgres) (push) Failing after 11m1s
ci / image (push) Skipped
Two clean runs did not show the restart. This collects the server log of a
failure sooner and lists Docker's events for the service container (oom, kill,
die). Reverted before the merge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 12:13:47 +01:00
Alby96andClaude Opus 5.5 78e77818eb Read the tone of English headlines with the pinned ONNX model of SPEC 4.5 (refs #57)
ci / test (postgres) (push) Failing after 6m20s
ci / image (push) Skipped
ci / test (postgres) (pull_request) Failing after 4m51s
ci / test (sqlite) (pull_request) Successful in 5m29s
ci / image (pull_request) Skipped
ci / test (sqlite) (push) Failing after 5m59s
The classifier is distilroberta-finetuned-financial-news-sentiment-analysis in
Xenova's quantized ONNX export, pinned at revision e6953e30 and checked by size and
SHA-256.

- Model download: the model is not in the repository. The news job downloads it in
  the background into the models folder of the data directory, the first time, and
  retries after 6 hours if that fails. Until then the keywords judge alone, as
  SPEC 10.3 requires.
- Tokenizer: RoBERTa's byte-level BPE travels inside the DLL, read with
  BpeTokenizer and the RoBERTa pre-tokenizer. CodeGenTokenizer.Create adds ids for
  runs of spaces that the model rejects. No special tokens are recognised in
  untrusted text.
- Token check: the test compares the ids on 14 headlines with an independent copy
  of the GPT-2 encoder run on the same files.
- Model test: it reads the tone of clear headlines at 23-24 ms per title on one
  thread. It runs where the model is already downloaded and is skipped in CI.

Microsoft.ML.OnnxRuntime 1.31.1 and Microsoft.ML.Tokenizers 2.0.1 come from the
ADR 0004 list. Google.Protobuf joins the known indirect dependencies.

Anubis and Anubis.Server now declare win-x64 among their runtime identifiers, so
their lock files hold the Windows native packages. Publishing the Windows zip no
longer rewrites the lock files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 12:00:54 +01:00
Alby96andClaude Opus 5.5 0a9a8a38ec Print the PostgreSQL service log at the end of the CI job (refs #98)
ci / test (postgres) (push) Successful in 8m16s
ci / test (postgres) (pull_request) Successful in 11m38s
ci / test (sqlite) (pull_request) Successful in 4m58s
ci / image (push) Successful in 1m42s
ci / image (pull_request) Successful in 47s
ci / test (sqlite) (push) Successful in 5m16s
The job log shows the tests losing every connection but not why the server
went into recovery. A new tasks command reads the service container's log,
state and memory through the Docker socket the runner mounts in the job.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 11:41:31 +01:00
Alby96andClaude Opus 5.5 5f0ce6b172 Record the news collection and the first judgement in the project state (refs #56 #57)
ci / test (postgres) (pull_request) Successful in 9m37s
ci / test (sqlite) (pull_request) Successful in 4m20s
ci / image (pull_request) Successful in 2m32s
ci / test (postgres) (push) Failing after 9m18s
ci / image (push) Skipped
ci / test (sqlite) (push) Successful in 4m24s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 18:57:49 +01:00
Alby96andClaude Opus 5.5 9ee2367693 Judge every article locally: serious cases by keywords, tone grade and importance (refs #57)
This is the first judgement of SPEC 10.2 point 4, without a language model.

- Serious cases: cyberattack, suspension, fraud, bankruptcy, investigation and
  delisting are found by whole-word phrases in English and Italian, so an
  Italian headline still counts.
- Tone: the five tone grades follow the bounds of the specification.
- Importance: 4 for a serious case, 3 for a negative tone, 2 when the article is
  linked to an instrument, otherwise 1.
- Classifier: it sits behind IToneClassifier and is asked only for English
  titles. The ONNX model plugs in there; without it the tone stays unknown and
  everything else works.

Every article stores its score, case and importance. Each story keeps the mean
score, the case and the highest importance.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 18:57:49 +01:00
Alby96andClaude Opus 5.5 f1ba452aba Collect news from the SPEC 4.4 feeds, group retold stories and link them to instruments (refs #56)
News is the first input of Phase 7. Every two minutes the "notizie" job asks each
enabled feed conditionally and backs off a failing one up to an hour.

- Parsing: RSS 2.0, RSS 1.0 and Atom are read without DTDs or entity expansion, so a
  hostile feed reads nothing from disk.
- Deduplication: articles are deduplicated by canonical URL.
- Grouping: retold titles join one story by word similarity within 48 hours, and
  independent publishers are counted by registrable domain.
- Linking: stories are linked to instruments by source symbols, cashtags, exchange
  tickers, coin tickers and capitalised company names; to the crypto or equity class
  or to the market by theme; to the source topic as a fallback.

ADR 0014 records the thresholds. The tests read a synthetic archive in each source's
real format and run on both engines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 18:57:49 +01:00
Alby96 25e71b679f Merge pull request 'Raccolta dei dati per l'analisi e release di prova per Windows' (#96) from diagnostica into main
ci / test (postgres) (push) Failing after 5m55s
ci / image (push) Skipped
ci / test (sqlite) (push) Successful in 4m18s
2026-11-14 18:55:56 +01:00
Alby96andClaude Opus 5.5 9cf386d08b Count WebSocket upgrades as successful calls and tidy the report (refs #95)
ci / test (postgres) (pull_request) Successful in 9m14s
ci / test (postgres) (push) Successful in 9m40s
ci / image (pull_request) Successful in 2m14s
ci / image (push) Successful in 54s
ci / test (sqlite) (push) Successful in 4m11s
ci / test (sqlite) (pull_request) Successful in 4m12s
Trying the packaged release showed three things to fix: a 101 answer that opens a
WebSocket was counted as a failure, the duration buckets were too coarse around
the usual 200-500 ms of the brokers, and the report mixed CRLF and LF lines and
named SQLite only by its version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 18:05:57 +01:00
Alby96andClaude Opus 5.5 6e365673b8 Collect diagnostics for the analysis of a long run and package a Windows trial release (refs #95 #55)
ci / test (postgres) (push) Successful in 6m25s
ci / test (postgres) (pull_request) Failing after 6m4s
ci / image (push) Canceled after 0s
ci / test (sqlite) (pull_request) Successful in 4m34s
ci / image (pull_request) Skipped
ci / test (sqlite) (push) Successful in 4m1s
The 48-hour soak run at home kept being cut short by the host, never by Anubis.
The user will instead run a release for as long as they like and paste back a
report, so the bot now records what that report needs (ADR 0013).

- Every 5 minutes and at each start, a process sample goes to diagnostic_samples:
  memory, GC, threads, handles, CPU, exceptions, database size, log warnings and
  errors, and outbound HTTP calls by destination with duration buckets, read from
  the System.Net.Http meter without any new package.
- Every scheduled job run goes to job_runs. Both tables keep 30 days.
- The Markdown report (at most 60 KB, redacted, user folders masked) adds
  findings, the soak checks, starts and silences, jobs, calls, grouped log
  warnings and errors, and resources over time with their slopes. It comes from
  "anubis diagnostics", GET /api/diagnostica.md and a button in Diario e sistema.
- New {long} column token: SQLite STRICT tables reject BIGINT.
- "tasks release-win" builds the trial zip with a start script, a script that
  writes the report, and Italian instructions. Version 0.7.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 17:57:03 +01:00
Alby96 32673007a2 Merge pull request 'Prova di 48 ore: stop di Docker di 15 minuti e come evitarlo' (#94) from prova-48h-docker into main
ci / test (postgres) (push) Successful in 6m6s
ci / image (push) Successful in 1m6s
ci / test (sqlite) (push) Successful in 3m14s
2026-11-13 09:08:03 +01:00
Alby96andClaude Opus 5.5 e561245d4e Keep the 48-hour run going after Docker stopped with the Claude app (refs #53 #55)
ci / test (postgres) (pull_request) Successful in 6m4s
ci / test (postgres) (push) Successful in 6m27s
ci / image (pull_request) Successful in 1m3s
ci / image (push) Successful in 1m5s
ci / test (sqlite) (pull_request) Successful in 3m37s
ci / test (sqlite) (push) Successful in 4m1s
On 12 November at 23:37 Docker Desktop stopped for 15 minutes. It had
been started from the Claude app's shell after the PC switched off, so it
lived in the app's process job and died when the app updated itself. The
bot resumed alone and recorded the absence.

The run is not restarted from zero: a fresh start would no longer span
two US sessions before the weekend. Instead two reports are read: the 48
uninterrupted hours from 23:57, which must be regular, and the whole run
from 21:02, whose only allowed failure is that 15-minute stop. Docker is
now started through WMI, outside the app, and SVILUPPO.md says how.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 23:59:49 +01:00
Alby96 829fbd2eba Merge pull request 'Prova di 48 ore ripartita dopo lo spegnimento del PC' (#93) from prova-48h-ripartita into main
ci / test (postgres) (push) Successful in 7m4s
ci / image (push) Skipped
ci / test (sqlite) (push) Failing after 1m0s
2026-11-12 23:23:08 +01:00
Alby96andClaude Opus 5.5 f59eee8632 Restart the 48-hour run after the PC switched off (refs #53 #55)
ci / test (postgres) (pull_request) Successful in 8m29s
ci / image (pull_request) Successful in 1m25s
ci / test (postgres) (push) Successful in 7m25s
ci / image (push) Successful in 1m32s
ci / test (sqlite) (pull_request) Successful in 4m18s
ci / test (sqlite) (push) Successful in 4m6s
The first attempt ran 22 hours: on 12 November at 19:49 the PC switched
off without a clean shutdown (power or a machine hang, no bug check).
When it came back the bot resumed by itself and wrote the absence in
the diary, but a 48-hour run needs no gaps, so it started again from
zero at 21:02. STATE gives the new window and command; the first
attempt's report and database are kept under artifacts/prova-48h.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 21:03:56 +01:00
Alby96 7291f5d15b Merge pull request 'Fase 6 — Motore dal vivo in simulazione' (#92) from fase-6 into main
ci / test (postgres) (push) Successful in 10m0s
ci / image (push) Successful in 1m31s
ci / test (sqlite) (push) Successful in 4m48s
2026-11-11 22:30:53 +01:00
Alby96andClaude Opus 5.5 9a4e31aa48 Record the start of the 48-hour run and how to read its report (refs #53)
ci / test (postgres) (push) Successful in 9m13s
ci / image (push) Successful in 1m50s
ci / test (postgres) (pull_request) Successful in 11m4s
ci / image (pull_request) Successful in 1m2s
ci / test (sqlite) (push) Successful in 4m46s
ci / test (sqlite) (pull_request) Successful in 4m57s
The run started on 11 November 2026 at 21:44 Italian time in the
anubis-prova container, from the image of this branch. STATE says when
and how to make the report so that it spans both US sessions; its check
is the first step of Phase 7 (#55).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 21:49:12 +01:00
Alby96andClaude Opus 5.5 1c7205024f Count short gaps at the edges of the soak window as covered (refs #53)
The scheduler's first jobs finish about a minute after the bot starts, so
a run started exactly at the window's start was reported as covering
slightly less than 48 hours. A gap shorter than the allowed silence
(15 minutes) at either edge now counts as covered, like one in the middle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 21:40:41 +01:00
Alby96andClaude Opus 5.5 be6d5fb91f Let a late decision wait for its bars; read the soak run's continuity from jobs and absences (refs #49 #53)
Starting the 48-hour run showed two defects.

After an absence, a decision made past 12:00 UTC was written off as
"no data" at the first pulse, because the data step had not yet brought
the bars of the close: the recovered decision was lost. A late decision
now asks for its bars and waits up to 30 minutes for them. The 20-hour
absence test pulses before the bar arrives and fails without the fix.

The soak report measured coverage and silences from reconciliation
rows, but a clean round writes none, so a healthy run would have been
reported as never covered. It now reads when the scheduled jobs first
ran and last finished, the absences written at each restart, the guard
interventions, and each account's status (reconciled within the last
15 minutes and normal). The test no longer fakes a row every 5 minutes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 21:35:03 +01:00
Alby96andClaude Opus 5.5 2185a0b36b Fix the defects found by the Phase 6 review (refs #47 #48 #49 #51 #52 #54)
An independent review of the phase found nine defects. The ones that
could lose money or orders:

- Exits at the close of equity_meanrev are now planned orders written in
  the same transaction that claims the decision, so a restart can neither
  lose them nor send them twice. A sell with a deadline starts aggressive.
- Resume also finds a planned order not yet linked to its execution
  (restart between sending and linking) and closes it before re-planning.
- An account is "ready" only after adopting the guard's stops, checking
  the key, reconciling, resuming and aligning stops. Until then nothing is
  decided on it or sent to it, and the loop retries its startup each
  minute. The guard's note is deleted only when every stop it placed is in
  the ledger.
- Each account's turn is cut after 45 s (60 s for a retried startup), so a
  slow broker no longer silences the heartbeat until the guard kills a
  healthy engine; the beat is also withheld when the scheduler has been
  silent for 30 minutes.

Smaller ones: a stock decision made after the open is marked late; the
Telegram loops survive unexpected errors; a long absence is shown on the
Panoramica until "Ho visto" (SPEC 5.6); plain-http heartbeats are only
accepted to home-network addresses; the soak report gives a daily close
30 minutes to be decided before expecting it.

ADR 0012 point 12 records these choices; #51 and the two screen criteria
are ticked in the roadmap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 21:10:28 +01:00
Alby96andClaude Opus 5.5 3d174931e9 Add the endurance run report and record the Phase 6 choices (refs #53 #54)
"anubis soak" reads the bot's records over a time window and says whether
the run kept control. It changes nothing, so it can run beside the working
bot with docker exec. It exits with 4 when something needs a look. It
checks:
- the hours covered and silences longer than 15 minutes;
- orders or decisions made twice;
- unexplained reconciliation differences and each account's last outcome;
- absences and guard interventions;
- one crypto decision per daily close.

ADR 0012 records what the specification leaves open in this phase: the
live engine shares the backtest's decision call, run keys, recovery after
an absence, the guard and its drill seams, the diary templates, the
"senza bot" comparison, Telegram and the heartbeat, the screens and the
endurance run. ROADMAP ticks the Phase 6 items and criteria with the tests
that prove them, STATE moves on to Phase 7, and SVILUPPO explains the
guard and the report.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 20:36:22 +01:00
Alby96andClaude Opus 5.5 9ae107000b Ignore late messages from a replaced engine; list only moves in the morning summary (refs #48 #52)
The guard drill failed once under load. The pipe of the killed engine
delivered a late "running" beat after the restart. The drill took the new
engine as ready and stopped it before it had cancelled the half-done sale
and put the stop back.

The same late message could have made a crash of the new engine look like
a planned stop, which the guard never restarts. Each engine the guard starts
now has a number, and messages from a replaced one are ignored. The drill
also waits until the restart's work is in the database before it checks.

The morning Telegram summary listed every job due today, including the
background ones that run every minute. It now lists only the bot's moves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 20:34:25 +01:00
Alby96andClaude Opus 5.5 e96ca70a1a Build the Panoramica and Diario e sistema screens as in the mockups (refs #51)
Panoramica now follows mockup 01. Below "Finora" and "Adesso e dopo" it
shows:
- the two account cards with the invested/cash bar and a 30-day trend;
- the four risk limits;
- the open positions by value;
- the strategies;
- the news, learning and system tiles.

On the phone it follows mockup 09: Conti as a list, four positions with
"Vedi le altre", and two limits. Outside the demo, news and learning say
they are not active yet (Phases 7 and 8). The next moves are the scheduler's
moves only, no longer every interval job.

Diario e sistema follows mockup 08:
- the diary grouped by day, with search and filter chips (plain links, no
  JavaScript) and older days on request;
- how each component is doing;
- the scheduled jobs;
- the host's processor, memory and disk;
- the technical logs as a zip, for signed-in users only.

In demo mode the screens show the values of appendix F.10. Tests cover the
demo figures, the filters and search, and the logs download.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 20:32:19 +01:00
Alby96andClaude Opus 5.5 84c540786c Send Telegram notices, answer phone commands and call the heartbeat (refs #52)
Every notice is written to the queue in the same transaction as what it
tells, then sent every ten seconds. Each has a state: pending, sent, or
failed with its error. Network failures and 429s are retried with growing
pauses (Telegram's own wait when it gives one). Refusals are final. A notice
that could not leave within a day is given up instead of arriving late. Every
fill now also reaches the phone, and so do pause, resume and restart.

Commands are read by long polling and obeyed only from the configured chat
and only when fresh, so yesterday's /pausa never pauses today. They are
/stato, /posizioni, /oggi, /pausa, /riprendi, /ferma (confirmed with
/conferma within two minutes) and /aiuto. Restarting after "Ferma tutto",
real money, limits and keys stay in the interface.

Also added:
- the heartbeat call every minute when an address is configured;
- the morning summary at 08:00, caught up within four hours;
- an optional hourly or evening status;
- a Telegram section in Impostazioni: test-before-save, a test button, the
  queue's state and the last successful heartbeat;
- on desktop, the first-run page recommends the heartbeat.

Tests run against a fake Telegram server, including the commands through
the real server.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 19:53:55 +01:00
Alby96andClaude Opus 5.5 d00dfbd32f Add the guard that watches the engine and protects positions (refs #48)
The guard (SPEC 9.3, 9.4) is now the container's main process and the parent
of the engine. It listens on a named pipe for the engine's heartbeat and
startup steps, and steps in after two minutes of silence, ten minutes of a
startup that does not move, or an exit without notice. It stops the engine,
cancels our purchases and sales left open on demo accounts, puts back the
stops the positions need from the state file the engine writes every ten
seconds, writes a note, warns the user and restarts the engine without any
injected fault. The third forced restart within an hour writes the STOP
file. The container's stop is passed on to the engine, which closes in order.

At restart the engine adopts the guard's stops before reconciling, cancels
the orders it left open and plans again the exits already decided, so the
rules of SPEC 5.6 apply to them.

The acceptance test blocks the main loop right after a sale leaves: in
process on a demo-like broker, and with real processes in the drill, which
also runs inside the Docker image (tasks ci and the CI workflow). The guard
uses the ASP.NET shared runtime so both programs share /app.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 19:36:32 +01:00
Alby96andClaude Opus 5.5 680cab4bb6 Recover missed work after an absence by the rules of SPEC 5.6 (refs #49)
At the start the host measures how long the bot was away from the last
job that finished, records the absence and writes it in the diary; one
longer than a day is kept for the Panoramica until the user has seen it.

A job can now say how a run missed while the bot was off is treated: the
nightly backup, the exchange rates, the market calendar and the cleanup
run once at the restart, queued, however late; a job with a deadline is
skipped past it and the diary says so. Corporate actions are read before
the reconciliation puts any stop back. A decision the engine makes late
because of an absence is written in the diary as recovered, as are the
orders it releases late; entries that moved too far or expired are
dropped with their reason.

Tests switch the bot off for 3 hours, 20 hours and 3 days with a manual
clock and check each of those rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 18:38:50 +01:00
Alby96andClaude Opus 5.5 41e067e7d1 Run the strategies live in simulation with the live engine (refs #47)
The live engine makes each decision at its time of SPEC 5.5 through the
same DecideOnce call the backtest uses, so live and backtest cannot drift:
the crypto close at 00:05 UTC, the stock signals 20 minutes after the
close, the meanrev exits 5 minutes before it, the stock orders and the
daily stops at the open. Each decision has a run key written in the same
transaction as its decision rows, planned orders and diary lines, and each
planned order's id gives the order key, so a restart never decides or
sends anything twice. Entries recovered late are dropped when the price
has moved too far.

The engine runs from the scheduler once the accounts are reconciled. The
IEX stream follows held stocks, planned orders and SPY during the session,
and the stock simulator's day orders now expire at the close.

Tests: parity with the backtest for crypto_trend (40 days) and
equity_meanrev (6 weeks), and a 14-day run with the network down, a lost
answer, a restart mid-order and the database unreachable, ending
reconciled with no duplicate orders, on SQLite and PostgreSQL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 18:28:08 +01:00
Alby96andClaude Opus 5.5 98ee504dab Write the diary from fixed templates and add the "senza bot" comparison (refs #50)
The diary needs sentences in the tone of appendix B, built only from what
happened. DiaryText holds the templates the live engine will use: fills
with the result of the trade they close, raised stops, the daily crypto
close, the stock signals, observation signals, recovery and absence. The
reason-code sentences move from the server into the library
(ReasonCatalog) so the engine and the screens share them; a test checks
that every reason constant has its sentence. The diary gets the kinds of
the Diario screen: Ordini, Decisioni, Sistema, Notizie, Apprendimento.

The comparison of SPEC 7.5 invests each capital flow on its day, 40% in
BTC/EUR and 60% in SPY adjusted and converted at the ECB rate, and never
touches it; a withdrawal sells both in the proportion they reached. Prices
are the closes of the day before, so a deposit is never a gain. Without
the SPY history (no Alpaca keys) the photograph leaves it empty rather
than show half a comparison. The Panoramica now takes the flows out of
the "Senza bot" result, as it already did for the bot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 17:46:28 +01:00
Alby96 e3c9eae65b Merge pull request 'Fase 5 — Strategie, portafoglio e rischio' (#91) from fase-5 into main
ci / test (postgres) (push) Successful in 5m34s
ci / image (push) Successful in 5s
ci / test (sqlite) (push) Successful in 3m11s
2026-11-11 17:30:08 +01:00
Alby96andClaude Opus 5.5 fc5df0146e Prepare strategies before the host is ready; stop demo servers first (refs #44 #45)
ci / test (postgres) (push) Successful in 4m39s
ci / image (push) Successful in 56s
ci / test (postgres) (pull_request) Successful in 5m27s
ci / image (pull_request) Successful in 10s
ci / test (sqlite) (push) Successful in 2m57s
ci / test (sqlite) (pull_request) Successful in 3m14s
Loading the outcomes before "ready" was not enough: on a fresh database the
strategy rows did not exist yet, so the load did nothing and CI run 220
failed the same way on PostgreSQL. The new TradingService.PrepareAsync
creates accounts and strategies, then loads the outcomes; the host runs it
before it is ready and logs a failure without blocking the interface.
StartAsync repeats it, which changes nothing.

The demo tests deleted the demo folder while the server still held its
SQLite file, which Windows refuses at random. They now stop the server
first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 17:19:15 +01:00
Alby96andClaude Opus 5.5 dc1ba4e701 Load the backtest outcomes before the host is ready (refs #44 #45)
ci / test (postgres) (push) Failing after 4m53s
ci / image (push) Skipped
ci / test (sqlite) (push) Successful in 3m4s
The trading service loaded the outcomes in the background after the host
reported "ready", so for a moment Strategie showed every strategy as
without a backtest. CI run 219 caught it on SQLite. The host now loads
them before it is ready; the call is idempotent, so the one at trading
start changes nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 17:01:25 +01:00
Alby96andClaude Opus 5.5 9ac159a7db Fix the defects of the Phase 5 review (refs #41 #42 #43 #44 #45 #46)
ci / test (postgres) (push) Successful in 3m52s
ci / image (push) Skipped
ci / test (sqlite) (push) Failing after 2m41s
An independent review found these, now fixed and tested:

- Risk limits could be raised through PUT /api/settings without the
  phrase and the password. The API now refuses risk keys.
- The reference equity counted results twice after reduced to real and
  after a demotion. Each ledger now keeps a baseline, and carried results
  stay in the ledger's currency until the reference is computed.
- An instrument could be bought by a second strategy in the same account
  (SPEC 8.6), and purchases under way did not hold their cash, so several
  purchases sent together could exceed it. Both are refused or shrunk now.
- After an automatic trip of the switch there was no way to restart from
  the interface. Rischio now shows the trip of both worlds and the restart.
- The fresh password of SPEC 12.4 could be tried without limit. Five wrong
  attempts in 15 minutes now lock it.
- Observation to simulation skipped the 90 days of live signals.
- A new build changed the qualification of a strategy with real money,
  "Ferma tutto" counted as a critical incident, raising risk ignored
  demotion conditions in progress, and weekends counted as stock sessions.
- The 12.4 confirmation now summarises capital, first purchases and limits,
  and live strategies show the gap with their simulated twin.

The backtest converts each bar with the rate fixed before it opens, the
day before, and the report now counts how often correctives and risk
changed a decision. crypto_trend is still not passed: the broad universe
now falls 32.8%. The outcome file also keeps the qualified parameters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 16:48:41 +01:00
Alby96andClaude Opus 5.5 17d6b8db38 Record the Phase 5 choices and close the roadmap items (refs #46)
ADR 0011 collects what the specification leaves open or refines in this
phase: strategies shared by backtest and live, correctives and risk inside
the backtests, the risk engine that only refuses or shrinks, the stages as
the only way to real money, the euro history and the protocol of the base
backtests, and the honest "not passed" of crypto_trend.

ROADMAP ticks the Phase 5 items and criteria with the tests that prove
them; STATE moves to Phase 6.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 16:19:35 +01:00
Alby96andClaude Opus 5.5 13f9c42f61 Add the Operazioni, Strategie and Rischio screens (refs #45)
The three screens follow mockups 03, 04 and 07.

Operazioni shows the balance of the closed trades, filters, a CSV export,
and for each trade why it was bought and sold. The reasons come from the
decision codes through fixed Italian templates.

Strategie shows the four stages towards real money, a card per strategy
with its requirements, the procedure of SPEC 12.4, and why each strategy in
observation waits. A strategy that failed its backtest cannot be moved into
the simulation.

Rischio shows the emergency switch, the automatic blocks, the use of each
limit, the fall from the peak, the scenarios and the risk events. Stop,
close and restart now go through the risk engine. A restart is refused
while the STOP file exists.

Impostazioni gains the limits, the day-trade guard and the scenarios.
Lowering a limit is always allowed. Raising a limit or the entrusted capital
while a strategy uses real money needs the phrase and the password.

The demo now holds the decisions behind its trades, the 58 days of
simulation and the indices of its curves, so it matches the mockups.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 16:14:44 +01:00
Alby96andClaude Opus 5.5 7041533ce2 Add the honest backtests of the base strategies (refs #44)
crypto_trend now has a backtest report and an outcome file, computed by
"anubis backtest base" on the Binance daily archives from 2019 to October
2026. Prices are converted from USDT to euro with the ECB rate of the day,
and delisted coins stay in the universe, so survivors do not flatter the
result. The protocol runs the broad universe and BTC, ETH and SOL, with
costs doubled and tripled and buy and hold beside. Both universes must pass.

The outcome is "not passed": the broad universe falls 29.1% (limit 25%) and
the narrow one has a probability of overfitting of 0.84 (limit 0.40). The
strategy therefore stays in observation. The stock strategies wait for the
Alpaca keys and stay in observation too. The bot reads the outcome files at
every start.

Trials now read 450 days of history before their start, only so the
indicators and the 400-day listing age are ready on the first day. Before
this, 2019 was spent warming up and BTC and ETH could not be chosen until
2020. A daily series also stops at a hole longer than a week, so the LUNA
relaunched in 2022 is not mistaken for the coin that collapsed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 16:13:23 +01:00
Alby96andClaude Opus 5.5 8def84e122 Add the risk engine, correctives and strategy stages (refs #41 #42 #43)
Every intent of a strategy now crosses a risk engine that only refuses or
shrinks: loss limits per world with the 24-hour block, the weekly halving,
the halving and the switch on the fall from the high, the size limits on
invested capital, single position, crypto share and trade risk, the
technical checks, no short sales and no leverage, the day-trade guard
(off by default). The switch, "Ferma tutto", "Ferma e chiudi", the STOP
file and the orders-per-minute anomaly stop the bot until the user
confirms a restart, and a restart after a trip measures the high from
then on.

The correctives of SPEC 8.5 (crypto regime, economic calendar) and the
risk rules also run inside the backtests of the base strategies, so the
reports show what would happen live. Each stage of a decision is written
to a new decisions table with reason codes.

The stage book is the only way to real money: an order on a real account
needs the startup consent, every requirement of SPEC 12.3 met, the typed
phrase and a fresh password and second factor. Order managers on real
accounts fail closed and ask again before each order leaves. A demoted or
revoked strategy keeps its real positions in exit only, with stops, until
they are at zero. The simulated twin stays out of totals and of the
reference equity.

Tests cover each rule of 9.1 and 9.2, with property tests for "never
larger than asked" and "never larger after a loss", and both proofs on a
fake real account: nothing reaches it without the procedure, and a
demoted strategy manages exits and stops down to zero.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 15:22:35 +01:00
Alby96andClaude Opus 5.5 2409e74b26 Add the three base strategies and their indicators (refs #38 #39 #40)
crypto_trend follows nine breakout periods with Donchian-middle stops,
volatility-targeted weights under the 35%/20% caps and a monthly top-10
universe. equity_momentum reviews on the last close of each week with the
SPY filter, inverse-volatility weights and an ATR trailing stop.
equity_meanrev buys RSI(2) dips above the 200-session average, sized for
a fixed risk, and exits at the close.

The engine gains what the rules need: exits at the same close, a stop set
at a distance from the price obtained, data-only instruments such as SPY,
the trading calendar, the reference equity of the strategy's share and the
equity history. Every strategy passes the look-ahead check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 14:43:19 +01:00
Alby96 a6227793c3 Merge Phase 4: backtest and laboratory (#90)
ci / test (postgres) (push) Successful in 2m58s
ci / image (push) Successful in 9s
ci / test (sqlite) (push) Successful in 2m11s
2026-11-11 14:18:18 +01:00
Alby96andClaude Opus 5.5 9db95ea79a Add the VS Code debug configuration
ci / test (postgres) (push) Successful in 3m18s
ci / test (postgres) (pull_request) Successful in 3m50s
ci / image (push) Successful in 8s
ci / image (pull_request) Successful in 6s
ci / test (sqlite) (push) Successful in 2m1s
ci / test (sqlite) (pull_request) Successful in 2m26s
Four launch entries for the server: a data folder of its own under
artifacts/ (ignored by git), the demo mode, the user's real data folder,
and attach to a running process. Each builds in Debug first and opens the
browser once the server listens. tasks.json also exposes check, test and
dev. SVILUPPO.md explains which entry to pick.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 11:53:49 +01:00
Alby96andClaude Opus 5.5 f278ff4f67 Fix the defects of the Phase 4 review (refs #34 #35 #36)
ci / test (postgres) (push) Successful in 2m41s
ci / test (postgres) (pull_request) Successful in 3m45s
ci / image (push) Successful in 1m10s
ci / image (pull_request) Successful in 13s
ci / test (sqlite) (push) Successful in 1m56s
ci / test (sqlite) (pull_request) Successful in 2m22s
- An error of the database (PostgreSQL restarting) no longer stops the
  laboratory until the next start: the queue logs it, waits 30 seconds
  on the injectable clock and tries the same trial again.
- Buy and hold, the comparison of every report, buys an instrument
  whose history starts later at its first close, with the share kept
  free for it; before, it was never bought and the others took its
  weight. Its version goes to 2.
- The comparison page reads a and b as text: a malformed id shows
  "two finished tests needed" instead of an error page.
- A trial re-checks the hash of its plan before running and refuses a
  plan that no longer matches it.
- Parameters that count days take whole numbers only (10.5 would run
  as 10 and count twice in the DSR); the capital starts from 1, as the
  message says.

ADR 0010 says so, and corrects the estimated minimum of the research
history: 5 does refuse smaller orders, like the exchanges' minimums.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 10:17:18 +01:00
Alby96andClaude Opus 5.5 af7528560f Record the Phase 4 choices and close the roadmap items (refs #37)
ADR 0010 writes down what the specification leaves open: the event
order of a session, the costs shared with the simulator, the pass-through
correctives and risk until Phase 5, the in-house statistics, validations
on the daily returns of the variants, the plateau rule as the minimum of
own and neighbourhood Sharpe, the sizes of walk-forward, CPCV and CSCV,
the trial count of the DSR, the plan written first and never changed,
the low-priority laboratory and the two data origins (the research
history stays in USDT; a trial uses a single currency).

ROADMAP ticks the four acceptance criteria with the tests that prove
them; STATE moves to Phase 5.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 10:05:05 +01:00
Alby96andClaude Opus 5.5 953ffe5e9b Add the Laboratorio screen: new test, report, comparison (refs #36)
The laboratory starts with the host (off in demo mode) and runs its
queue next to market data and trading. The page lists every trial with
status, verdict and headline figures, refreshing itself while one is
queued or running, and offers the form for a new test: strategy, data
origin and market, instruments, period, initial capital and the grid,
with the thresholds stated before the run. The form posts with the
antiforgery token; errors come back as a short code.

The report page shows the protocol checks, the chosen variant against
buy and hold (table and chart), results per year, cost sensitivity,
the Deflated Sharpe Ratio, PBO, walk-forward windows, purged CV paths,
the look-ahead result, every variant with its zone score, what the
backtest does not model, the data used and the trades. A comparison
page puts two finished tests side by side and says whether they read
the same data. The improvements of 8.7 and the cost estimates of 11.6
have their sections, empty until Phases 9 and 8.

The equity chart takes amounts in their own currency and its labels as
parameters. The profit factor has no value without a losing trade.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 10:01:05 +01:00
Alby96andClaude Opus 5.5 5efb149fd6 Add the trial register, the report and the laboratory queue (refs #35 #36)
A trial is planned before it runs: strategy and version, grid, data,
initial capital, cost multipliers, validation settings, thresholds and
engine version go into backtest_trials as JSON with the SHA-256 of the
text. The store has no way to change a plan; later writes touch only
status, verdict, results and times, and a test reads the raw row back
to prove it. Every finished trial stays and counts towards the number
of tries the Deflated Sharpe Ratio deflates for.

The trial runner is pure computation: every grid variant on the whole
period, plateau choice, the chosen variant again at double and triple
costs, buy and hold, walk-forward, purged CV, PBO, DSR and the
look-ahead check, then the five thresholds of SPEC 12.2 and the report
of point 6 with the limitations the backtest declares (no correctives
without history, no risk engine before Phase 5).

The laboratory writes the plan, queues the trial and runs one at a time
on a dedicated thread with below-normal priority; only the async side
reads and writes the database. On start, trials left running go back
to planned and run again. Data comes from the daily bars and corporate
actions in the database, or from the Binance research history with
estimated order rules.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 09:49:05 +01:00
Alby96andClaude Opus 5.5 ccb9602950 Add backtest metrics, Deflated Sharpe, PBO, purged CV and the look-ahead test (refs #34 #35)
Metrics give what the report of SPEC 12.2 point 6 needs: return, CAGR,
annualised volatility and Sharpe, max drawdown with its days, trades,
win rate, profit factor, fees, exposure and results per calendar year.

Statistics are written in house as SPEC 12.2 asks: the normal CDF
(Hart 5666, double precision) and quantile (Acklam plus a Halley step),
moments, the probabilistic and the Deflated Sharpe Ratio. The DSR test
reproduces the example of Bailey and López de Prado (SR0 0.1132, DSR
0.9004).

Validation works on the daily returns of every grid variant:
walk-forward with a growing window, combinatorial purged CV (6 groups,
2 tested: 15 splits, 5 paths, purge and embargo of 1% of the series)
and PBO by CSCV (16 groups). Pure noise gives a PBO near 0.5, a
dominating variant 0, a winner that always loses out of sample 1.
Choices follow the plateau rule: a variant scores its own Sharpe but no
more than the mean of its zone, so a lonely peak loses to a broad hill
and a poor variant does not win by standing next to a good one.

The look-ahead check reruns the strategy on data cut at six days and
requires every decision up to each cut to be unchanged; it fails on a
strategy that reads tomorrow and passes on the average cross. The
one-step comparison of SPEC 12.3 classifies intents and flags action
differences and sizes more than 10% apart. A golden run guards the
engine against unintended changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 09:40:06 +01:00