This repository contains all the essential components for backtesting a bullet strategy bond portfolio. The bullet strategy involves buying bonds that all mature at the same time, targeting a specific segment of the yield curve. This strategy is useful for investors who have a specific time horizon in mind and want to mitigate the interest rate risk to some extent.
-
python_files/
: This directory contains Python scripts that are crucial for running the backtest. The main file,backtest_code.py
, includes code for generating synthetic interest rate data, initializing the bond portfolio, and performing the backtest. -
csv_files/
: Data files in CSV format are stored here. The fileinterest_rate_data.csv
contains the synthetic interest rate data, andportfolio_data.csv
contains detailed information about the portfolio over time. -
plots/
: Graphical representations of the portfolio performance are stored in this directory. The fileportfolio_performance.png
shows how the portfolio value changes over time along with fluctuating interest rates.
- Python 3.x
- NumPy
- pandas
- Matplotlib
-
Environment Setup: Make sure you have Python 3.x installed along with the required packages: NumPy, pandas, and Matplotlib.
-
Clone the Repository: Clone this repository to your local machine.
-
Run the Python Script: Navigate to the
python_files/
directory and runbacktest_code.py
. This will execute the backtest based on the synthetic interest rate data. -
Analyze the Results: Once the backtest is complete, you can analyze the portfolio's performance using the generated CSV files and plots.
Feel free to fork this repository and make your own modifications. Pull requests for improvements or bug fixes are welcome.
For any questions or clarifications, please open an issue in this repository.