This is a package for calculating performance metrics for quantitative finance
Project description
QuantPerf: Portfolio analytics and performance calculation for financial data
QuantPerf Python library that performs portfolio profiling, allowing quants and portfolio managers to understand their performance better by providing them with in-depth analytics and risk metrics.
-
quant_performance.report.perf- for calculating various performance metrics, like Sharpe ratio, Win rate, Volatility, etc. -
quant_performance.report.total_return_chart- for calculating total_return of DataSeries
Here's an example of a simple tear sheet analyzing a strategy:
Quick Start
.. code:: python
from quant_performance.report import perf
# fetch the daily returns for a stock
df = pd.read_csv("./test_data/test_data.csv",parse_dates=['Date'] , index_col='Date')
metrics , dataframe = perf(df['Close'])
# metrics is metrics data that calculate and return as json
# dataframe is whole calculations for metrics for every row and date
Output:
.. code:: text
# metrics should return you json data like this :
{'annualized_downside_volatility': 3.13,
'anualreturn_1y': 21.01,
'anualreturn_3y': 21.95,
'anualreturn_5y': 17.02,
'anualreturn_si': 0.63,
'anuualized_gain_volatility': 2.79,
'anuualized_loss_volatility': 3.41,
'anuualized_volatility': 3.92,
'average_monthly_gain': 0.69,
'average_monthly_loss': -0.72,
'best_month': 9.39,
'best_month_date': '2020-03-24 ',
'burke_ratio': -0.0,
'calmar_ratio': 0.02,
'compounded_return': 0.09,
'gain_loss_ratio': 1.18,
'kurtosis': 19.43,
'maximum_drawdown': -33.79,
'maximum_drawdown_date': '2020-03-23 ',
'negative_months_fraction': 44.87,
'omega_ratio': 0.93,
'plm': -0.97,
'positive_months_fraction': 55.02,
'psi': 152.16,
'sharp_ratio': -0.08,
'skewness': -0.67,
'sortino_ratio': -0.03,
'sterling_ratio': -0.33,
'ulcer_index': 1.78,
'worse_month': -11.98,
'worse_month_date': '2020-03-16 ',
'yearly_return': {'2015': 1.4,
'2016': 11.96,
'2017': 21.83,
'2018': -4.38,
'2019': 31.49,
'2020': 18.4,
'2021': 28.71,
'2022': -4.84
}}
*** Full documenttion coming soon ***
In the meantime, you can get insights as to optional parameters for each method, by using Python's help method:
.. code:: python
help(qs.stats.conditional_value_at_risk)
.. code:: text
Help on function conditional_value_at_risk in module quantstats.stats:
conditional_value_at_risk(returns, sigma=1, confidence=0.99)
calculats the conditional daily value-at-risk (aka expected shortfall)
quantifies the amount of tail risk an investment
Installation
Install using pip:
.. code:: bash
$ pip install quant_performance --upgrade --no-cache-dir
Requirements
Python <https://www.python.org>_ >= 3.5+pandas <https://github.com/pydata/pandas>_ (tested to work with >=0.24.0)numpy <http://www.numpy.org>_ >= 1.15.0
P.S.
Please drop me a note with any feedback you have.
Amir najafi
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file quant_performance-0.0.1.tar.gz.
File metadata
- Download URL: quant_performance-0.0.1.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25b9d3542da86908ff6472af71334c47c35eb149ffb61771796cfab95219d8b4
|
|
| MD5 |
b98137e53061e535749e33f891d6967d
|
|
| BLAKE2b-256 |
03de9fe241fe17bd4b5f76b113696bf12c4958eb5254e4f9d3f581077aa870f6
|
File details
Details for the file quant_performance-0.0.1-py2.py3-none-any.whl.
File metadata
- Download URL: quant_performance-0.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
156579f0c0a28da558b4a1587efcde8b4a84b25374178bd3dfb8aef178224162
|
|
| MD5 |
23ecef78a9eb969b596a61577bfc6728
|
|
| BLAKE2b-256 |
e6b0c4d5ca404edd0c6ffb290d5be8236890e3da3858d635c457ef8913199b65
|