Skip to main content

Tools to manage portfolio risk analysis

Project description

invest-tools

PyPI version codecov License: MIT Code style: black

Tools to manage portfolio risk analysis

Installation

As a python package this should be installable through:

pip install invest-tools

Or:

poetry add invest-tools

Dependencies

The dependencies of this project can be seen in the pyproject.toml file. However for completeness there is a dependcy on pandas, statsmodels and matplotlib as the basics.

Data Inputs

There are three data inputs which should be present for the package to work as expected.

The path strings to the csvs can be passed in.

  1. Portfolio price data as a CSV
TIDM Date Open High Low Close Volume Adjustment
EG 01/01/2023 1 1 1 1 1 1
EG2 01/01/2023 1 1 1 1 1 1
  1. Currency data as a CSV
Date Open High Low Close Adj Close Volume
01/01/2023 1 1 1 1 1 1

Example

Build a portfolio of two securities called EG and EG2 with the weighting split 50:50 between the two. One is denominated in GBP and one in USD.

This will output the mean returns of such a portfolio.

import numpy as np
from invest_tools import portfolio

portfolio_definition = {
    "EG": {
        "weight": 0.5,
        "currency": "gbp"
    },
    "EG2": {
        "weight": 0.5,
        "currency": "usd"
    }
}

port = portfolio.Portfolio(portfolio_definition, portfolio.Currency.GBP)
port.get_usd_converter("path/to/csv")
port.get_prices("path/to/csv")
port.build()
port.analyse()
print(port.analysis)
port.plot_correlation_heatmap()
port.plot_returns_data()

License

MIT

Contact

Just open an issue I guess?

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

invest_tools-0.3.0.tar.gz (8.0 kB view hashes)

Uploaded Source

Built Distribution

invest_tools-0.3.0-py3-none-any.whl (8.6 kB view hashes)

Uploaded Python 3

Supported by

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