Skip to main content

Portfolio Optimization for Pension Funds

Project description

PenFolioOp

Portfolio Optimizations for Pension Funds

Supported optimizers

  • Surplus Return Maximization
  • Surplus Variance Minimization
  • Surplus Sharpe Ratio Maximization
  • Mean-Variance Optimization

Surplus return is defined as the return of the portfolio minus the return of the liabilities, while surplus variance is the variance of the portfolio returns in excess of the liabilities.

Supported constraints

Asset weight constraints can be applied to ensure that the portfolio adheres to specific investment guidelines.

Usage of the library is straightforward. You can create a portfolio object, define your assets, and then use the optimizers to find the optimal asset weights based on your constraints and objectives.

Example

The first step is to create a Portfolio object with your assets, their expected returns, and covariances. The last item in the list of assets should be the liability, which is treated differently from the other assets in the optimization process. The optimizaters always set the liability weight to -1 and require the other asset weights to be between 0 and 1 and sum to 1.

The user can then define additional constraints on the asset weights, such as requiring a minimum or maximum weight for certain assets or limiting the weight of one asset to be less than another.

For a comprehensive description of the constraints, refer to the API documentation.

from penfolioop import Portfolio, SurplusReturnMaximization

names = ['Asset A', 'Asset B', 'Asset C', 'Liability']
returns = [0.05, 0.07, 0.06, 0.04]
covariances = [[0.0001, 0.00005, 0.00002, 0.00003],
               [0.00005, 0.0002, 0.00001, 0.00004],
               [0.00002, 0.00001, 0.00015, 0.00002],
               [0.00003, 0.00004, 0.00002, 0.0001]]

portfolio = Portfolio(names, returns, covariances)

constraints = [
    {
        'left_indices': ['Asset A', 'Asset B'],
        'operator': '>=',
        'right_value': 0.5
    }
    {
        'left_indices': ['Asset C'],
        'operator': '<=',
        'right_index': ['Asset B']
    }
]

weights = SurplusReturnMaximization(portfolio=portfolio, asset_constraints=constraints)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

penfolioop-0.1.0.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

penfolioop-0.1.0-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file penfolioop-0.1.0.tar.gz.

File metadata

  • Download URL: penfolioop-0.1.0.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.20

File hashes

Hashes for penfolioop-0.1.0.tar.gz
Algorithm Hash digest
SHA256 38b8af9f255192b64c462221c8ddc9768e079d60e201e12305023ecfd11ebb54
MD5 5e061a44086a98a17b0fb951d3bbf29c
BLAKE2b-256 8915d953658cf6bf7d3740dd9f6a90240cf178e29756c55fdb3f3bff79f153a6

See more details on using hashes here.

File details

Details for the file penfolioop-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: penfolioop-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.20

File hashes

Hashes for penfolioop-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 04c93d32627e3c295cd292211be5181982d35d52b1a854e6b0e2f78f735cfb6d
MD5 35a57ed399ddffbf7d6f4404e5e5a177
BLAKE2b-256 51057eaf3a699fac87f08691bd4004e84f479c78d94cc5d2f317c92e3bdc4ee9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page