pyvest


Namepyvest JSON
Version 0.0.3 PyPI version JSON
download
home_page
SummaryPyVest is a Python library that provides tools for investment analysis.
upload_time2023-11-27 01:11:27
maintainer
docs_urlNone
author
requires_python>=3.7
licenseMIT
keywords finance investment portfolio theory
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PyVest

PyVest is a Python library that provides tools for investment 
analysis.

## Risk-return trade-off graph

PyVest can be used to easily create graphs of risk-return trade-off. 
Given a set of risky and/or non-risky assets, the following objects 
can be represented on a two-dimensional graph of the expected return 
vs the standard deviation:

- Feasible portfolios
- Minimum variance portfolio (MVP)
- Efficient frontier
- Tangency portfolio
- Capital allocation line (CAL)
- Optimal portfolio of an investor
- Indifference curves of an investor


### Example 1: No risk-free asset

Import the class InvestmentUniverse:

    from pyvest import InvestmentUniverse

Define the names of the assets:

    assets = ['KO', 'MSFT']

Define the expected returns corresponding to each asset:

    mu = [8, 14]

Define the variance-covariance matrix of the assets:

    cov = [[3**2, 0],
           [0, 6**2]]

Construct the InvestmentUniverse corresponding to those assets:

    investment_universe = InvestmentUniverse(assets, mu, cov)

Calculate the feasible portfolios:

    investment_universe.calculate_feasible_portfolios()

Calculate the MVP:

    investment_universe.calculate_mvp()

Calculate the efficient frontier:

    investment_universe.calculate_efficient_frontier()

Plot the risk-return trade-off graph of the investment universe:

    investment_universe.plot()

### Example 2: With a risk-free asset

The risky assets are defined as above:

    from pyvest import InvestmentUniverse

    assets = ['KO', 'MSFT']
    mu = [8, 14]
    cov = [[3**2, 0],
           [0, 6**2]]

A risk-free asset of 2% is added to the investment universe:

    investment_universe_with_r_f = InvestmentUniverse(assets, mu, cov, r_f=2)

The feasible portfolios, the MVP and the efficient frontier are 
calculated as above:

    investment_universe_with_r_f.calculate_feasible_portfolios()
    investment_universe_with_r_f.calculate_mvp()
    investment_universe_with_r_f.calculate_efficient_frontier()

Calculate the tangency portfolio:

    investment_universe_with_r_f.calculate_tangency_portfolio()

Calculate the CAL:

    investment_universe_with_r_f.calculate_cal()

Plot the risk-return trade-off graph of the investment universe with a 
risk-free asset:

    investment_universe_with_r_f.plot()

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "pyvest",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "Patrick Munroe <patrick.munroe@gmail.com>",
    "keywords": "finance,investment,portfolio theory",
    "author": "",
    "author_email": "Patrick Munroe <patrick.munroe@gmail.com>, S\u00e9bastien Plante <mrplante@hotmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/de/44/ff87427ecf63a9b93aa0770316bdcc224d06d3bde62ead53a2b8a4638cdf/pyvest-0.0.3.tar.gz",
    "platform": null,
    "description": "# PyVest\r\n\r\nPyVest is a Python library that provides tools for investment \r\nanalysis.\r\n\r\n## Risk-return trade-off graph\r\n\r\nPyVest can be used to easily create graphs of risk-return trade-off. \r\nGiven a set of risky and/or non-risky assets, the following objects \r\ncan be represented on a two-dimensional graph of the expected return \r\nvs the standard deviation:\r\n\r\n- Feasible portfolios\r\n- Minimum variance portfolio (MVP)\r\n- Efficient frontier\r\n- Tangency portfolio\r\n- Capital allocation line (CAL)\r\n- Optimal portfolio of an investor\r\n- Indifference curves of an investor\r\n\r\n\r\n### Example 1: No risk-free asset\r\n\r\nImport the class InvestmentUniverse:\r\n\r\n    from pyvest import InvestmentUniverse\r\n\r\nDefine the names of the assets:\r\n\r\n    assets = ['KO', 'MSFT']\r\n\r\nDefine the expected returns corresponding to each asset:\r\n\r\n    mu = [8, 14]\r\n\r\nDefine the variance-covariance matrix of the assets:\r\n\r\n    cov = [[3**2, 0],\r\n           [0, 6**2]]\r\n\r\nConstruct the InvestmentUniverse corresponding to those assets:\r\n\r\n    investment_universe = InvestmentUniverse(assets, mu, cov)\r\n\r\nCalculate the feasible portfolios:\r\n\r\n    investment_universe.calculate_feasible_portfolios()\r\n\r\nCalculate the MVP:\r\n\r\n    investment_universe.calculate_mvp()\r\n\r\nCalculate the efficient frontier:\r\n\r\n    investment_universe.calculate_efficient_frontier()\r\n\r\nPlot the risk-return trade-off graph of the investment universe:\r\n\r\n    investment_universe.plot()\r\n\r\n### Example 2: With a risk-free asset\r\n\r\nThe risky assets are defined as above:\r\n\r\n    from pyvest import InvestmentUniverse\r\n\r\n    assets = ['KO', 'MSFT']\r\n    mu = [8, 14]\r\n    cov = [[3**2, 0],\r\n           [0, 6**2]]\r\n\r\nA risk-free asset of 2% is added to the investment universe:\r\n\r\n    investment_universe_with_r_f = InvestmentUniverse(assets, mu, cov, r_f=2)\r\n\r\nThe feasible portfolios, the MVP and the efficient frontier are \r\ncalculated as above:\r\n\r\n    investment_universe_with_r_f.calculate_feasible_portfolios()\r\n    investment_universe_with_r_f.calculate_mvp()\r\n    investment_universe_with_r_f.calculate_efficient_frontier()\r\n\r\nCalculate the tangency portfolio:\r\n\r\n    investment_universe_with_r_f.calculate_tangency_portfolio()\r\n\r\nCalculate the CAL:\r\n\r\n    investment_universe_with_r_f.calculate_cal()\r\n\r\nPlot the risk-return trade-off graph of the investment universe with a \r\nrisk-free asset:\r\n\r\n    investment_universe_with_r_f.plot()\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "PyVest is a Python library that provides tools for investment analysis.",
    "version": "0.0.3",
    "project_urls": {
        "Homepage": "https://github.com/pamun/pyvest"
    },
    "split_keywords": [
        "finance",
        "investment",
        "portfolio theory"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "683266535147058aabd4f1b08268bf058d1175b4e89b8bff772ad9e5659d6470",
                "md5": "f1f34c57e598ab4f7f8acb5cfbda4122",
                "sha256": "aad1806763b86a317fbba37c8e852e0b9b320a8e72c8f6b38e424d80a23b4739"
            },
            "downloads": -1,
            "filename": "pyvest-0.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f1f34c57e598ab4f7f8acb5cfbda4122",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 29600,
            "upload_time": "2023-11-27T01:11:26",
            "upload_time_iso_8601": "2023-11-27T01:11:26.094398Z",
            "url": "https://files.pythonhosted.org/packages/68/32/66535147058aabd4f1b08268bf058d1175b4e89b8bff772ad9e5659d6470/pyvest-0.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "de44ff87427ecf63a9b93aa0770316bdcc224d06d3bde62ead53a2b8a4638cdf",
                "md5": "5687ef7597a8b921f6e15ef8e91f7d93",
                "sha256": "27b33e753e5ef1ce8e94ea3cfc90b180afe44aff1c09fb3c3484104a9552d632"
            },
            "downloads": -1,
            "filename": "pyvest-0.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "5687ef7597a8b921f6e15ef8e91f7d93",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 24739,
            "upload_time": "2023-11-27T01:11:27",
            "upload_time_iso_8601": "2023-11-27T01:11:27.713888Z",
            "url": "https://files.pythonhosted.org/packages/de/44/ff87427ecf63a9b93aa0770316bdcc224d06d3bde62ead53a2b8a4638cdf/pyvest-0.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-27 01:11:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pamun",
    "github_project": "pyvest",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "pyvest"
}
        
Elapsed time: 0.14271s