Repository navigation
feat: add explicit futures variation-cash accounting - #167
Merged
Merged
Conversation
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.
Preserve accepted performance samples after the bounded default-path review. Qualify raw action ledger, exact input preparation and observable account/artifact contracts. Closes #157
stefan-jansen
marked this pull request as draft
October 22, 2026 01:34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Owning issue
Closes #158. Advances #159 and #156. Dated roll execution and final migration closure remain separate work.
Outcome
Add explicit per-instrument futures variation cash to the existing Engine, Broker and AccountState. Existing contracts retain signed-notional accounting. Choose scheduled settlement events or mark/fill-driven payout. Account observations distinguish liquidation, notional, initial/maintenance margin, available funds and unsettled variation.
The same variation-fill rule now governs execution, submission reservations and queue projections. Schema 6 artifacts retain actual payout records and account observations, including combined corporate actions and benchmarks. Schema 2-5 readers remain covered. No legacy production dependency is added.
Regression and reference evidence
66b2134now passes.04850b3, the expanded public financial suite has 15 failures and 50 passing controls. Reservation/simple-cash paths spent futures principal; scheduled scale/close projections lost variation basis. The repair shares the actual fill transition, reserves fees once, refreshes from actual observation state and preserves rollback.Compatibility and method choices
New ContractSpec fields are keyword-only and opt-in. Scheduled exchange settlement and mark-driven reference payout remain distinct. Reads never pay; settlement marks do not become execution quotes; margin is collateral rather than a fee. The single cash account does not convert currencies. The callback adapter retains its explicit unconstrained entry profile; native Engine supports constrained margin. End-of-data does not invent liquidation fills.
The continuous-root CME workload still lacks a dated chain/roll map for the Zipline comparison. This PR makes no universal futures-parity or new speed claim. The runnable futures-accounting guide documents the next-version source boundary, absent from published 0.1.12 and the preserved pending 0.1.13 candidate.
Checks actually run
5e39dd80: full suite: 3,086 passed,85 optional skips,5 deselected. Its 14 source-bound evidence failures were resolved through fresh reports; all 67 targeted evidence/compatibility checks then pass. Every global and critical coverage threshold passes.5e39wheel: 261 passed with warnings as errors, including actual installed Data and all 16 captured-reference variants.2764a504d315ca55a1bc077073c138de959be647816b651a819d4bde21dfb4e1. The prior7dcbounded ETF/CME source diagnostics and explicit follow-up source review support reuse; they are not relabeled as5emeasurements or new gains.7dcindependent rebuild is byte-identical. Runtime dependency audit has no findings; source security scan is refreshed for the repair.AI assistance and release
OpenAI Codex assisted with implementation, reference capture, tests, documentation, source review and this PR text. Review used original source, independent account arithmetic and the actual public workflows above. Final-revision gates remain required. No release, tag, publication or deployment is included.