Added only_rebalance_drifted_assets parameter #694
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before the change, when a rebalance was triggered, all positions would reblance. That's still the default behavior, but now, you can set only_rebalance_drifted_assets, and only the assets that have drifted beyond the drift_threshold will rebalance.
This is useful when rebalancing portfolios with lots of positions, some of which are volatile and some of which arent.
Description by Korbit AI
What change is being made?
Add the
only_rebalance_drifted_assets
parameter to the DriftRebalancerLogic class and update relevant examples and tests to support rebalancing only assets whose drift exceeds a given threshold.Why are these changes being made?
The addition of the
only_rebalance_drifted_assets
parameter provides an option to optimize rebalancing strategies by focusing only on assets with significant drift, enhancing performance by reducing unnecessary transactions. This change gives portfolio managers finer control over rebalancing logic and the ability to reduce transaction costs. The associated updates and tests ensure the new functionality is properly integrated and validated within existing code.