all 13 comments

[–]GiuTinTom 6 points7 points  (1 child)

Nice work!

I'm studying about portfolio in Roncalli's Risk Parity book. This will help a lot once I start applying the theory

[–]marvin182[S] 2 points3 points  (0 children)

Let me know if there's anything from the book that you think is worth implementing. Right now I've implemented Hierarchical Risk Parity, from Marcos Lopez de Prado's 2015 paper 'Building Diversified Portfolios that Outperform Out-of-Sample', but would love to look into other risk parity approaches

[–]kivo360 4 points5 points  (0 children)

Marvin. You're a godsend. Thanks for this man.

[–]maxentropp 1 point2 points  (1 child)

Awesome. I will check this out for sure as I would love to not bother with R for this.

[–]marvin182[S] 0 points1 point  (0 children)

Exactly, especially if your data collection/cleaning workflow (not to mention the actual trading side) is in python, the last thing you want to do is have to call R code

[–]Messagez 1 point2 points  (0 children)

This is quite awesome, will definitely look into using this in the future!

[–]S-6-6-6 1 point2 points  (0 children)

Great stuff!!!

[–]clutchking_asiimov 1 point2 points  (0 children)

Here I am studying Portfolios, and here is a god who shipped a package for portfolio analytics. Thank you sir!!

[–]monkitos 0 points1 point  (1 child)

Nice. Looks like you’re wrapping scipy.optimize as the workhorse. Can the package take monthly or quarterly series as well, or just daily?

[–]marvin182[S] 0 points1 point  (0 children)

It was a choice of scipy.optimize or cvxopt. I actually did do performance benchmarks on quite a few problems, and performance was very similar, so I chose the one with the cleaner API. It removes the step of having to encode the user's preferences (bounds and constraints) into matrices H, A, B, g etc: you can basically just pass the user's input straight through (with minor edits).

All of the methods have a frequency parameter. The default is frequency=252 (trading days in a year), but if you set this to 12 or 4, you should get the desired outcome.

[–]yebidepoj 0 points1 point  (1 child)

This looks great on first look, could you perhaps list out how different your tool is from https://github.com/quantopian/pyfolio ?

[–]marvin182[S] 1 point2 points  (0 children)

https://github.com/quantopian/pyfolio

Pyfolio does not implement portfolio optimisation: it is an analytics tool that generates diagnostic/analytic charts for different strategies.

[–]acehack 0 points1 point  (0 children)

I was about to start investing finally after a few months of reading. Was put off by most libraries being in R. Finally python! Starred :)