Skip to main content

This project is based on pybacktestchain but new functionalities have been added!

Reason this release was yanked:

Modified README.md

Project description

Project: python_project_RD

Purposes

Improve the package pybacktestchain by:

  1. Adding new asset allocation strategies (extra_modules.py):
    • Added RiskParity class as a subclass to the Information class from pybacktestchain,
    • Added MinimumVariancePortfolio class as a subclass to the Information class from pybacktestchain.
  2. Extending the analysis for the user (extra_broker.py):
    • Created the CustomBroker subclass from the Broker class of pybacktestchain in order to modify the execute_portfolio function,
    • Developed the AnalysisTool class, which computes different statistics for portfolio analysis,
    • Modified Backtest class so that after running the run_backtest() function, CSV, PNG, and TXT files are saved in the \python_project_RD\backtest_analysis directory, providing users with additional analysis on the backtest.
  3. Being participative and user-friendly (user_function.py):
    • Created strategy_choice() function to allow users to choose a strategy for the backtest among several options,
    • Created ask_user_for_comment() function enabling users to leave a comment on the project's discussions page on GitHub,
    • Created get_initial_parameter() function for users to select parameters for running the backtest, such as the initial cash, the stop loss threshold, the start date and the end date of the backtest.

Overall, this package enables users to create tailored and bespoke backtests on Equity and provides tools for comparing different backtests.

Installation

$ pip install python_project_RD

Usage

# Enable or disable logging verbosity
verbose = False  # Set to True to enable logging, or False to suppress it


initial_cash, stop_loss_threshold, start_date, end_date = get_initial_parameter()# Gather initial parameters from the user
strategy, strategy_name = strategy_choice()# Allow the user to choose a trading strategy and store the selected strategy name
ask_user_for_comment() # Prompt the user for additional comments regarding the backtest setup

# Create a customized backtest instance with user-defined parameters
backtest = Backtest(
    initial_date=start_date,          # Start date for the backtesting period
    final_date=end_date,              # End date for the backtesting period
    initial_cash=initial_cash,        # Initial cash amount for the backtest
    threshold=stop_loss_threshold,     # Stop loss threshold for risk management
    information_class=strategy,       # Selected strategy class for the backtest
    strategy_name=strategy_name,      # User-defined name for the selected strategy
    risk_model=StopLoss,               # Risk model used in the backtest (e.g., Stop Loss)
    name_blockchain='backtest',        # Name identifier for the backtest instance
    verbose=verbose                    # Logging verbosity setting
)

# Execute the backtest with the specified parameters
backtest.run_backtest()

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

python_project_RD was created by Rosalie Dechance. This same package is based on the pybacktestchain package created by by Juan F. Imbet as part of a project for the course Python Programming for Finance at Paris Dauphine University - PSL.

It is licensed under the terms of the MIT license.

Credits

python_project_RD 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

python_project_rd-0.4.0.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

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

python_project_rd-0.4.0-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file python_project_rd-0.4.0.tar.gz.

File metadata

  • Download URL: python_project_rd-0.4.0.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.11.10 Windows/10

File hashes

Hashes for python_project_rd-0.4.0.tar.gz
Algorithm Hash digest
SHA256 4aaf383ae75f2a08c39cdaece047d28a3f6ef6a44ec526ac8c55648b03d14618
MD5 4f2fedd12205fb320aeae23eb43db687
BLAKE2b-256 845955ec6bf772542d8c07976df2c1987b755dce374eb793357fc91372ca68cb

See more details on using hashes here.

File details

Details for the file python_project_rd-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: python_project_rd-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.11.10 Windows/10

File hashes

Hashes for python_project_rd-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7f1986cf13f56105899942111de7de17078ab195323130c1bb8132f884611c9e
MD5 d513c93202c4f902f381725d7f2de269
BLAKE2b-256 e5cf6ea9c2d499a7f9c31d54757efe8e15f3df8ad0d4f3a2a08f159b39a6549a

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