pybacktestchain-ev
Package for the Python Course based on pybacktestchain library by J. Imbet.
Overview
pybacktestchain-ev is a Python package designed to facilitate portfolio backtesting using various trading strategies. The package incorporates risk management tools, blockchain-based backtest storage, and a user-friendly interface built with Streamlit.
The package includes:
- A fully interactive Streamlit-based user interface (UI).
- Support for multiple asset classes (stocks, commodities, FX, fixed income, etc.).
- Customizable backtesting parameters and risk management tools.
- Pre-processing capabilities for data compatibility across all time zones.
Installation
You can install the package via pip:
$ pip install pybacktestchain-ev
Features
- Interactive UI: A Streamlit-based interface for configuring backtests, visualizing results, and analyzing performance and risk metrics.
- Portfolio Backtesting: Supports backtesting of standard trading strategies:
- Equal Weight
- Minimum Variance
- Maximum Sharpe Ratio
- Risk Parity
- Customizable Transaction Costs: Allows precise configuration of trading fees for realistic simulations.
- Risk Management:
- Includes stop-loss and take-profit mechanisms with customizable thresholds.
- Computes Value-at-Risk (VaR) and Expected Shortfall (ES) with user-defined confidence levels.
- Pre-Processing:
- Handles data across various asset classes and ensures compatibility across time zones.
- Blockchain Integration: Stores backtest results in a tamper-proof blockchain for future reference.
Usage
Running the Streamlit Interface
To start the Streamlit interface:
$ streamlit run <your_app_file>.py
Configuring a Backtest
- Select Tickers: Enter assets' tickers (comma-separated) to define the universe (supports all asset classes).
- Set Parameters:
- Initial cash amount.
- Start and end dates for the backtest.
- Choose a strategy:
- Equal Weight
- Minimum Variance
- Maximum Sharpe Ratio
- Risk Parity
- Configure risk management:
- Stop-loss and take-profit thresholds.
- Transaction costs.
- Confidence levels for VaR and Expected Shortfall.
- Run the Backtest: Click the "Run Backtest" button.
Viewing Results
- Summary Statistics: Includes key metrics for the backtested portfolio.
- Visualizations:
- Portfolio value and returns over time.
- Distribution of returns.
- Correlation heatmap of asset returns.
- Risk Metrics: Displays VaR and Expected Shortfall with selected confidence levels.
- Transaction Log: Provides detailed insights into executed trades.
- Blockchain Storage: Saves each backtest under a randomly generated name for future reference.
Blockchain Storage
Each backtest is saved in a blockchain file under a randomly generated name. This ensures results are tamper-proof and can be referenced later. Blockchain files are stored in the blockchain/ directory within the package folder.
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
pybacktestchain-ev was created by Enzo Volpato. It is licensed under the terms of the MIT license.
Credits
pybacktestchain-ev was created with cookiecutter and the py-pkgs-cookiecutter template.
Metadata
Release files for pybacktestchain-ev 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pybacktestchain_ev-0.1.2.tar.gz | 11.9 kB | Without provenance | Details for pybacktestchain_ev-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pybacktestchain_ev-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for pybacktestchain_ev-0.1.2-py3-none-any.whl |
Total release size: 24.9 kB
Release files / pybacktestchain_ev-0.1.2.tar.gz
| Download URL | pybacktestchain_ev-0.1.2.tar.gz |
|---|---|
| Size | 11.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
976a5bb159fed6e20b264da227e541eaba886f4da75ad362a578c7e4c1035bd8
|
|
BLAKE2b-256 checksum How to use checksums |
d2f64651eed34ab8e5fec15b6b8ef948fcfc18e00bbb88ec1be2ec9ef28bd196
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.11.10
|
Release files / pybacktestchain_ev-0.1.2-py3-none-any.whl
| Download URL | pybacktestchain_ev-0.1.2-py3-none-any.whl |
|---|---|
| Size | 13.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a5bf4eb1d7a7e20d4899813ca41985b8f2cea339dfc26342e69d594c3fa49fef
|
|
BLAKE2b-256 checksum How to use checksums |
fa4b0d97b57673839232b24c1549602a4c6905bd9207fdbac068a4dfcbc1ad22
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.11.10
|
Security for pybacktestchain-ev 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.