This repository contains all the source code to run the experiments, generate plots, as well as the LaTeX document source for the research project. This paper has been produced as part f the BMMTBIM BIM Master Thesis course at Erasmus University Rotterdam, The Netherlands.
Author: Codrin Socol (744294cs@student.eur.nl)
Supervisor: Dr. Georgios Pierris
Co-Reader: To be determined
Master Programme: Business Information Management
University: Rotterdam School of Management, Erasmus University Rotterdam
Academic Year: 2024-2025
TODO
- Python 3.12
HFTBacktestPython library- pip - Python package manager
Required Packages can be installed using the following command:
pip install -r requirements.txtThis section provides details on how to obtain data required to run the backtesting agent and how to process it in order to be usable with the HFTBacktest library.
This project requires cryptocurrency futures data from the Deribit Exchange, which can be purchased via Tardis.dev. Tardis.dev provides a variety of datasets for sale, but this project requires only two:
- ETH-PERPETUAL trades data (trades)
- ETH-PERPETUAL orderbook data (incremental_l2)
The data should be downloaded and placed in the /data/daily-tardis directory. This directory should include 2 subdirectories:
trades: containing the trades data (onecsv.gzfile per day)incremental_l2: containing the orderbook data (onecsv.gzfile per day)
The file naming needs to adhere to the following format:
trades:deribit_trades_<date>_ETH-PERPETUAL.csv.gzincremental_l2:deribit_incremental_l2_<date>_ETH-PERPETUAL.csv.gz- the date format should be
YYYY-MM-DD(e.g.2023-01-14)
The project uses utility functions from HFTBacktest library to convert Deribit data into npz file formats used by the backtesting library. The preprocessed data is persisted to files in the /data/daily_processed directory.
Moreover, daily end-of-day snapshots are generated and saved in the /data/snapshots directory. End-of-Day snapshots are used as starting points for the backtesting experiments. The snapshots are saved in npz format.
This research project focuses on ETH-Perpetual futures, with data available from January 2025. If the datasets exist in the /data/daily-tardis directory, with the formats mentioned above, the preprocessing stage can be executed by running the following command:
python3 preprocessing.pyRunning this command will generate the following files:
/data/daily_processed/deribit_eth_perp_<date>.npz/data/snapshots/deribit_eth_perp_<date>_eod.npz- for each day in January 2025, one file will be generated
- the date format should be
YYYY-MM-DD(e.g.2025-01-14)
These files can then directly be used to create a HFTBacktest agent instance.
The HFTBacktest library supports other data source, such as by connecting to the Binance Data API. This is out of scope for this research. However, if you want to test this agent with other data inputs, please follow the Data Preparation tutorials from the HFTBacktest library.