Skip to content

Fix skipped integer allocation with nonlinear commissions - #530

Merged
timkpaine merged 1 commit into
pmorissette:masterfrom
Jo2234:fix/integer-commission-allocation
Sep 1, 2026
Merged

timkpaine merged 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

This branch was previously deployed

1 inactive deployment
dev — 22d2e35e Deployed Sep 1, 2026 by Jo2234 via build (3.11, ubuntu-latest, >=3,<4, >=2) #23
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

2 participants