Skip to content

Repository files navigation

MaGNet: A Mamba Dual-Hypergraph Network for Stock Prediction via Temporal-Causal and Global Relational Learning

The repo is the official implementation for the paper: MaGNet: A Mamba Dual-Hypergraph Network for Stock Prediction via Temporal-Causal and Global Relational Learning .

Introduction 📖

MaGNet is a Mamba dual-hypergraph network that integrates advanced temporal modeling with dual hypergraph relational learning to capture both causal and global market dependencies.

Framework Overview

MaGNet Framework


Datasets & Model Weights 📦

All datasets and model weights are available on Google Drive: 👉 Download Link

Included datasets:

  • DJIA
  • NASDAQ 100
  • CSI 300

How to Run MaGNet 🚀

1. Download this repository

Download or clone this code repository to your local machine.

2. For Training and Prediction

Download one of the datasets from the Google Drive link above:

  • DJIA: djia_alpha158_alpha360.pt
  • NASDAQ100: nas100_alpha158_alpha360.pt
  • CSI300: csi300_alpha158_alpha360.pt

Place the downloaded file in the same directory as the codebase. Run the following command to train the model and make predictions (including training, validation, and test sets):

python train.py

3. For Backtesting

Download the dataset and its corresponding model weight from the same link:

  • DJIA: djia_alpha158_alpha360.pt & djia_weight.pt
  • NASDAQ100: nas100_alpha158_alpha360.pt & nas100_weight.pt
  • CSI300: csi300_alpha158_alpha360.pt & csi300_weight.pt

Place the downloaded files in the same directory as the codebase. Run the following command to perform backtesting and results:

python backtest.py

Backtesting Results 📈

Below are the backtesting performance charts of MaGNet on all datasets:

Backtesting_result_DJIA Backtesting_result_NASDAQ100 Backtesting_result_CSI300 Backtesting_result_HSI Backtesting_result_SP100 Backtesting_result_Nikkei225

Citation

We would appreciate it if you could cite the following paper if you found the repository useful for your work:

@misc{tan2025magnetmambadualhypergraphnetwork,
      title={MaGNet: A Mamba Dual-Hypergraph Network for Stock Prediction via Temporal-Causal and Global Relational Learning}, 
      author={Peilin Tan and Chuanqi Shi and Dian Tu and Liang Xie},
      year={2025},
      eprint={2511.00085},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/2511.00085}, 
}

About

MaGNet: A Mamba Dual-Hypergraph Network for Stock Prediction via Temporal-Causal and Global Relational Learning

Resources

Stars

42 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages