From quant-paper-agent
Replicate a quantitative finance paper end-to-end — write plan.md (HALT for user approval), then run a vectorized pandas/numpy backtest producing signal.py/portfolio.py/backtest.py, nav.png, drawdown.png, replicated metrics.json, and a benchmark.md verdict (replicated / partially replicated / not replicated). Use when the user wants to reproduce or backtest a quant strategy (time-series momentum, cross-sectional momentum, risk parity, trend+vol, or custom) from papers/<arxiv-id>/. Default data is yfinance daily. Never tunes parameters to match the paper.
How this skill is triggered — by the user, by Claude, or both
Slash command
/quant-paper-agent:paper-replicateThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Independent replication of a quant paper in three explicit phases: **A) plan**, **B) backtest**, **C) benchmark**.
Independent replication of a quant paper in three explicit phases: A) plan, B) backtest, C) benchmark.
papers/<arxiv-id>/metrics.json and note.md exist (from paper-extract) and the user wants to reproduce the strategy end-to-end.metrics.json stub and wants to kick off replication without searching/extracting first.Requires Python ≥ 3.9 and the plugin's root requirements.txt installed (pandas, numpy, matplotlib, yfinance).
papers/<arxiv-id>/note.md and metrics.json.references/plan_template.md into papers/<arxiv-id>/plan.md and fill in:
yfinance (daily). State this explicitly even if using the default.metrics.json.core_formulas (e.g. # from Eq. 3).plan.md to the user and ask for approval before writing any backtest code. Do not proceed without an explicit "go" — the source principle is: "a plan without confirmation is just a guess".Use an existing template from templates/ if the paper clearly matches one:
templates/tsmom.py — time-series momentum (Moskowitz/Ooi/Pedersen style)templates/csmom.py — cross-sectional momentum (Jegadeesh/Titman style)templates/risk_parity.py — inverse-volatility weightingtemplates/trend_vol.py — trend filter × inverse-vol sizingWrite three small files into papers/<arxiv-id>/code/ (NOT into this skill's directory):
signal.py — pure signal generation from price frame.portfolio.py — positions / weights.backtest.py — P&L, equity curve, drawdown.Use the bundled scripts to fetch data and run the backtest:
# fetch + cache daily bars under papers/<id>/data/
python scripts/fetch_data.py <arxiv-id> --tickers "SPY,IEF,GLD,DBC" --start 2005-01-01
# run backtest (expects papers/<id>/code/{signal,portfolio,backtest}.py)
python scripts/run_backtest.py <arxiv-id>
# build nav.png + drawdown.png
python scripts/plot_nav.py <arxiv-id>
run_backtest.py imports the user-written backtest.py by path and expects it to expose a run(price_frame) -> dict returning:
{
"equity": pd.Series, # daily NAV, indexed by date
"returns": pd.Series, # daily returns used to compute stats
"weights": pd.DataFrame, # optional, for diagnostics
"trades": pd.DataFrame, # optional; written to trades.csv if present
}
It computes Sharpe (annualized from daily using √252), max drawdown, annual return (CAGR), volatility (annualized), Calmar, win rate — writes metrics.json (replicated) into papers/<id>/.
Dependencies: pandas, numpy, matplotlib, yfinance.
python scripts/compare_metrics.py <arxiv-id>
Joins papers/<id>/metrics.json from paper-extract (paper-reported) against the replicated metrics.json produced in Phase B. Produces benchmark.md with:
replicated | partially replicated | not replicated.low | medium | high.compare_metrics.py normalizes units (percent vs decimal) before comparing.
plan.md and benchmark.md.benchmark.md rather than celebrating.You can enter at any sub-phase:
plan.md already exists and user has approved — jump straight to Phase B.metrics.json (replicated) already exists from a prior run — jump to Phase C.Provides a checklist for code reviews covering functionality, security, performance, maintainability, tests, and quality. Use for pull requests, audits, team standards, and developer training.
npx claudepluginhub lucaswychan/quant-paper-agent --plugin quant-paper-agent