This project applies the SARIMA (Seasonal ARIMA) model to forecast Bitcoin prices based on historical data. The model performs data preprocessing, stationarity checks, Box-Cox transformation, ARIMA parameter selection, and provides forecasts with confidence intervals. Visualizations of historical data and forecasted prices are also included.
To get started with the project, clone this repository to your local machine and install the necessary dependencies.
https://github.com/MohamadPirniakan/Bitcoin-_Price-_Forecasting-_with_SARIMA.git
cd bitcoin-price-forecasting-sarima
pip install -r requirements.txt
Once you've installed the dependencies, you can run the forecasting script.
python forecast_bitcoin.py
This will:
- Load and preprocess the Bitcoin data.
- Apply the SARIMA model.
- Output the forecast and visualizations.
Make sure to update the dataset path in the script if necessary.
bitcoin-price-forecasting-sarima/
│
├── data/
│ └── crypto-markets.csv # Dataset with historical cryptocurrency data
│
├── forecast_bitcoin.py # Main script to run the forecasting model
├── requirements.txt # List of dependencies
└── README.md # Project description and usage
This project uses the following Python libraries:
pandas
- for data manipulation and analysisnumpy
- for numerical computationsmatplotlib
- for data visualizationseaborn
- for statistical data visualizationstatsmodels
- for time series analysis (SARIMA model)scipy
- for statistical functionsitertools
- for iterating over parameter combinationsdatetime
- for handling date and time operations
To install the dependencies, run:
pip install -r requirements.txt
SARIMA (Seasonal ARIMA) is an extension of the ARIMA model that supports univariate time series data with a seasonal component. In this project, the SARIMA model is applied to Bitcoin price data, with the following steps:
- Data Preprocessing: The data is cleaned and resampled to a monthly frequency.
- Stationarity Check: The Dickey-Fuller test is applied to ensure the series is stationary.
- Transformation: A Box-Cox transformation is used to stabilize variance.
- Differencing: The series is differenced to achieve stationarity.
- Model Fitting: The SARIMA model is fitted using various parameter combinations.
- Forecasting: Future Bitcoin prices are predicted for the next 12 months.
The project generates the following visualizations:
- ACF and PACF Plots: To determine the optimal parameters for the SARIMA model.
- Forecast Plot: Historical Bitcoin prices and the forecasted prices for the next 12 months.
- Confidence Interval: A shaded region representing the uncertainty in the forecast.
This project is licensed under the MIT License - see the LICENSE file for details.