rebalance_portfolio#

rebalance_portfolio(position_manager, new_weights, portfolio_total_value, min_trade_threshold=10.0)[source]#

Rebalance a portfolio based on alpha model weights.

This will generate

  • Sells for the existing assets

  • Buys for new assetes or assets where we want to increase our position

Parameters:
  • portfolio – Portfolio of our existing holdings

  • weights

    Each weight tells how much a certain trading pair we should hold in our portfolio. Pair id -> weight mappings.

    Each weight must be normalised in the range of 0…1 and the total sum of the weights must be 1.

  • portfolio_total_value (float) – Target portfolio value in USD

  • min_trade_threshold – If the notional value of a rebalance trade is smaller than this USD amount don’t make a trade.

  • position_manager (PositionManager) –

  • new_weights (Dict[int, float]) –

Returns:

List of trades we need to execute to reach the target portfolio. The sells are sorted always before buys.

Return type:

List[TradeExecution]