CryptoMamba: Leveraging State Space Models for Accurate Bitcoin Price Prediction

Mohammad Shahab Sepehri, Asal Mehradfar, Mahdi Soltanolkotabi, Salman Avestimehr

Abstract

Predicting the price of Bitcoin remains a significant challenge in financial forecasting due to its extreme volatility and non-linear market dynamics. This paper introduces CryptoMamba, a novel architecture that applies Mamba-based State Space Models (SSMs) to cryptocurrency time-series data. By utilizing a selectivity mechanism that allows for linear scaling and effective long-range dependency modeling, CryptoMamba overcomes the computational bottlenecks of Transformers and the memory limitations of LSTMs. Our results demonstrate that CryptoMamba-v (incorporating trading volume) achieves state-of-the-art performance with an RMSE of 1598.1 and a MAPE of 2.034%. Furthermore, when integrated into a risk-aware trading strategy, the model yielded a 162% return over a one-year test period, significantly outperforming traditional deep learning baselines in both profitability and risk mitigation.

1. Introduction

Bitcoin price prediction is often considered a "grand challenge" in the intersection of finance and machine learning. Unlike traditional equities, cryptocurrencies are characterized by frequent regime shifts—abrupt changes in market behavior driven by sentiment, regulatory news, and liquidity shifts.

Existing modeling approaches frequently encounter specific hurdles:

  • Statistical Models (ARIMA, GARCH): These models generally assume linearity and struggle to capture the complex, stochastic nature of crypto markets.
  • Recurrent Neural Networks (LSTMs/GRUs): While designed for sequences, they often fail to maintain long-range dependencies and suffer from slow training speeds on long datasets.
  • Transformers: Although powerful, their quadratic computational complexity ($O(N^2)$) makes them resource-intensive, and they are prone to overfitting on the relatively sparse datasets typical of daily financial intervals.

To address these issues, we propose CryptoMamba, a context-aware model designed to adapt its parameters dynamically based on input signals, providing a more robust framework for volatile asset forecasting.

2. Methodology

2.1 The CryptoMamba Architecture

The core of our approach is the adaptation of the Mamba architecture for financial time series. Mamba is a type of State Space Model (SSM) that introduces a "selectivity mechanism." Unlike standard SSMs, which are linear time-invariant systems, Mamba makes the underlying transition matrices ($B, C,$ and $\Delta$) functions of the input. This allows the model to selectively propagate or forget information, a critical feature for Bitcoin where historical patterns may lose relevance during sudden market shifts.

CryptoMamba is structured using stacked computational units called C-Blocks. Each C-Block contains:

  1. CMBlocks: A combination of a normalization layer and a Mamba block for feature extraction.
  2. Multi-Layer Perceptron (MLP): To provide non-linear transformations and refine the extracted features.

This hierarchical structure allows the model to capture both high-frequency "noise" and low-frequency "trends" simultaneously.

2.2 Trading Strategies

To evaluate the practical utility of the model, we developed three distinct trading algorithms:

  • Vanilla: A basic threshold-based strategy for buying and selling.
  • Smart: A risk-aware strategy that uses prediction uncertainty to scale trade sizes, reducing exposure during high-volatility periods.
  • Extended Smart: An advanced version that includes short-selling capabilities, allowing the model to generate returns during bearish market phases.

3. Experimental Setup

3.1 Dataset

We utilized historical daily Bitcoin (BTC-USD) data sourced from Yahoo Finance, covering the period from September 17, 2018, to September 17, 2024. The features included Open, High, Low, Close, and Volume (OHLCV). The data was partitioned as follows:

  • Training: 2018–2022
  • Validation: 2022–2023
  • Testing: 2023–2024 (unseen market conditions)

3.2 Baselines

CryptoMamba was compared against several industry-standard models, including Bi-LSTM, GRU, iTransformer, and S-Mamba.

4. Results and Analysis

4.1 Predictive Accuracy

CryptoMamba-v (the variant including trading volume) consistently outperformed all baselines. It achieved the lowest error metrics on the test set, with an RMSE of 1598.1 and a MAPE of 2.034%. The inclusion of trading volume proved vital, as volume serves as a proxy for market sentiment and liquidity, providing the model with a secondary signal to confirm price trends.

4.2 Computational Efficiency

One of the most striking findings was the model's efficiency. CryptoMamba achieved state-of-the-art results with only 136k parameters, compared to the 569k parameters required by the Bi-LSTM baseline. This compact footprint not only reduces the risk of overfitting but also enables rapid real-time inference, averaging 1.17ms per sample.

4.3 Financial Performance

In a simulated environment starting with a $100 investment:

  • The Extended Smart strategy powered by CryptoMamba-v reached a final balance of $262.78 over the one-year test period.
  • In contrast, most baseline models, such as the LSTM, struggled to remain profitable or incurred losses when attempting the same short-selling strategy.
  • Risk Management: CryptoMamba-v maintained a Maximum Drawdown (MDD) of only 11.09%, demonstrating superior capital protection during market downturns compared to its competitors.

5. Conclusion

CryptoMamba represents a significant step forward in applying State Space Models to financial technology. By leveraging the selectivity mechanism of Mamba, the model effectively navigates the volatility of the Bitcoin market with high precision and low computational overhead. Future research will focus on expanding this architecture to multi-asset portfolios and integrating external macro-economic indicators and social media sentiment to further enhance predictive power.

Summary updated

BibTeX
@inproceedings{sepehri2025cryptomamba,
  author = {Mohammad Shahab Sepehri and Asal Mehradfar and Mahdi Soltanolkotabi and Salman Avestimehr},
  title = {{CryptoMamba: Leveraging State Space Models for Accurate Bitcoin Price Prediction}},
  booktitle = {ICBC},
  year = {2025},
  url = {https://openreview.net/forum?id=DqNMUiAo6j},
}
Figure