Metadata-Version: 2.3
Name: pybacktestchain_ev
Version: 0.1.0
Summary: Improved pybacktestchain library with interactive UI and features added (risk measures, trading strategies, multiple asset classes)
License: MIT
Author: Enzo Volpato
Author-email: enzo.volpato@outlook.fr
Requires-Python: >=3.10,<4
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Dist: markdown-it-py (>=1.0.0,<3.0.0)
Requires-Dist: matplotlib (>=3.5,<4.0)
Requires-Dist: numpy (>=1.22,<2.0)
Requires-Dist: pandas (>=2.2.2,<3.0.0)
Requires-Dist: pytest (>=7.0,<8.0)
Requires-Dist: scipy (>=1.7.0,<1.14.0)
Requires-Dist: seaborn (>=0.11,<0.12)
Requires-Dist: sec-cik-mapper (==2.1.0)
Requires-Dist: streamlit (>=1.0,<2.0)
Requires-Dist: yfinance (>=0.2.41,<0.3.0)
Description-Content-Type: text/markdown

# pybacktestchain_EV

Package for the Python Course based on pybacktestchain library by J. Imbett.

## 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.

## Installation

You can install the package via pip:

```bash
$ pip install pybacktestchain_EV
```

## Features

- **Interactive UI**: A Streamlit-based interactive interface for configuring backtests, visualizing results, analyzing performance and risk metrics.
- **Portfolio Backtesting**: Supports backtesting of standard trading strategies such as Equal Weight, Minimum Variance, Maximum Sharpe Ratio, and 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, as well as Value-at-Risk (VaR) and Expected Shortfall for the backtested portfolio.
- **Blockchain Integration**: Stores backtest results in a blockchain.

## Usage

### Running the Streamlit Interface

To start the Streamlit interface:

```bash
$ streamlit run <your_app_file>.py
```

### Configuring a Backtest

1. **Select Tickers**: Enter stock tickers (comma-separated) to define the universe (works across all asset classes).
2. **Set Parameters**:
   - Initial cash amount.
   - Start and end dates for the backtest.
   - Choose a strategy: Equal Weight, Minimum Variance, Maximum Sharpe Ratio, or Risk Parity.
   - Configure risk management: Stop-loss, take-profit percentages, and transaction costs.
3. **Run the Backtest**: Click the "Run Backtest" button.

### Viewing Results

- Portfolio value and returns are displayed over time, as well as the distribution of returns.
- Risk metrics, such as Value-at-Risk (VaR) and Expected Shortfall (ES), are calculated.
- A transaction log is provided for detailed insights and store to the blockchain.
- Additional visualizations include correlation heatmaps and return distributions.

### Blockchain Storage

Each backtest is saved in a blockchain 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`](https://cookiecutter.readthedocs.io/en/latest/) and the `py-pkgs-cookiecutter` [template](https://github.com/py-pkgs/py-pkgs-cookiecutter).

