feat(research): add financial contracts and availability-aware datasets

Implement reviewed F01/D01 foundations without changing active trading runtimes. Validate strict Rust/TypeScript financial wire contracts, decimal postings, versioned datasets, explicit calendars, provenance, and v1 compatibility.
This commit is contained in:
Boki 2026-10-22 20:51:25 -04:00
parent 243e9ab43f
commit b4af840d4e
25 changed files with 4071 additions and 43 deletions

View file

@ -18,6 +18,12 @@ Measurable benefit: Defines point-in-time truth before new replay logic.
Absorb D03 in the same manifest version: record universe/as-of and corporate-action coverage, distinguish signal-adjusted from raw execution prices and retain limitations. Do not build an action feed or a correctness-gate evidence subsystem. Known unsupported action ranges reject executable policy; unknown coverage stays explicitly exploratory, never silently verified.
### Sixth-wave scope clarification
Implement a separate additive v2 normalizer; leave the existing v1 loader, persisted snapshots, SQL, APIs and runtime unchanged. Callers supply source/revision-labelled UTC session tables with an IANA time zone; never infer an exchange from a symbol suffix or weekdays. Initially accept only full-duration intraday bars contained within a session; partial-session bars are unsupported. Explicit availability and interval-end assumptions remain distinct and hash-retained.
Verify the original hash before converting v1 and retain it as the parent hash. Converted VWAP is unknown because v1 cannot distinguish provider VWAP from a synthesized value. Unknown universe/action coverage stays exploratory, including after executable-policy validation; validation is not research certification. Trade-end bars remain available for terminal marking, while later replay enforces the half-open decision window. Prefix tests here prove normalization stability, not the future F06 replay gate.
## Exclusions
No unrelated refactor, new service or broker activation.

View file

@ -14,6 +14,12 @@ Scheduling source of truth: [manifest entry F01](../manifest.json). No task is a
Define only the contracts consumed by the first financial vertical slice: scalar posting rules, owner IDs, account risk-session boundary, commands/effects, snapshot version and stable decision identity. Use a maintained checked decimal implementation, not bespoke arithmetic. Absorb C05: add small hand-derived JSON/table fixtures beside their consumers, without a reference simulator or an expected-failure test campaign. Freeze the TS/Rust command/context shape before consumers implement it.
### Sixth-wave scope clarification
The additive contract separates strategy intents from engine-internal fill/mark/session commands. The snapshot is an economic projection, **not** a complete recoverable session. Full observation contexts, sessions and native bindings remain F06/F07 work; this task must not introduce a second executable engine.
The maintained decimal wrapper provides checked ingress, fixed-8 posting, addition and subtraction. Generic multiplication/division are intentionally absent: intermediate rounding needs operation-specific F02 tests, especially proportional basis release. Remaining-basis and command-conflict fixtures are hand-derived F02 specifications, not claims of implemented ledger or deduplication behavior. TypeScript validates wire shapes and canonical decimal strings only; it does no financial arithmetic.
## Exclusions
No unrelated refactor, new service, broker enablement, or silent reinterpretation of historical results.
@ -37,7 +43,7 @@ Parallel eligibility: only with disjoint actual files and reserved write locks;
## Acceptance criteria
- Financial postings use8 decimal places with explicit round-half-away-from-zero at ties (matching current TS half-up behavior); reject overflow/non-finite/excess-precision external commands. Float observations/features are not converted into money strings on every native crossing.
- Financial postings use 8 decimal places with explicit round-half-away-from-zero at ties (matching current TS half-up behavior); reject overflow/non-finite/excess-precision external commands. Float observations/features are not converted into money strings on every native crossing.
- Authoritative basis is remaining cost amount, not rounded average price. Fixture buys3 shares for total5; partial/final disposals release exactly5 basis in total.
- Stable protocol snapshot/command serialization and unknown-version rejection pass small Rust/TS contract fixtures; scope is one supported version, not a compatibility-negotiation framework.
- Each regression fixture lists economic assumptions, hand calculation and owning task. Each implementation task adds its own passing regression coverage; do not merge a blanket failing suite.