pyvest


Namepyvest JSON
Version 0.0.6 PyPI version JSON
download
home_pageNone
SummaryPyVest is a Python library that provides tools for investment analysis.
upload_time2024-11-03 18:30:27
maintainerNone
docs_urlNone
authorNone
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": null,
    "name": "pyvest",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "Patrick Munroe <patrick.munroe@gmail.com>",
    "keywords": "finance, investment, portfolio theory",
    "author": null,
    "author_email": "Patrick Munroe <patrick.munroe@gmail.com>, S\u00e9bastien Plante <mrplante@hotmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/65/66/0bf2b0c635b55f3d82fec1878c343f101f13167abd9894b9290b0c9cea54/pyvest-0.0.6.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.6",
    "project_urls": {
        "Homepage": "https://github.com/pamun/pyvest"
    },
    "split_keywords": [
        "finance",
        " investment",
        " portfolio theory"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6032826ceace37bd3aea63e1670b1ab4068190b2c7d821f67f8eca705909b21c",
                "md5": "b73d2f28af5a73ede7f958001d123cb8",
                "sha256": "61707bfea5a710ed3403d37c5663d959ffbe73d2e81c08ed65d3bf47fe0efbf7"
            },
            "downloads": -1,
            "filename": "pyvest-0.0.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b73d2f28af5a73ede7f958001d123cb8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 50104,
            "upload_time": "2024-11-03T18:30:26",
            "upload_time_iso_8601": "2024-11-03T18:30:26.961684Z",
            "url": "https://files.pythonhosted.org/packages/60/32/826ceace37bd3aea63e1670b1ab4068190b2c7d821f67f8eca705909b21c/pyvest-0.0.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "65660bf2b0c635b55f3d82fec1878c343f101f13167abd9894b9290b0c9cea54",
                "md5": "1e8b26f96494b5539da660a4172162e1",
                "sha256": "cbd03a54c9b932d0a1ef810ce9b69f132188858f0fb86ffaf070a38633df91ee"
            },
            "downloads": -1,
            "filename": "pyvest-0.0.6.tar.gz",
            "has_sig": false,
            "md5_digest": "1e8b26f96494b5539da660a4172162e1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 42210,
            "upload_time": "2024-11-03T18:30:27",
            "upload_time_iso_8601": "2024-11-03T18:30:27.907768Z",
            "url": "https://files.pythonhosted.org/packages/65/66/0bf2b0c635b55f3d82fec1878c343f101f13167abd9894b9290b0c9cea54/pyvest-0.0.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-03 18:30: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.32658s