Skip to content

feat: produce observed accounts and flow-adjusted investment results - #161

Merged
stefan-jansen merged 42 commits into
mainfrom
codex/analysis-ready-results
Oct 21, 2026
Merged

stefan-jansen merged 42 commits into
mainfrom
codex/analysis-ready-results

Conversation

@stefan-jansen

@stefan-jansen stefan-jansen commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Purpose

Closes #155. Export observed account, holding and fill histories from the existing Engine/account ledger, with correct initial-capital and external-flow investment returns. Calendar PR152 is merged; this PR now targets main directly.

Implemented contracts

  • A first-bar $10 fee on initial $10,000 reports investment return-0.001 and initial drawdown0.001, without a fake market bar.
  • Optional bar/session/fill-and-session holdings capture with actual cash/NAV/exposure, stable observation/asset keys, mark provenance, multipliers and declared currency. All-cash completeness is distinct from unavailable capture. Native default remains signed-notional accounting; no variation-cash claim.
  • Strict versioned schema3 artifacts, legacy schema2/beta readers, ordered equal-time fills, and persisted recorded variables.
  • Prepared delta/target capital events with atomic validation, independently current held-asset marks and marked pre/post-flow NAV. Separately chain investment wealth around external flows; deposits are not trading returns. Missing current marks fail before ledger mutation; current zero marks remain valid.
  • Broker-owned result capture and callback rollback, finite mark handling and chronological flow-neutral session drawdown. Include the requested maintainer batching guidance in AGENTS.md.

Executed correctness evidence

  • Real initial-fee, current-mark capital-event, zero-mark and session-drawdown regressions fail on their recorded earlier source revisions and pass with these repairs. No widened tolerances.
  • Final source a7c297c:2386tests pass,9optional-comparison skips,5benchmark tests deselected; global and every critical-module branch/statement threshold pass.
  • 146installed-wheel regression tests pass from outside the checkout. Five actual Engine -> strict saved artifact -> published Diagnostic0.1.9 journeys pass: first fee, all cash, long/short, external flow and minute roundtrip. An additional pinned unpublished Diagnostic consumer was qualified separately; it is not described as published functionality.
  • Exact current runtime64f4ace with published Specs0.2.0:66synthetic scenarios and17real-strategy pairs pass, retaining verified native output identities. Original benchmark measurement digest and all samples remain unchanged. An explicit timed-path/source/dependency review retains their established scope; no new timing or new-workflow speed claim.
  • Final wheel and sdist built twice, content/reproducibility and Twine pass. Strict MkDocs build,9577rendered links and39external destinations pass; ordinary full hooks, Ruff and ty pass. Current-head hosted platform/security/package gates remain required before merge.

Scope and compatibility

Preserve native defaults and legacy readers. This PR does not implement raw corporate actions, variation-cash futures, dated rolls or the callback/history facade; those remain successor issues156-160. No full migration or release claim.

AI assistance

OpenAI Codex assisted implementation, regression design, public Engine/installed-consumer execution, documentation and substantive review under maintainer direction. Local qualification and pending hosted gates are distinguished above.

Adopt the immutable Specs temporal contract, keep legacy config payloads readable, and make explicit None select observation semantics. Qualify the next API boundary separately from the retained 0.1.13 candidate.
Regenerate lock metadata offline after the direct immutable source dependency. Preserve all other package versions and source identities; the public locked Zipline builder now succeeds.
Include first-period execution costs in returns and drawdown without adding a synthetic bar. Store the baseline in schema 3 and preserve schema 2 and beta readers. Adds real Engine failing-base regression coverage for issue #155. Also includes the requested maintainer batching guidance.
…xports

Enable explicit bar capture while retaining complete account observation keys, including all-cash dates. Extend the existing schema 3 artifact with optional holdings and strict keys, retain unavailable legacy capture, and preserve equal-time execution order. Advances #155; capital flows and installed consumer qualification remain open.
…ication

Reproduce the shared Python 3.15 failure through uv resolution. Bind selected packages, artifacts, markers and lock declarations while excluding the resolver prerelease permission alone. Preserve raw identities and all 17 accepted measurement records, and keep actual dependency drift rejection. Full suite: 2320 passed, 14 skipped. Fixes qualification of #151.
Apply validated delta/target schedules before decisions using actual marked NAV and preserve pre/post-flow valuations. Chain subperiod returns, retain reported NAV separately from investment wealth, and persist ordered flow applications. Extend accounting invariants to include independently recorded external capital without changing their tolerance. Adds public Engine and artifact regressions and a runnable guide. Advances #155; full qualification and migration integration remain open.
Use a real uv-generated self-contained lock instead of requiring every platform package and build backend in the runner cache. Preserve the failing-base producer operation and the actual dependency-drift rejection control. Addresses the clean-runner failures at 7233675 without changing validator or runtime behavior.
Capture the multiplier and declared currency used for each fill and export signed quantity. Preserve unknown legacy units and cost inclusion rather than reconstructing them from later configuration. Adds actual Engine/Parquet unit checks. Advances #155.
Capture post-fill and last-observed-session holdings through the existing account and fill journal, with explicit completeness and sequence keys. Keep investment returns on the original bar timeline and roll back observations with failed immediate callbacks. Reuse one marked snapshot implementation; preserve a valid zero mark in both carried valuations and open-trade PnL. The zero-mark regression fails twice on b49307a; focused account/lifecycle checks pass. Advances #155.
Keep detailed mark provenance out of ordinary valuation loops and enable timestamp history only when requested. Custom/legacy feeds may omit the new optional capital-events attribute. The real legacy feed run fails before the fix and passes afterward; 39 account/lifecycle/runtime checks pass, including the existing runtime regression gate. Advances #155.
…sions

Add Broker.record using the existing journal, callback transaction and portable artifact encoding. Retain carried values on actual bar keys, preserve nonfinite values, expose decoded records, and reject unsupported values before mutation. Persist the optional versioned component with strict observation checks and a runnable guide. Advances #155 and the record adapter foundation of #156; 131 focused checks pass.
Persist the actual signed-notional account method and expose producer metadata in legacy dictionary views. Ignore nonfinite replacement quotes while retaining valid zero marks and original mark provenance. Real getter and held-position workflows fail before the fix; 160 focused account/serialization/lifecycle checks pass. Document the upcoming release boundary and unknown legacy account declarations. Advances #155.
Base automatically changed from codex/calendar-contract-v2 to main October 20, 2026 22:10
@stefan-jansen
stefan-jansen marked this pull request as ready for review October 21, 2026 00:04
Copilot AI balanced review requested due to automatic review settings October 21, 2026 00:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@stefan-jansen
stefan-jansen merged commit 12a2c48 into main Oct 21, 2026
43 checks passed
@stefan-jansen
stefan-jansen deleted the codex/analysis-ready-results branch October 21, 2026 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Authoritative per-asset histories, initial-capital returns and versioned persistence

2 participants