Skip to content

fix: align integer-allocation prices by ticker - #1

Merged
Geochelone666 merged 4 commits into
mainfrom
maintenance-align-discrete-prices
Oct 22, 2026
Merged

Geochelone666 merged 4 commits into
mainfrom
maintenance-align-discrete-prices

Conversation

@Geochelone666

Copy link
Copy Markdown
Owner

lp_portfolio consumes latest_prices.values in Series order but labels solver variables with weights dictionary order. With A=10, B=100, equal weights and a 200 budget, reversed prices can return A=1, B=10 (actual cost 1010) despite reporting no leftover. Extra unrelated prices cause a shape mismatch.

Select prices by the current weight ticker order before building the integer program. Preserve the public input Series and existing optimization formulation.

Validation: both new parameterized regression cases failed before the fix. All 19 discrete-allocation tests pass on Python 3.12 with ECOS installed; the new cases explicitly use SciPy's mixed-integer solver and verify allocation, actual spend and leftover. Existing solver warnings remain.

@Geochelone666
Geochelone666 merged commit 93b0ef7 into main Oct 22, 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.

1 participant