Skip to content

fix(backtest): correct internal combo weight rounding overflow - #237

Merged
Pigbibi merged 1 commit into
mainfrom
codex/hk-combo-rounding-20260916
Sep 15, 2026
Merged

Pigbibi merged 1 commit into
mainfrom
codex/hk-combo-rounding-20260916

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Problem and change

Valid ETF/dividend allocations can produce a combined target sum of 1.0000000000000002 after floating-point arithmetic, causing lifecycle preflight to reject the portfolio. Correct only a one-ULP overflow introduced internally by subtracting the excess from the largest target; the final sum must still be at most one.

Reject invalid or over-budget leg allocations before combination. Preserve rejection of negative, non-finite, and over-budget signal weights.

Validation

  • Focused regression suite: 44 passed, 7 subtests passed.
  • Tests cover the original rounding reproduction, strict final sum, zero returns with constant prices and zero costs, and rejection of a configured budget even one ULP above one.
  • Ruff and git diff --check passed.
  • No real-data backtest or production workflow rerun performed; this PR does not establish remote Drift Check recovery.

Co-Authored-By: Codex <noreply@openai.com>
@Pigbibi
Pigbibi merged commit c7e87bd into main Sep 15, 2026
1 check passed
@Pigbibi
Pigbibi deleted the codex/hk-combo-rounding-20260916 branch September 15, 2026 22:59
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