Skip to content

Reorganise efficient frontier submodule  #290

Closed

Description

@robertmartin8

Is your feature request related to a problem?
When it was just EfficientFrontier and EfficientSemivariance, it was fine to have it all in one monolithic efficient_frontier.py file. However, with the addition of EfficientCVaR and now CDaR (#283), we need to make it more scalable.

Constraints:

  • Must be backwards compatible
  • Since all of these methods are logically related to efficient frontier, I want them to be importable as from pypfopt.efficient_frontier import x, but also from pypfopt import x.

Proposed solution

This should be quite an easy fix. We create a new pypfopt/efficient_frontier folder with its own __init__.py. Directory will look something like:

- pypfopt/
     - __init__.py
     - risk_models.py
     - expected_returns.py
     - ...
     - efficient_frontier/
         - __init__.py
         -  efficient_frontier.py  # contains EfficientFrontier
         - efficient_semivariance.py # contains EfficientSemivariance
         - ...

Activity

  1. added
    enhancement
    maintenance
    on Feb 17, 2021
  2. phschiele commented on Feb 18, 2021

    @phschiele
    Contributor

    I think the structure makes sense. I guess when starting from scratch, one would change the efficient_frontier.py name to something like efficient_variance, but given that this is one of the core modules, I see why you would not want to change that.

    Edit: had a comment about the import being more cumbersome in that structure, but that can of course be fixed with the __init__ file.

  3. added 2 commits that reference this issue on Feb 19, 2021
    388678e
    72b8bdb
  4. linked a pull request that will close this issuev1.4.1 #298on Feb 19, 2021
  5. linked a pull request that will close this issuev1.4.1 #299on Feb 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementmaintenance

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions