Skip to content

Latest commit

 

History

History
133 lines (97 loc) · 4.91 KB

README.md

File metadata and controls

133 lines (97 loc) · 4.91 KB

🚀 CryptoMamba: Leveraging State Space Models for Accurate Bitcoin Price Prediction

License

CryptoMamba is a novel Mamba-based architecture designed for accurate and efficient time-series forecasting, with a focus on cryptocurrency price prediction. Leveraging the capabilities of SSMs, CryptoMamba excels at capturing long-range dependencies and adapting to highly volatile market conditions.

Repository Includes:

  • Implementation of CryptoMamba and baseline models (LSTM, Bi-LSTM, GRU, and S-Mamba).
  • Two Trading Algorithms: Vanilla and Smart, for evaluating real-world performance.
  • Code for data preprocessing, model training, evaluation metrics, and trading simulations.

CryptoMamba’s robust performance and generalizability make it a promising solution for various sequential forecasting tasks, including financial markets, commodities, and other time-series applications.

📖 Table of Contents

🔧 Requirements

To install the requirements you can use:

pip install -r requirements.txt

If you have difficulties installing `mamba_ssm`, please follow the instructions in its GitHub repository.

💡 Usage

Data

You can find the processed data that we use in here. If you want to use another data configuration, you should change the configuration in the data config file. Note that the data_path should point to the raw data file with similar format to this.

Train New Model

To train a model, use the following:

python3 scripts/training.py --config CONFIG_NAME

Here, `CONFIG_NAME` is the name of a config file in the training config folder without its extension. For example, to train CryptoMamba with volume you can run the following command:

python3 scripts/training.py --config cmamba_v

Evaluate Model

To evaluate a model, run the this command:

python scripts/evaluation.py --config CONFIG_NAME --ckpt_path PATH_TO_CHECKPOINT

To run the trading simulation, you can use the following command:

python scripts/simulate_trade.py --config CONFIG_NAME --ckpt_path PATH_TO_CHECKPOINT --split SPLIT_NAME --trade_mode TRADE_ALGORITHM

Where SPLIT_NAME is train, val, or test and TRADE_ALGORITHM is smart or vanilla.

Predict Next Day Price

We also have a script to predict the next day price and trade suggestions by providing the prices of its previous days. You have to create a `csv` file similar to [this](data/one_day_trade.csv) and use this command:

python scripts/one_day_pred.py --config CONFIG_NAME --ckpt_path PATH_TO_CHECKPOINT --date DATE

If you don't provide a value for DATE, the code automatically predicts one day after the last day that is in the file.

📈 Results

Model RMSE MAPE MAE Parameters
LSTM 2672.7 3.609 2094.3 204K
Bi-LSTM 2325.6 3.072 1778.8 569k
GRU 1892.4 2.385 1371.2 153k
S-Mamba 1717.4 2.248 1239.9 330k
CryptoMamba 1713.0 2.171 1200.9 136k
LSTM-v 2202.1 2.896 1668.9 204K
Bi-LSTM-v 2080.2 2.738 1562.5 569k
GRU-v 1978.0 2.526 1454.3 153k
S-Mamba-v 1651.6 2.215 1209.7 330k
CryptoMamba-v 1598.1 2.034 1120.7 136k

🎯 Citation

If you use CryptoMamba in a research paper, please cite our paper:

@article{Sepehri2025CryptoMamba,
      title={CryptoMamba: Leveraging State Space Models for Accurate Bitcoin Price Prediction}, 
      author={Mohammad Shahab Sepehri and Asal Mehradfar and Mahdi Soltanolkotabi and Salman Avestimehr},
      year={2025},
      url={https://arxiv.org/abs/2501.01010}
}

❓ Where to Ask for Help

If you have any questions, feel free to open a Discussion and ask your question. You can also email [email protected] (Mohammad Shahab Sepehri) or [email protected] (Asal Mehradfar).