Skip to content

Instrument + HTF parity: engine fixes, runtime syminfo ABI, and TV-graded probes#29

Merged
luisleo526 merged 8 commits into
mainfrom
probes/instrument-and-htf-parity
Jun 2, 2026
Merged

Instrument + HTF parity: engine fixes, runtime syminfo ABI, and TV-graded probes#29
luisleo526 merged 8 commits into
mainfrom
probes/instrument-and-htf-parity

Conversation

@luisleo526
Copy link
Copy Markdown
Collaborator

What

Closes the corpus's instrument-monoculture + HTF gaps with TV-graded probes and the engine fixes they surfaced. Adds runtime syminfo injection (mintick/pointvalue) so non-crypto instruments validate, makes the verifier DST-aware, and grows the headline corpus 233 → 245 excellent.

Probes live in the corpus submodule (PR: pineforge-corpus#probes/instrument-and-htf-parity); this branch's gitlink points at them. Merge the corpus PR first.

Engine / ABI

  • fix(engine) weekly HTF year-boundarycrosses_boundary forced a spurious week split at every Jan 1 (tm_year change), so a weekly request.security SMA updated a bar early → ~30 flipped crosses in a chop-at-level month. Now compares the absolute Monday date (continuous across years). Surfaced by a TV weekly probe (weak→excellent).
  • feat(engine) accept monthly request.security("M")validate_security_timeframes rejected the calendar marker (tf_to_seconds("M")==-1) though the MONTH aggregator is wired; now admitted as a coarser HTF (security_lower_tf("M") stays invalid). Year-boundary regression added to test_calendar_aggregation_wm.
  • feat(abi) runtime syminfo mintick/pointvalue settersstrategy_set_syminfo_mintick / strategy_set_syminfo_pointvalue (append-only → MINOR version bump due), mirroring the existing runtime syminfo setters; the engine stores no instrument metadata of its own (harness injects per run). pointvalue now multiplies realized PnL + MFE/MAE (crypto/equity pointvalue=1 → unchanged; ES=50 → correct), killing the dead-field finding. ABI whitelist updated.

Scripts

  • DST-aware TV timezone in verify_corpus.py + run_strategy.py (IANA zones via zoneinfo) — a fixed offset mis-aligned US-equity/FX across the Nov DST flip. run_strategy also injects runtime_overrides.mintick/.pointvalue.

Tests

  • test_ta_volume_state_oracle: TSI/RCI value bounds + NVI/PVI structural update-rule (engine-only invariants).

TV-parity results (via the corpus submodule)

  • validation/ (headline sweep): +12 ETH probes, all excellentta.{tsi,rci,cog,cmo,mfi,wpr,obv,accdist,pvt,nvi,pvi,pivot_point_levels} + weekly HTF. The TA volume/state family had zero TV coverage before.
  • special-validation/<category>/<probe>/ (excluded from the sweep): AAPL excellent (RTH+gaps+DST), ES excellent (point value 50, 0.25 tick), EURUSD strong (TV-exact fills; sub-cent FX PnL artifact), monthly + leverage documented (warmup-depth / missing forced liquidation). Licensed OHLCV/TV/engine data git-ignored.

Verification

ctest 53/53 (incl. ASan/UBSan lane) · scripts/run_corpus.sh 245 excellent + 1 anomaly, 0 fail, 0 churn.

🤖 Generated with Claude Code

luisleo526 and others added 8 commits June 3, 2026 04:06
…quest.security

Weekly: crosses_boundary forced a spurious week boundary at every Jan 1
(tm_year change), splitting the ISO week that straddles Dec/Jan into two
partial weeks. A weekly request.security SMA then updated a bar early —
visible as ~30 flipped close-vs-weekly-SMA crosses in a chop-at-level
month (2026-01). Fix: compare the absolute Monday date (continuous across
years). Surfaced by a TV-parity weekly probe (weak->excellent).

Monthly: validate_security_timeframes rejected 'M' because tf_to_seconds
returns -1 (calendar marker) tripping the <=0 guard, though the CALENDAR
month aggregator is wired. Admit the month marker as a coarser HTF
(security_lower_tf('M') stays invalid). test_calendar_aggregation_wm gains
a year-boundary regression (the Dec29-Jan4 week is one 7-day week).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ue into PnL

Adds strategy_set_syminfo_mintick / strategy_set_syminfo_pointvalue C-ABI
setters (append-only; MINOR bump due), mirroring the existing runtime
syminfo timezone/session/metadata setters — the engine stores no
instrument metadata of its own; the harness injects it per run, by design.
pointvalue ($/point/contract) now multiplies realized PnL + MFE/MAE in
emit_close_trade (crypto/equity pointvalue=1 -> unchanged; futures e.g.
ES=50 -> correct). Kills the dead-field finding. ABI whitelist updated.
Validated: ES futures TV-parity excellent (550/550) once injected.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Engine-only invariant oracles for the remaining TV-oracle-less TA family:
TSI/RCI bounded [-100,100]; NVI frozen on non-down-volume bars, PVI frozen
on non-up-volume bars (origin-formula-independent structural invariants).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ection

verify_corpus.py + run_strategy.py resolved the TV export tz to a fixed
integer offset, so an IANA zone with DST (e.g. America/New_York, UTC-4
summer / UTC-5 winter) mis-aligned trades across the Nov DST flip. Both now
accept IANA zone names via zoneinfo (DST-aware) alongside the legacy fixed
aliases — enables US-equity / FX parity. run_strategy also injects
runtime_overrides.mintick / .pointvalue through the new C-ABI setters.
Validated: AAPL US-equity (RTH+gaps+DST) TV-parity excellent (82/82).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Points the corpus gitlink at the commit adding the 12 ETH TA/HTF validation
probes (headline 233 -> 245 excellent) + the 5 categorized special-validation
probes (AAPL/ES/EURUSD/monthly/leverage). The local probe staging area
(proposed-probes/) is removed — probes now live in the corpus submodule only,
keeping the engine repo clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…/us-equity)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
corpus PR merged; update the gitlink from the feature-branch commit to the
corpus main commit so the submodule reference resolves on a clone of corpus main.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@luisleo526 luisleo526 merged commit de12718 into main Jun 2, 2026
5 checks passed
@luisleo526 luisleo526 deleted the probes/instrument-and-htf-parity branch June 2, 2026 20:24
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