Skip to content

Fix skipped integer allocation with nonlinear commissions - #530

Draft
Jo2234 wants to merge 1 commit into
pmorissette:masterfrom
Jo2234:fix/integer-commission-allocation
Draft

Fix skipped integer allocation with nonlinear commissions#530
Jo2234 wants to merge 1 commit into
pmorissette:masterfrom
Jo2234:fix/integer-commission-allocation

Conversation

@Jo2234

@Jo2234 Jo2234 commented Aug 5, 2026

Copy link
Copy Markdown

Summary

  • preserve the closest affordable integer quantity when the allocation root search skips over it under nonlinear commissions
  • add a regression test using the minimum/per-share/capped commission model reported in commission fn is not smooth #461

Reproduction

With a $286 allocation at a $1 price while rebalancing from a short position, the search moved from 286 shares to 284 even though 285 shares cost $285.9975 and were affordable. It then raised the commission fn is not smooth RuntimeError. The corrected search steps back to 285 shares and completes the allocation.

Tests

  • python -m pytest -q — 183 passed
  • make lint — passed

Fixes #384
Addresses #461

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.

Issue in function to allocate

1 participant