Skip to content

fix: session filter, short weight cap, futures multiplier in cash checks, CAGR overflow - #129

Merged
stefan-jansen merged 13 commits into
ml4t:mainfrom
quantum-like:review/fixes
Oct 15, 2026
Merged

stefan-jansen merged 13 commits into
ml4t:mainfrom
quantum-like:review/fixes

Conversation

@quantum-like

@quantum-like quantum-like commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Owning issue

Closes #128

Outcome

Preserves the original contributor's five commits and corrects the four independently reproduced behaviors:

  • CME overnight-session filtering retains an in-session Sunday bar when its session date is Monday.
  • TargetWeightExecutor applies max_single_weight to short target magnitudes as well as long targets.
  • Next-bar simple cash checks and sequential buying-power reservations include a futures contract multiplier.
  • Very short-window CAGR overflow returns positive infinity, allowing EquityCurve.to_dict() to complete.

The maintainer completion adds public Engine regressions and genuinely regenerated synthetic, frozen-input native and performance evidence. It also fixes the benchmark producer's empty Linux processor field, which prevented a valid measurement report from passing its validator. That two-file dependency repair has its own failing-base/passing-fix regression; it changes no timed engine call.

Each numerical change was reproduced and reviewed independently. This retains the existing accepted issue/PR and original attribution while completing the evidence needed to accept the submitted repair tree. It introduces no unrelated policy, migration or shared comparison-extra changes.

Base/fix behavior

Public workflows failed on the pre-fix main and passed on the corresponding repairs:

  • filter_to_trading_sessions dropped a CME Sunday 23:00 UTC bar inside Monday's session; the fix retains it.
  • TargetWeightExecutor.execute produced 333 short shares rather than 167 for a 25% cap on $100,000 at $150. Integer rounding permits up to half a share of notional difference from the exact capped target.
  • Engine filled a $200,000 futures contract against $100,000 cash, and accepted a third $50,000 contract after two reserved fills. The added public Engine tests now reject those unaffordable orders.
  • A one-minute move from $100,000 to $101,000 made EquityCurve.to_dict() raise OverflowError. The corrected result contains positive infinite CAGR.

The original focused regression names remain in the contributor commits. Added end-user futures checks are in tests/futures/test_cash_multiplier_engine.py. The producer regression uses the actual build_report and report_failures functions with retained measurement samples solely to isolate host metadata; it does not fabricate a timing run.

Verification

Selected head 574f34b4785d7b006d0172fc49ae01b3a54cfb8f incorporates main 132c349bd23a7323da9c2540dd44943305badaa8 without rewriting the contributor's history. All hooks, 304 focused correctness/report tests, generated claims and diff checks pass. The engine, producer and retained report files match the qualified integration exactly. Both the owner backup branch and this existing contributor PR branch were pushed normally and verified with ls-remote. Current-head hosted qualification is pending.

Earlier full local qualification at maintainer completion de390181aae4c0647cd3595b1ac57b07ec7b6c2e:

  • uv run --no-sync ruff check src tests: passed.
  • uv run --no-sync ruff format --check src tests: passed.
  • uv run --no-sync ty check and all pre-commit hooks: passed.
  • Full non-benchmark branch-coverage suite: 2,269 passed, nine opt-in native checks skipped, five benchmark tests deselected; global and critical-module coverage gate passed, 87.48% combined coverage.
  • Strict MkDocs and rendered-link checker: passed, 8,769 content links and 33 external destinations.
  • Generated claims and changelog checks: passed.

The completed source tree has exactly the same engine, producer, adapter and retained report files as the separately qualified integration tree:

  • Synthetic correctness: 66 required passes and two explicitly unsupported cases.
  • Frozen-input native correctness re-derived at bc83aab413d63c02fb16b48390db161d239bd490: all 17 required framework/workload pairs passed, eight unsupported.
  • Fresh measured timings at d771ff5608bb1c5e5977c8fb32f8afeeab33cd04: one warmup and ten isolated samples per side for all 17 pairs. All 34 measured output SHA256 sets were independently matched to the actual retained correctness files. The reports retain their real generating revisions; no pins were manually relabeled.
  • Integration a949116d19b51cfc8ff4d296661f4fc924679fd0: reproducible wheel/sdist, metadata checks, installed-wheel marked examples, Diagnostic 0.1.4 handoff/results and representative installed-wheel consumer typing passed.

Final automatically triggered supported Python/OS CI and package gates must pass at the selected PR head before merge. Local integration evidence does not replace that exact-head hosted qualification.

Compatibility and limits

Outputs change in the specific corrected cases above. Consumers serializing extreme annualized metrics must handle nonfinite CAGR. The comparisons apply only to their retained framework builds, inputs and explicit settings; they do not establish universal framework equivalence or correctness of every strategy.

AI assistance

The original functional commits were authored by Cursor Agent with quantum-like credited as co-author. Codex reproduced and independently assessed the changes, preserved the original history, added the public Engine and metadata regressions, generated and checked the actual evidence, and drafted this description. These are agent-run checks; no independent human review is asserted.

Release

Recommend a patch release after accepted main passes full release gates. This PR does not authorize a release, tag, PyPI publication or documentation deployment.

cursoragent and others added 13 commits October 7, 2026 07:31
CME-style sessions open on the calendar day before their session date.
The filter expanded the schedule start but not the end, so a bar on that
open was removed whenever the frame's latest UTC date was still the prior day.

Co-authored-by: quantum-like <[email protected]>
min() only upper-bounds a weight, so a short target more negative than the
configured cap was left unchanged. Apply the cap as a magnitude limit.

Co-authored-by: quantum-like <[email protected]>
The open cash check treated notional as price times quantity and then
skipped the gatekeeper. A one-lot futures buy could fill and drive cash
negative. Scale the projected debit by the contract multiplier.

Co-authored-by: quantum-like <[email protected]>
Sequential fills treat a reserved order as already validated and skip the
gatekeeper. The shadow reserved price times quantity, so a futures order
could fill for many times the reserved cash. Reserve price times quantity
times multiplier.

Co-authored-by: quantum-like <[email protected]>
A one-minute equity gain made (final/initial) ** (1/years) exceed the float
range and raise OverflowError while assembling run metrics. Return infinity
for that overflow and leave finite windows unchanged.

Co-authored-by: quantum-like <[email protected]>
(cherry picked from commit e6d8342)
(cherry picked from commit 2332c71)
@stefan-jansen
stefan-jansen merged commit 95254a7 into ml4t:main Oct 15, 2026
40 checks passed
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.

[Bug]: Overnight session bar dropped, short weight cap ignored, futures multiplier missing from cash checks, CAGR overflow

3 participants