Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
This code accompanies the the paper Trading with the Momentum Transformer: An Intelligent and Interpretable Architecture (https://arxiv.org/pdf/2112.08534.pdf).
| Date | Stars |
|---|---|
| 2026-07-24 | 632 |
| 2026-07-25 | 632 |
| 2026-07-28 | 632 |
| 2026-07-30 | 632 |
| 2026-08-06 | 632 |
Today
— stars today
This week
— stars this week
This month
— stars this month
Momentum
0.0
growth rate 0.00%/day
# Trading with the Momentum Transformer > [!IMPORTANT] > ## Latest Work > [**DeePM: Regime-Robust Deep Learning for Systematic Macro Portfolio Management**](https://github.com/kieranjwood/deepm) extends the Momentum Transformer to end-to-end portfolio construction, re-implemented in PyTorch. Key contributions: > > 1. **Graph neural networks** encoding macroeconomic priors across assets > 2. **Multi-asset cross-sectional attention** with a causal lag (Directed Delay) mechanism > 3. **Portfolio-level loss** — optimises on a pooled portfolio Sharpe ratio rather than univariate per-asset objectives > 4. **Regime-robust minimax optimisation** — a SoftMin proxy for Entropic Value-at-Risk (EVaR) that penalises the worst historical subperiods > 5. **Realistic transaction costs in the loss** — asset-specific costs baked directly into the training objective > 6. **Two-pass exact gradient accumulation** — correct gradients for the coupled Sharpe-ratio objective at scale > > In backtests from 2010--2025, DeePM roughly doubles the net risk-adjusted returns of classical trend-following and improves upon the Momentum Transformer by approximately fifty percent. See the [paper](https://arxiv.org/abs/2601.05975) and [GitHub](https://github.com/kieranjwood/deepm) for full details. ## About This code accompanies the paper [Trading with the Momentum Transformer: An Intelligent and Interpretable Architecture](https://arxiv.org/pdf/2112.08534.pdf) and additionally provides an implementation for the paper [Slow Momentum with Fast Reversion: A Trading Strategy Using Deep Learning and Changepoint Detection](https://arxiv.org/pdf/2105.13727.pdf). ## Using the code 1. Create a Nasdaq Data Link account to access the [free Quandl dataset](https://data.nasdaq.com/data/CHRIS-wiki-continuous-futures/documentation). This dataset provides continuous contracts for 600+ futures, built on top of raw data from CME, ICE, LIFFE etc. 2. Download the Quandl data with: `python -m data.download_quandl_data <<API_KEY>>` 3. Create Momentum Transformer input features with: `python -m examples.create_features_quandl`. In this example we use the 100 futures tickers which have i) the longest history ii) more than 90% of trading days have data iii) data up until at least Dec 2021. 4. Optionally, run the changepoint detection module: `python -m examples.concurent_cpd_quandl <<CPD_WINDOW_LENGTH>>`, for example `python -m examples.concurent_cpd_quandl 21` and `python -m examples.concurent_cpd_quandl 126` 5. Create Momentum Transformer input features, including CPD module features with: `python -m examples.create_features_quandl 21` after the changepoint detection module has completed. 6. To create a features file with multiple changepoint detection lookback windows: `python -m examples.create_features_quandl 126 21` after the 126 day LBW changepoint detection module has completed and a features file for the 21 day LBW exists. 7. Run one of the Momentum Transformer or Slow Momentum with Fast Reversion experiments with `python -m examples.run_dmn_experiment <<EXPERIMENT_NAME>>` ## Trading with the Momentum Transformer: An Intelligent and Interpretable Architecture > Deep learning architectures, specifically Deep Momentum Networks (DMNs) , have been found to be an effective approach to momentum and mean-reversion trading. However, some of the key challenges in recent years involve learning long-term dependencies, degradation of performance when considering returns net of transaction costs and adapting to new market regimes, notably during the SARS-CoV-2 crisis. Attention mechanisms, or Transformer-based architectures, are a solution to such challenges because they allow the network to focus on significant time steps in the past and longer-term patterns. We introduce the Momentum Transformer, an attention-based architecture which outperforms the benchmarks, and is inherently interpretable, providing us with greater insights into our deep learning tradi
Excerpt of 8,258 characters
Read on GitHub17
Would you bet a product on this? Bounded 0–100 and slow moving.
matched fp:99685d28816c231f, topic:deep-learning
matched fp:99685d28816c231f, topic:transformer
matched fp:99685d28816c231f, topic:quantitative-finance