Skip to content

Fix position accounting and add verified demo - #2

Open
jadenfix wants to merge 6 commits into
mainfrom
codex/accounting-integrity-demo-20261013
Open

jadenfix wants to merge 6 commits into
mainfrom
codex/accounting-integrity-demo-20261013

Conversation

@jadenfix

Copy link
Copy Markdown
Owner

What changed

  • replace branchy long/short bookkeeping with signed position deltas
  • preserve average cost on partial closes, realize P&L for partial/full closes, and price only a reversal residual at the new fill
  • reject invalid orders/fills before they can mutate cash, commission, fills, or positions
  • add direct transition regressions for long adds, partial/full closes, short-to-long reversal, and rejection immutability
  • publish a source-pinned GIF/MP4 generated from the actual native accounting replay, with SHA-256 receipts and a full media verifier

Verification

  • python3 scripts/accounting-e2e.py — strict -Werror and UBSan executables pass
  • python3 scripts/backtester-e2e.py — exactly 68 strategy/dataset configurations complete on 11 generated 64-row OHLCV files
  • python3 scripts/bridge-e2e.py — trained BayesianRidge round trips through the C++/Python bridge; concurrent calls differ and missing models reject
  • python3 scripts/verify-accounting-demo.py — pinned source blobs, replay receipt, artifact hashes, H.264 MP4, and all 72 GIF frames verify/decode

Recorded source: d4b0acc6cde5475f532c76a7f310e9f2a357d7cb (tree f73563a87d30a16632156985ad8730073632c59f).

Scope

This is deterministic simulated accounting over fixture fills. It does not place live orders and makes no profitability, execution-quality, or latency claim.

jadenfix commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner Author

Independent completion receipt — final exact head 880bbba9b3c6b3d6253851331855fec61dc1a14b (tree 68cbfc25f796ad890979740cadd688d424f52de1; base 8a2331f03203b01c615d8e13952cd44cfb28ae96).

Verified locally and again from a clean exact-head checkout:

  • strict -Wall -Wextra -Wpedantic -Werror transition executable: pass
  • separately compiled UBSan transition executable: pass
  • direct regressions: add/increase, partial close, full close, short-to-long reversal, and rejected order/fill immutability
  • trained BayesianRidge C++/Python bridge, concurrent prediction isolation, and missing-model rejection: pass
  • real executable smoke: exactly 68 strategy/dataset configurations on 11 generated 64-row OHLCV fixtures
  • source-pinned replay receipt and full media verifier: pass
  • clean clone had no LFS checkout warning or status drift; docs/demo/accounting-receipt.csv resolves to ordinary text and matches blob 7dc7650c05c0c8158937826837a0c3e039153232, while historical dataset CSVs remain LFS-managed
  • all 13 tracked __pycache__/*.pyc artifacts were removed; narrow __pycache__/ and *.py[cod] ignores were added
  • the full hosted test sequence now ends with an explicit clean-worktree assertion

Hosted run 38366346396 passed both Ubuntu and macOS lanes, including bridge, strict/UBSan accounting, exact 68-configuration smoke, provenance/full media decode, and the new post-test clean-checkout gate.

Captured runtime source remains commit d4b0acc6cde5475f532c76a7f310e9f2a357d7cb (tree f73563a87d30a16632156985ad8730073632c59f); the packaging/hygiene-only follow-ups did not change capture inputs or media:

  • H.264 MP4: 1280×720, 12.0 s, SHA-256 cda6a3044aec91f8c636fab57c579262b1e54a9a278d9dcf46b57fc68ed0a7f4, Git blob 6810714066596ba1383f41df3282d1909fdb8c45
  • GIF: 960×540, 72 fully decoded frames, SHA-256 06d606fa11fb74064dc40cf9d4bbe106fb0eda3053b85a80f018eae4a90f3995, Git blob 8f22b1d72c3fbd6fdd39d3f9b5f1fb85542a1d64

Scope remains deterministic simulated accounting over fixture fills. No live orders, profitability, execution-quality, latency, or production-readiness claim. Ready for the designated portfolio merger; I did not merge.

Copy link
Copy Markdown
Owner Author

Independent final-head verification (session3eef root): fetched exact head 880bbba9b3c6b3d6253851331855fec61dc1a14b, tree 68cbfc25f796ad890979740cadd688d424f52de1, into a fresh detached worktree. Confirmed no tracked __pycache__/.pyc remains; the small demo receipt is explicitly outside Git LFS while dataset CSV rules remain intact. Reran make accounting-test PYTHON=python (strict -Werror and separate UBSan transition executables), python scripts/bridge-e2e.py (persisted BayesianRidge round trips, concurrent isolation, missing-model rejection), and python scripts/verify-accounting-demo.py (recorded source/blob provenance, replay receipt, artifact hashes, full GIF/MP4 decode). The checkout remained clean after tests. I also independently ran the exact 68 strategy/dataset bounded backtest on the preceding content-identical runtime head; final hosted run 38366346396 reran that gate plus all other checks on Ubuntu and macOS, including a clean-tree assertion, and passed. Media remains deterministic simulated fixture accounting only—no live brokerage/exchange, profitability, latency, research-performance, or production-readiness claim. No merge performed; session100e79 remains sole merger.

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.

1 participant