market-state-cross-sectional-momentum
https://github.com/arnaurodondev/market-state-cross-sectional-momentum
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.3%) to scientific vocabulary
Repository
Basic Info
- Host: GitHub
- Owner: arnaurodondev
- License: apache-2.0
- Language: Jupyter Notebook
- Default Branch: main
- Size: 91.2 MB
Statistics
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.MD
Market‑State Cross‑Sectional Momentum
A Python research code base accompanying the paper
Winners & Losers in Motion – A Market‑State Momentum Signal that Reverses Roles for Robust Returns (1940‑2024) Arnau Rodon Comas (Universitat Pompeu Fabra & University of Essex) – under review
1. What’s inside?
This public repository contains everything needed to reproduce the empirical results in the paper and to experiment with your own market‑state momentum variations:
| Folder / file | Purpose |
| -------------------------------------------- | ----------------------------------------------------------------------------------------------- |
| momentum_functions.py | Core library: data cleaning, portfolio formation, market‑state logic, risk metrics |
| strategy_analysis.ipynb | End‑to‑end Jupyter notebook that replicates all tables & figures in the manuscript |
| Datasets/ | Pre‑processed monthly & daily CRSP extracts (1940‑2024) plus historical transaction‑cost curves |
| results/ | CSVs and PNGs generated by the notebook (ready for LaTeX import) |
| requirements.txt | Exact Python package versions (tested on Python 3.11) |
| Winners & Losers in Motion (1940‑2024).pdf | The current conference draft of the paper |
The code is pure Python / Pandas and needs no compiled extensions, so it runs on Mac, Linux, or Windows.
2. Quick start
```bash
1. clone the repo
$ git clone https://github.com/arnaurodondev/market-state-cross-sectional-momentum.git $ cd market-state-cross-sectional-momentum
2. set up a virtual environment (recommended)
$ python -m venv .venv $ source .venv/bin/activate # Windows: .venv\Scripts\activate
3. install Python dependencies
$ pip install -r requirements.txt
4. open the research notebook
$ jupyter lab strategy_analysis.ipynb ```
The notebook walks you through ⟶ data import → signal construction → back‑test → risk analysis → visualisation. Every intermediate data frame is cached, so reruns are snappy.
Need fresh CRSP data? Replace the CSVs in
Datasets/with your own extracts; the loader automatically detects file names and formats.
3. Reproducing the paper
Running the notebook end‑to‑end will regenerate:
- 48 parameter‑grid back‑tests (formation/holding‑period × state window) with and without estimated trading costs
- 36 parameter‑grid back‑tests exploring liquidity and market‑capitalisation cut‑offs
- Decile‑allocation sensitivity tests (number of deciles)
- Transaction‑cost sensitivity surfaces
- 20‑year rolling return, Sharpe ratio, and draw‑down plots
- LaTeX‑ready tables of mean returns, HAC t‑statistics, and Bonferroni thresholds
All figures in the PDF were produced on an MSI Vector 16HX A13V (Intel i9‑13980HX, 64 GB RAM) and the full pipeline completed in ≈2 hours; on a modest cloud VM you can expect a similar wall‑clock time thanks to multi‑core parallelisation..
4. How the signal works – in one paragraph
Classic cross‑sectional momentum buys recent winners and shorts losers, but is haunted by crashes when the market regime flips. This project implements the paper’s simple fix: detect the market state with a trailing market‑index window (default 24 m) and switch – run momentum in UP states, reversal in DOWN states. The result: Sharpe ≈ 0.45 after full historical trading costs vs 0.05 for naïve momentum, and max draw‑downs chopped from 60 % to ~25 %. See §V‑VII of the paper for full statistics. fileciteturn0file0
5. Citation
If you use this code or build upon the signal, please cite the underlying research:
text
Rodon Comas, Arnau. "Winners & Losers in Motion: A Market‑State Momentum Signal that Reverses Roles for Robust Returns, 1940‑2024" (2025). Working paper.
A BibTeX entry is provided in citation.bib.
6. License & disclaimer
Code is released under the Apache 2.0 license – free for academic and commercial use with attribution. All opinions expressed are the author’s and not investment advice. The empirical study relies on historical CRSP data accessed via WRDS; to replicate the analysis you will need a valid institutional CRSP licence and WRDS credentials. Redistribution of raw CRSP data is prohibited under the vendor’s terms.
Author
Arnau Rodon Comas • rodonarnau@gmail.com
Made with ❤️ and lots of HAC standard errors.
Owner
- Login: arnaurodondev
- Kind: user
- Repositories: 1
- Profile: https://github.com/arnaurodondev
Citation (citation.bib)
@unpublished{RodonComas2025,
author = {Arnau Rodon Comas},
title = {Winners & Losers in Motion: A Market-State Momentum Signal that Reverses Roles for Robust Returns, 1940--2024},
note = {Working paper},
year = {2025},
}
GitHub Events
Total
- Push event: 4
- Public event: 1
- Pull request event: 1
Last Year
- Push event: 4
- Public event: 1
- Pull request event: 1