robertmartin8 / PyPortfolioOpt

Financial portfolio optimisation in python, including classical efficient frontier, Black-Litterman, Hierarchical Risk Parity
https://pyportfolioopt.readthedocs.io/
MIT License
4.43k stars 948 forks source link

What is the best algo to use for crypto portfolio optimization ? #495

Closed Originn closed 1 year ago

Originn commented 1 year ago

What is the prefered way to optimize a crypto portfolio?

In https://github.com/robertmartin8/PyPortfolioOpt/issues/88 Robert suggested to use min_volatility or HRP. Is this still the defacto way to do it? and how does the results compare to different methods while optimizing normal stocks?

My current setup is:

S = risk_models.CovarianceShrinkage(prices).ledoit_wolf()
mu = pypfopt.expected_returns.capm_return(prices)
ef = EfficientFrontier(mu, S)
ef.add_objective(objective_functions.L2_reg, gamma=(float(request.form.get("gamma"))))  # gamme is the tuning parameter
ef.efficient_risk(int(request.form.get("volatility"))/100)
weights = ef.clean_weights()
perf =ef.portfolio_performance()
da = DiscreteAllocation(weights, latest_prices, total_portfolio_value=float(request.form.get("funds")))

When running it on the top 50 crypto currencies it will output only 1 currency to invest in. This will not change even if I am changing the gamma. Is this normal?

Edit: It will give me a more balanced portfolio if I set the target volatility to a lower value.

But still, is using the above can give a good result or just stick to min_volatility or HRP with concern to crypto?

robertmartin8 commented 1 year ago

I'm closing this as I don't think it's within the scope of github issues and it borders on financial advice.

But for what it's worth, if I were to be doing crypto portfolio optimisation today, I would either use a highly constrained MVO, or HRP, or something like HERC (which PyPortfolioOpt doesn't have but riskfolio-lib does)