Skip to content

Add min, max, and target imbalance constraints - #209

Open
shaneraphel wants to merge 1 commit into
cvxgrp:masterfrom
shaneraphel:imbalance-bounds
Open

shaneraphel wants to merge 1 commit into
cvxgrp:masterfrom
shaneraphel:imbalance-bounds

Conversation

@shaneraphel

@shaneraphel shaneraphel commented Oct 1, 2026 •

Copy link
Copy Markdown

Summary

Issue #181 asks for a way to set the long/short imbalance, with fully invested and dollar neutral as the two usual cases. FixedImbalance already fixes the cash residual. This adds the two inequalities and a TargetImbalance name for the equality.

The imbalance is the sum of the signed non-cash weights, so it is 1 minus the cash weight.

  • TargetImbalance(c) requires the imbalance to equal c. DollarNeutral is c = 0 and NoCash is c = 1.
  • MaxImbalance(c) requires the imbalance to be at most c, so the cash weight is at least 1 - c.
  • MinImbalance(c) requires the imbalance to be at least c, so the cash weight is at most 1 - c.

The limit can be a number or a datetime-indexed series, same as FixedImbalance.

Test plan

  • test_target_imbalance, test_max_imbalance, and test_min_imbalance pass, along with the existing NoCash and DollarNeutral tests.
  • I did not rebuild the documentation site. The new classes are listed next to FixedImbalance in docs/constraints.rst.

The signed non-cash weight can now be fixed or bounded. Dollar neutral
and fully invested are the zero and one cases of the same cash residual.

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.

1 participant