Skip to content

Close fractional positions exactly at zero target weight - #195

Open
stefan-jansen wants to merge 4 commits into
mainfrom
fix/exact-zero-target-182
Open

stefan-jansen wants to merge 4 commits into
mainfrom
fix/exact-zero-target-182

Conversation

@stefan-jansen

Copy link
Copy Markdown
Contributor

Fixes #182.

A zero target could turn an exact held quantity into a slightly oversized sell through the weight-to-shares conversion. Close the actual held quantity when no other order needs to be netted. This preserves the cash-account reversal check and shows the same size in preview.

The end-to-end regression fails on main and passes on this branch; 81 rebalancer tests passed locally. Draft while the new runtime digest is requalified against the retained comparison suite. No benchmark claims were updated.

AI assistance: Codex reproduced and tested the issue, and prepared the fix and this PR.

@stefan-jansen
stefan-jansen marked this pull request as ready for review November 19, 2026 04:10

This branch has not been deployed

No deployments
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.

TargetWeightExecutor: exit via target weight 0 rejected as "Position reversal" (float residue, fractional shares)

1 participant