Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User specified covariance matrix #39

Closed
ghost opened this issue Sep 1, 2021 · 10 comments
Closed

User specified covariance matrix #39

ghost opened this issue Sep 1, 2021 · 10 comments

Comments

@ghost
Copy link

ghost commented Sep 1, 2021

Is possible to use a user-specified covariance matrix in the portfolio optimisation, especially with regards to the HRP or HERC?

I don't see that this possible according to the documentation

@dcajasn
Copy link
Owner

dcajasn commented Sep 1, 2021

Hi, not by now, when I implement that feature I will release and example.

@ghost
Copy link
Author

ghost commented Sep 1, 2021

I think is good to have this feature asap if you want to further increase the visibility and outreach of the package because industry people usually work with their own covariance matrix. De Prado's research was very influential on this.

@dcajasn
Copy link
Owner

dcajasn commented Sep 1, 2021

Hi, well by now is not my priority to include that feature. Now I'm focus on other features like additional hierarchical clustering techniques, NCO model and relaxed risk parity.

@ghost
Copy link
Author

ghost commented Sep 1, 2021

Up to you. Sound interesting additions. But my advice is that people would care more about a feature having a user-specified covariance because this is at the heart of all portfolio max problems. In practice, people first try to remove as much of the noise in the covariance matrix as possible by applying their own customised techniques before they use any optimisation routine.

Anyways, looking forward to these new features then.

@dcajasn
Copy link
Owner

dcajasn commented Sep 1, 2021

Covariance is only the heart of Markowitz related models. HRP and HERC use naive risk parity and only need covariance when risk measure is variance. For covariance case, Riskfolio-Lib has options to reduce noise, for example we can use shrinkage methods like ledoit-wolf, oas and oracle; also you can use ewma methods to increase the weights of last observations in estimated covariance.

@ghost
Copy link
Author

ghost commented Sep 2, 2021

Correct. But read De Prado's Asset Management on the covariance matrix. I am only telling you my opinion that between those priorities my sense is that the industry would rather prefer to have the feature with a user-specified covariance matrix, rather than other features you mentioned.

But again, up to you. You did an excellent job so far and thanks for the library.

@dcajasn
Copy link
Owner

dcajasn commented Sep 2, 2021

I know that some people prefer to build their own covariance matrix, in Portfolio object there is that option but not in HCPortfolio object. I will try to add this feature when I implement NCO (something like factors_stats, blacklitterman_stats, blfactors_stats and custom cov) but it's not my priority for now. As Riskfolio-Lib is my hobby, in most cases the features that I add are models that seems interesting to me from the mathematical perspective.

@dcajasn
Copy link
Owner

dcajasn commented Oct 11, 2021

Hi @msh855, I implement the option to use custom covariance in hierarchical clustering portfolios. Update your Riskfolio-Lib version to the latest to try the new features.

@ghost
Copy link
Author

ghost commented Oct 11, 2021

Thanks for letting me know. Though covariance matrices may not change anything to a hierarchical clustering portfolio because such methods construct clusters based on the relative distance between assets which different covariances may not affect much. So, clustering and hence optimal shares are likely to be the same across different covariance matrices. I have tried this in the past and indeed the portfolio was robust to covariance matrices. But happy to investigate again based on your RiskFolio capabilities.

@dcajasn
Copy link
Owner

dcajasn commented Oct 11, 2021

Hi @msh855, custom covariance could affect hierarchical portfolios in two ways:

  • If the distance metric is covariance-based, the custom covariance change the distance metric and the hierarchical structure.
  • In the optimization process, custom covariance change the inter and intra cluster variance calculations.

@dcajasn dcajasn closed this as completed Dec 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant