A package that I created for my Python project :)
Project description
my_package_project
A package that I created for my Python project :)
Installation
$ pip install my_package_project
Usage
-
This package is an extenstion of the
pybacktestchainpackage. -
This package is designed to provide tools for backtesting financial strategies, with a focus on risk parity portfolios.
-
It enables to evaluate portfolio performance through various metrics, including portfolio volatility, annaulized return, risk contributions or Sharpe ratio.
-
It also includes functionality to visualize portfolio characteristics and performance over time.
-
Output and Reporting:
- Generates interactive visualizations.
- Exports results as a Jupyter Notebook for detailed review.
- Saves plots and transaction logs for further analysis.
Example of usage
from datetime import date, timedelta, datetime
from my_package_project.data_treatment import *
from my_package_project.graphs import *
from my_package_project.operations import *
test = Backtest_up(
initial_date = datetime(2017, 1, 1),
final_date = datetime(2020, 12, 31),
information_class = FirstTwoMoments,
risk_model=StopLoss,
)
test.run_backtest()
Key classes and functions
Backtest Framework: (operations)
Backtest_up:- Runs the backtest, calculates metrics, and generates reports.
Portfolio Visualizations: (graphs)
PortfolioVisualizer:- Visualizes initial portfolio weights and risk contributions.
- Methods:
plot_portfolio_weights: Bar chart of portfolio weights.plot_risk_allocation_pie: Pie chart of risk contributions.
PortfolioVisualizer_over_time:- Tracks portfolio performance and weights over time.
- Methods:
plot_portfolio_weights_over_time: Stacked area chart of weights.plot_portfolio_value_over_time: Line chart of portfolio value.compute_annualized_returns: Calculates portfolio annualized returns.compute_annualized_volatility: Calculates portfolio annualized volatility.compute_sharpe_ratio: Calculates the Sharpe ratio.
Risk Parity Framework: (data_treatment)
compute_risk_contributions: Computes the contribution of each asset to portfolio risk.portfolio_volatility: Calculates portfolio volatility using covariance matrix.RiskParity:compute_portfolio_riskparity: Constructs risk parity portfolio.compute_portfolio_riskparity_voltarget_leverage: Constructs risk parity portfolios with optional leverage and target volatility.
Contributing
Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.
License
my_package_project was created by marcdeslis. It is licensed under the terms of the MIT license.
Credits
my_package_project was created with cookiecutter and the py-pkgs-cookiecutter template.
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 my_package_project-1.3.0.tar.gz.
File metadata
- Download URL: my_package_project-1.3.0.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.11.9 Darwin/23.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
58350b1fd8c6b923be466d4b02662f9208727b2d00b170c8c610a442cf6da285
|
|
| MD5 |
908a978f37b957a1f2d402c3a74c188c
|
|
| BLAKE2b-256 |
16da9d89b8820d59c1e07af9146e57c485aa60836a397f1ed188a1d0127a5b75
|
File details
Details for the file my_package_project-1.3.0-py3-none-any.whl.
File metadata
- Download URL: my_package_project-1.3.0-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.11.9 Darwin/23.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94bb792cb1247400168391024c96d2c7994ea87ab405ecc8823ed3b5f544896c
|
|
| MD5 |
5bc89323cdda48af094c91bf9fcf9189
|
|
| BLAKE2b-256 |
ee84423957d5ea2b75ec316efd8432c41111bcc93707210199f416ee41096861
|