Hi Guys,

I wanted to share with the community my implementation of a Custom Optimization Portfolio Construction Model.

The Portfolio Construction Model calculates the desired targets for each asset in our portfolio. This is a custom implementation of the model that will allow you to use different optimization techniques for your portfolio (maximize portfolio return, minimize portfolio volatility, maximize portfolio sharpe ratio, and even a standard equal weighting for comparison).

Once the predictions are sent to the Portfolio Construction Model, it will get the daily log-returns of the last 252 trading days and calculate the weights for each individual security that optimize the provided objective function. The model will also plot the optimal allocation for each asset so we can inspect what it's doing.

The below algorithm is a simple example to show how it works with a buy and hold strategy, but this module can be plugged into any other strategy requiring portfolio target calculations.

Ideas to try (user-defined inputs in the main.py script):

  • Change the objectiveFunction parameter to test other objective functions to optimize. Options are: 'return' (maximize portfolio return), 'std' (minimize portfolio standard deviation), 'sharpe' (maximize portfolio sharpe ratio), and also 'equal' (for a standard equal weighting).
  • The rebalancingParam is currently set to 365 days, but it can be set to a discretionary number of days to rebalance the portfolio and go back to optimal weights. For instance, if you want to rebalance every 30 days simply do rebalancingParam = 30

Emilio

InnoQuantivity.com

Author