Skip to main content

======================= Mean Variance Portfolio

.. image:: https://img.shields.io/pypi/v/mvport.svg :target: https://pypi.python.org/pypi/mvport

.. image:: https://github.com/condereis/mean-variance-portfolio/actions/workflows/python-app.yml/badge.svg :target: https://github.com/condereis/mean-variance-portfolio/actions/workflows/python-app.yml

.. image:: https://readthedocs.org/projects/mean-variance-portfolio/badge/?version=latest :target: https://mean-variance-portfolio.readthedocs.io/en/latest/?badge=latest :alt: Documentation Status

.. image:: https://pyup.io/repos/github/condereis/mean-variance-portfolio/shield.svg :target: https://pyup.io/repos/github/condereis/mean-variance-portfolio/ :alt: Updates

MV Port is a Python package to perform Mean-Variance Analysis. It provides a Portfolio class with a variety of methods to help on your portfolio optimization tasks.

.. Modern portfolio theory (MPT), or mean-variance analysis, is a mathematical framework for assembling a portfolio of assets such that the expected return is maximized for a given level of risk. It is a formalization and extension of diversification in investing, the idea that owning different kinds of financial assets is less risky than owning only one type. Its key insight is that an asset's risk and return should not be assessed by itself, but by how it contributes to a portfolio's overall risk and return. It uses the variance of asset prices as a proxy for risk.

Features

  • Easy portfolio setup
  • Portfolio evaluation
  • Random portfolio allocation
  • Minimum Variance Portfolio optimization
  • Efficient Frontier evaluation
  • Tangency Portfolio for a given risk free return rate

Installation

To install MV Port, run this command in your terminal:

.. code:: bash

$ pip install mvport

Check here <https://mean-variance-portfolio.readthedocs.io/en/latest/installation.html>_ for further information on installation.

Basic Usage

Instantiate a portfolio and add some stock and evaluate it given a set of weights:

.. code:: python

>>> import mvport as mv
>>> p = mv.Portfolio()
>>> p.add_stock('AAPL', [.1,.2,.3])
>>> p.add_stock('AMZN', [.1,.3,.5])
>>> mean, variance, sharp_ratio, weights = p.evaluate([.5, .5])
>>> print '{} +- {}'.format(mean, variance)
0.25 +- 0.0225

Check here <https://mean-variance-portfolio.readthedocs.io/latest/usage.html>_ for further information on usage.

Metadata

Release files for mvport 1.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mvport 1.3.2
File Size Uploaded
mvport-1.3.2.tar.gz 14.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mvport 1.3.2
File Interpreter ABI Platform
mvport-1.3.2-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 22.5 kB

Release files / mvport-1.3.2.tar.gz

Download URL mvport-1.3.2.tar.gz
Size 14.8 kB
Tags Source
SHA-256 checksum
How to use checksums
862cfcdc5dcfa415ffd71cf15e4dba0ac39eb969afd17ee6c0bd69284d2501d1
BLAKE2b-256 checksum
How to use checksums
abc7fd3f86f0232f5f283928726ed9ded70cdca09803217262322ee7bb311bf2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release files / mvport-1.3.2-py2.py3-none-any.whl

Download URL mvport-1.3.2-py2.py3-none-any.whl
Size 7.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
3dadaaf7721d6f593f694c5f400fd6db4e24a39f7122499fabdad26141fa8483
BLAKE2b-256 checksum
How to use checksums
3a93e17769db38f0466fb3649a4f16fdb4f17a04e71ec3bcfee02fce15aa5bb0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release history Release notifications | RSS feed

This release

1.3.2 This release

2 release files

1.3.1

2 release files

1.3.0

1 release file

1.2.0

2 release files

1.1.0

2 release files

1.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page