Skip to main content

Improved pybacktestchain library with interactive UI and features added (risk measures, trading strategies, multiple asset classes)

Project description

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:

$ 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:

$ 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 and the py-pkgs-cookiecutter template.

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

pybacktestchain_ev-0.1.0.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pybacktestchain_ev-0.1.0-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file pybacktestchain_ev-0.1.0.tar.gz.

File metadata

  • Download URL: pybacktestchain_ev-0.1.0.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.10

File hashes

Hashes for pybacktestchain_ev-0.1.0.tar.gz
Algorithm Hash digest
SHA256 baedc504f27e62bd7c30c9225b6a3890a4dd5fbf99c9b98f544d72bd3219c062
MD5 c57a3377024afc3a9e25860510443a0e
BLAKE2b-256 60cf6ea6305ffe09d4b3563bcd6d285d5433f774c1bbc84dc19415593b8915a7

See more details on using hashes here.

File details

Details for the file pybacktestchain_ev-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pybacktestchain_ev-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a0225dd382256cf2063c0d40aeef123fe2153b6e467bb3c6f5b916a3a09e3eb5
MD5 7ae625e87b75c91668560924e95edc24
BLAKE2b-256 025ba6c5a50d8420639b9a727544529c643f1cf8a40b6de4862707eca58a1b91

See more details on using hashes here.

Supported by

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