Metadata-Version: 2.1
Name: python_project_RD
Version: 0.4.0
Summary: This project is based on pybacktestchain but new functionalities have been added!
License: MIT
Author: Rosalie Dechance
Requires-Python: >=3.11,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Dist: matplotlib (>=3.9.3,<4.0.0)
Requires-Dist: numpy (>=2.1.3,<3.0.0)
Requires-Dist: pandas (>=2.2.3,<3.0.0)
Description-Content-Type: text/markdown

# 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

```bash
$ pip install python_project_RD
```


## Usage

```python

# 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`](https://cookiecutter.readthedocs.io/en/latest/) and the `py-pkgs-cookiecutter` [template](https://github.com/py-pkgs/py-pkgs-cookiecutter).
