This repository contains the code used in our research paper on the influence of volatility on the predictive performance of time series forecasting models. We have implemented a variety of models including ARIMA, XGBoost, N-BEATS, and Prophet, among others, using libraries such as Darts, StatsForecast, and fbprophet.
The code includes functionalities for data preparation, model training, hyperparameter optimization, and performance evaluation. We have used Ray Tune for hyperparameter optimization and have implemented custom strategies to handle GPU memory management.
The research focuses on financial time series data, specifically cryptocurrency price data, and investigates how different periods of market factors affect the performance of forecasting models. The results of this research can provide valuable insights for financial forecasting, risk management, and trading strategy development.
Please refer to the individual scripts for more detailed information about the specific procedures and methodologies used. Contributions and suggestions for improvements are welcome.
src/config.py
. This sets up your environment for the data you're interested in.create_all_data()
in src/data/create_data.py
to fetch data directly from the Binance API. Our script enriches your dataset with essential financial metrics such as logarithmic returns and volatility measures, outputting them in neatly organized .csv files for easy use.data_analysis_tests()
from src/analysis.py
to conduct thorough testing on your time series datasets. We've incorporated checks for key properties including stationarity, autocorrelation, trends, seasonality, heteroskedasticity, and random walks to ensure comprehensive understanding of data behavior.src/hyperopt/config.py
and execute src/hyperopt/hyperopt_ray.py
to determine the optimal settings for achieving the best prediction performance.forecast_models()
in src/analysis.py
to start forecasting the future of your chosen cryptocurrencies.forecast_analysis()
is your go-to function in the same src/analysis.py
script. It will help you visualize and understand the predictive capabilities of your models.forecast_statistical_tests()
in src/analysis.py
will run diagnostic checks.market_factors_impact()
also found in src/analysis.py
, giving you insights into how different variables affect cryptocurrency prices.Our toolkit supports an extensive range of univariate forecasting models to cater to a variety of data patterns and prediction needs:
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
This project requires Python 3.9.16. You can download it here.
Additionally, you will need to install several Python packages which are listed in requirements.txt
. You can install these packages using pip by running the following command in your terminal:
pip install -r requirements.txt
Or
pip install git+https://github.com/StephanAkkerman/Crypto_Forecasting.git
[!NOTE] While using a GPU is optional, it is highly recommended for performing hyperparameter optimization and fitting and evaluating the models. You can do that by simply running the following line of code in your terminal, this will install the latest version of PyTorch with CUDA 12.1 support.
pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu121
[!WARNING] You might need to change the
batch_size
andparallel_trials
parameters to prevent GPU OOM errors. You can find these parameters in thesearch_space.py
file located in thesrc/hyperopt
directory.
Contributions are welcome! If you have a feature request, bug report, or proposal for code refactoring, please feel free to open an issue on GitHub. I appreciate your help in improving this project.
If you use this project in your research, please cite this repository and the associated master's thesis. The BibTeX entry for the thesis is:
@mastersthesis{Akkerman2023,
author = {Stephan Akkerman},
title = {Benchmarking Cryptocurrency Forecasting Models in the Context of Data Properties and Market Factors},
school = {Utrecht University},
year = {2023},
address = {Utrecht, The Netherlands},
month = {October},
note = {Available at: \url{https://github.com/StephanAkkerman/crypto-forecasting-benchmark}}
}
This project is licensed under the MIT License. See the LICENSE file for details.