rebalance#

tradeexecutor.strategy.pandas_trader.rebalance module.

Module description#

Alpha model rebalancing.

Based on the new alpha model weights, rebalance the existing portfolio.

Functions#

check_normalised_weights(weights[, epsilon])

Check that the sum of weights is good.

clip_to_normalised(weights)

If the sum of the weights are not exactly 1, then decrease the largest member to make the same sum 1 precise.

get_existing_portfolio_weights(portfolio)

Calculate the existing portfolio weights.

get_weight_diffs(existing_weights, new_weights)

Get the weight diffs.

rebalance_portfolio(position_manager, ...[, ...])

Rebalance a portfolio based on alpha model weights.