|
1 | | -# Evaluation of Trading Strategies |
| 1 | +# BacktestBay: Evaluation of Trading Strategies |
| 2 | + |
| 3 | +BacktestBay is a Python-based framework for backtesting trading strategies. It leverages |
| 4 | +`yfinance` for importing financial data. |
| 5 | + |
| 6 | +## Configuration |
| 7 | + |
| 8 | +BacktestBay enables the configuration of input parameters through |
| 9 | +[config.py](https://github.com/iame-uni-bonn/final-project-niklasniedermeier-1/blob/main/src/backtest_bay/config.py). |
| 10 | + |
| 11 | +This configuration file allows for the customization of data source settings |
| 12 | + |
| 13 | +```python |
| 14 | +STOCKS = ["AAPL", "MSFT"] # List of stock symbols from yfinance |
| 15 | +START_DATES = ["2019-01-01"] # Start date for historical data ("YYYY-MM_DD") |
| 16 | +END_DATES = ["2025-01-01"] # End date for historical data ("YYYY-MM_DD") |
| 17 | +INTERVALS = ["1d"] # Data frequency (e.g., daily) |
| 18 | +``` |
| 19 | + |
| 20 | +and the choice of trading strategies |
| 21 | + |
| 22 | +```python |
| 23 | +STRATEGIES = ["bollinger", "macd", "roc", "rsi"] |
| 24 | +``` |
| 25 | + |
| 26 | +as well as the adjustment of trading parameters |
| 27 | + |
| 28 | +```python |
| 29 | +INITIAL_CASH = 1000000 # Initial capital for trading |
| 30 | +TAC = 0.005 # Transaction cost |
| 31 | +TRADE_PCT = 0.05 # Percentage of current portfolio used per trade |
| 32 | +``` |
| 33 | + |
| 34 | +providing users with enhanced control and flexibility in their backtesting process. |
| 35 | + |
| 36 | +The following trading strategies are currently implemented |
| 37 | + |
| 38 | +- 'bollinger': |
| 39 | + [Bollinger Bands](https://www.investopedia.com/terms/b/bollingerbands.asp) |
| 40 | +- 'macd': |
| 41 | + [Moving Average Convergence Divergence](https://www.investopedia.com/terms/m/macd.asp) |
| 42 | +- 'roc': [Rate of Change](https://www.investopedia.com/terms/p/pricerateofchange.asp) |
| 43 | +- 'rsi': [Relative Strength Index](https://www.investopedia.com/terms/r/rsi.asp) |
| 44 | + |
| 45 | +## Getting Started |
| 46 | + |
| 47 | +To get started, first clone the repository using the following command: |
| 48 | + |
| 49 | +```bash |
| 50 | +git clone <repository-url> |
| 51 | +``` |
| 52 | + |
| 53 | +Next, create and activate the environment by navigating to the directory containing |
| 54 | +`environment.yml` and running: |
| 55 | + |
| 56 | +```bash |
| 57 | +mamba env create -f environment.yml |
| 58 | +mamba activate backtest_bay |
| 59 | +``` |
| 60 | + |
| 61 | +Once the environment is set up, initialize the project by typing the following in the |
| 62 | +project directory: |
| 63 | + |
| 64 | +```bash |
| 65 | +pytask |
| 66 | +``` |
0 commit comments