P123 Book Optimizer

Hi fellow investors,

I hosted a small Streamlit App to optimize P123 Book weigths.

Guide: My Portfolio123 Book Optimizer - Systematic Investing

App: https://p123bookopt.streamlit.app/

Enjoy! Will improve and add features such as dynamic optimization schemes and constraints.

Looking forward to feedback!

Cheers,

Tony

3 Likes

Thanks for Sharing Tony,

I have wanted P123 to add this feature for a long time. It’s one of the reasons I use Quantrader instead of P123. If you want to get ideas on how versatile dynamic allocation can be here is a link: Video Tutorial - Logical Invest .

Cheers,

Mark V.

Thanks. I will look into it. I today added some features regarding dynamic optimization. Started with risk parity plus dynamic gross leverage vol targeting. Instead of risk parity, I should have started with simple inverse vol weighting (RP setting is still buggy, especially if you add short strategies… have to have a closer look). But the dynamic vol targeting is already really promising.

More to come. Stay tuned…

I would like to see real examples if you have some. Everytime I look at the results of the before and after of static vs dynamic I'm always like:

1 Like

Marco what type of examples would you like? A real trading system with each trade and percentage allocation? I think the best publicly available example is 42 macro they do the same thing. They only have 4 assets in the Kiss model but they dynamically allocate the assets daily. They only use GLD, SPY, USFR, and Bitcoin. This could be one book strategy and you could add other strategies to complement it.

Cheers,

MV

Tony, does this app use the PyPortfolioOpt library?

If so, how do you like it?

I’ve been looking to make something similar using that lib.

Thanks

Tony

Your intuition is kind of right. Dynamic Weight Optimization is often underwhelming. But dynamic gross leverage management based on a vol target based on a fixed (or dynamic) relative allocation is imo promising. Added both + rolling charts to the v2.2 of the app.

@abwillingham no currently the app does everything ground-up using classic Numpy, Pandas etc.

But thanks for the tip. Will look into it. E.g. my current implementation of risk parity is kinda buggy if you add short strategies.

1 Like

PyPortfolioOPT does not support the equal contribution of risk (ECR) type of risk parity which may be your preferred type. It does support hierarchical risk parity as well as Ledoit-Wolf inverse correlation matrices if you are worried about the problems of instability of the inverse covariance matrix. You could probably get ECR in PyPortfolioOPT with custom formulas, however. PyPortfolioOPT works well (with its provided tools) but I have had trouble setting up the environment at times due to dependency conflicts (CVXPY being a core dependency).

I have not used these but they offer native ECR. The first is open source with the option of paid support.

This one is built on top of Skelearn:

This one is dedicated to ECR:

1 Like

Book Optimizer v2.5

  • added carry cost setting for gross leverage !=1
  • added daily asset weight plotting in dynamic section
  • bug fixes (static MaxDD and AvgDD optimization now properly minimizes DD)
1 Like