Skip to content

Feature request: Upgrade HRPOpt to prefer supplied covariance matrix #637

@RobertWSmith

Description

@RobertWSmith

Is your feature request related to a problem?
I was looking at the source code for HRPOpt and noticed that it prefers to compute the covariance as opposed to using the constructor supplied covariance matrix. I read through the earlier discussion, and was reading the code because I was interested in the implementation.

Describe the feature you'd like
I believe the following change to HRPOpt.optimize would allow users to supply both returns and a pre-shrunk covariance matrix and get the expected results:

        if self.cov_matrix is not None:
            cov = self.cov_matrix
            corr = risk_models.cov_to_corr(self.cov_matrix).round(6)
        else:
            corr, cov = self.returns.corr(), self.returns.cov()

I'm testing out this change locally and if I can get all your unit tests to pass I'd like to submit a pull request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions