Implement deterministic realtime execution contract#90
Draft
luisleo526 wants to merge 5 commits into
Draft
Conversation
…ntract plan Corrections and additions from a seven-perspective audit (TradingView docs, PineTS/PyneCore at pinned revisions, FIX/Nautilus/LEAN comparison, two codebase verifications at 98ad849, red-team, practitioner evidence; serious findings adversarially re-verified): - fix the stored-artifact claim (a whole-session 2025-05-01 run existed) and the dead PyneCore live-mode citation; re-base the audit on 98ad849 (#89) - add wait-for-entry exit deferral, slippage, trailing immediate-activation, calc_on_every_history_tick, and command-revision states incl. REJECTED_AT_PLACEMENT to the contract - record the exit REMARKS fill-first rule as working-order bookkeeping (proven by the pinned three-way bracket export); name the two deliberate TV divergences (fixed-grid quiet bars, OCA one-winner pending P8) - add the section 7 TradingView probe plan (P1-P9) and completion-gate item - pin bar_magnifier gating and digest scoping, gap-policy enumeration, quiet-bar equity marking, canonical event ordering, hash serialization, clock-event validation, silent-drop diagnostics, position_episode_id, OCA membership observability, fill-cardinality wording, restart caveat, baseline re-basing escape hatch with pinned engine/corpus/scorer hashes, and section D data/resource prerequisites Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Summary
Why
The existing stream path preserved one strategy instance but silently mixed clock events with executable prices, lost stop-limit activation between trades, shared one trailing watermark across exits, and exposed no deterministic broker lifecycle. This made realtime behavior difficult to audit and unsafe as a later alert/webhook source.
The contract is PineForge's deterministic simulator contract. It uses TradingView documentation as the Pine semantics reference but does not claim to clone TradingView's private realtime feed or executor.
Validation
ctest --test-dir build --output-on-failure: 89/89 passedpython3 scripts/check_c_abi_runtime.py: passed./scripts/run_corpus.sh: 252/252, zero failures; 240 excellent, 11 strong, 1 existing anomaly2025-05-01T00:00:00Z: 756/756 runtime success, exact input/script bar countsSee
docs/realtime-contract-3-session-report.mdfor the score definitions and price/P&L distributions.Scope still open
This remains a draft. The P1-P9 probe sources and collection protocol are ready, but the manual TradingView observations/results are still pending. The revised completion gate also requires full per-entry-lot exit fan-out, a canonical whole-engine handoff digest, a frozen same-scorer pre-change run, and a second deterministic execution of all 756 sessions. Alert/webhook transport and JSON delivery inside PineForge remain intentionally out of scope; lifecycle
fill_idis the idempotency source for that later layer.