backtest-trend-miner
Skill3 starsChanged 4 months agoMITView on GitHub
Mine the nightly backtest pipeline's runs.jsonl + 7-night Sharpe baseline to detect per-(interval, strategy, ticker) strategy decay, improvement, and stable edges. Read-only analyzer (no network, no writes) that reports the rolling Sharpe time series we already collect but never analyze.
In this repository47 other files it gives its agents.
- AGENTS.mdAGENTS.md
- beadsSkill
- backtest-engineSkill
- backtest-pipelineSkill
- bug-scanSkill
- daily-trade-pickSkill
- execution-kraken-perpsSkill
- execution-kraken-spotSkill
- l3-conviction-scanSkill
- market-accumulationSkill
- market-basisSkill
- market-breadthSkill
- market-breakoutSkill
- market-emaSkill
- market-exhaustionSkill
- market-fibonacciSkill
- market-liquidity-sweepSkill
- market-macdSkill
- market-macroSkill
- market-moversSkill
- market-notesSkill
- market-overviewSkill
- market-rsiSkill
- market-snapshotSkill
- market-squeezeSkill
- market-s-rSkill
- market-stateSkill
- market-trend-qualitySkill
- market-trendSkill
- market-valuationSkill
- market-volatilitySkill
- market-volumeSkill
- market-watchlistSkill
- portfolio-mgmtSkill
- position-watchdogSkill
- risk-engineSkill
- run-all-l2Skill
- run-all-l3Skill
- run-watchlistSkill
- strategy-accumulation-swingSkill
- strategy-breakout-confirmSkill
- strategy-exhaustion-fadeSkill
- strategy-fitness-heatmapSkill
- strategy-funding-carrySkill
- strategy-liquidity-sweepSkill
- strategy-mean-reversionSkill
- strategy-trend-followSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 21
After a nightly backtest-pipeline run, before the morning brief.
- Very specific: line 86
When runs.jsonl is missing (pipeline never ran, or wrong dir), the skill returns an AXI empty_state with a help line rather than crashing.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
backtest-trend-miner
Read-side analyzer over the nightly backtest pipeline's batch history. The pipeline writes runs.jsonl (every run's per-combo results) and backtest-pipeline-state.json (a rolling 7-night Sharpe baseline), but nothing read them until now. This skill mines both files to answer: "does a given strategy × ticker × interval combo's edge decay, improve, or hold steady across nights?"
When to use
- Diagnostics: "is strategy X's edge on a given ticker decaying across recent runs?"
- Triage: "which combos are trending down and should be watched / skipped?"
- Edge discovery: "which combos are stable and reliably positive?"
- After a nightly
backtest-pipelinerun, before the morning brief.
When NOT to use
- As a real-time or entry signal — this is a trend over historical backtest Sharpes, not a trigger.
- To run backtests — use
backtest-engine/backtest-pipelinedirectly. - To fetch market data — zero network; it only reads local files.
Quick Start
# Reads $MARKET_SKILLS_BACKTEST_PIPELINE_OUT_DIR (or falls back to ./data/backtest-nightly/)
uv run skills/backtest-trend-miner/scripts/run.py --json
# Raise the visibility floor (only combos seen in >= 7 runs)
uv run skills/backtest-trend-miner/scripts/run.py --json --min-runs 7
# Restrict to specific intervals
uv run skills/backtest-trend-miner/scripts/run.py --json --intervals 1d 4hInput
| File | Source | Shape |
runs.jsonl | backtest-pipeline run log | one JSON object per line: {ts, strategies, tickers, results: {KEY: result}, errors, insufficient_data} |
backtest-pipeline-state.json | pipeline rolling baseline | {baseline: {KEY: {history: [{ts, sharpe}], avg_sharpe_7n, n_samples}}} |
KEY is "{interval}×{strategy}×{ticker}" (the ticker is the bare watchlist key). Each result carries strategy_sharpe, trades, bars, provider, and insufficient_data. The directory is resolved from MARKET_SKILLS_BACKTEST_PIPELINE_OUT_DIR, falling back to the repo-relative data/backtest-nightly/ default.
Output (AXI envelope data payload)
combos— every distinct{strategy, ticker, interval}present across runs (the full universe).analysis.<interval>— one entry per combo that passes--min-runsand has ≥1 valid Sharpe observation. Each entry carriesinterval(alongsidestrategy/ticker), so flatflagsbucket entries are self-identifying when the same (strategy, ticker) appears under multiple intervals:sharpe_latest— most recent run'sstrategy_sharpe.avg_sharpe_7n— the pipeline's rolling 7-night average (from the state file;nullwhen absent).sharpe_series— the last ≤14{ts, sharpe}observations, ts-ordered oldest first.n_runs— how many runs this combo appears in.n_valid— how many of those runs yielded a valid Sharpe observation.trend_slope— normalized linear-regression slope (see below).downtrend—truewhentrend_slope < -0.05andsharpe_latest < avg_sharpe_7n.improving—truewhentrend_slope > 0.05andsharpe_latest > avg_sharpe_7n.volatility— population std ofsharpe_series.min_trades— min trades across runs (a combo withmin_trades < 10has a thin edge).
flags— three summary buckets:decay—downtrendcombos, sorted by slope ascending (steepest decay first).improving—improvingcombos, sorted by slope descending.stable— combos withn_valid >= 7(valid Sharpe observations, not mere appearances) andvolatility < 0.5(reliable edge).
The envelope errors list carries the flattened insufficient_data entries from the run log for context. count equals len(combos).
trend_slope definition
trend_slope is the least-squares slope of sharpe against the run ordinal, i.e. the per-run Sharpe drift (each x step = one nightly run). Because the time axis is the unit-spaced run index, the slope is measured in identical sharpe-per-night units for every combo regardless of how many runs it has — the ±0.05 thresholds mean a drift of 0.05 Sharpe per night (≈0.7 Sharpe over a 14-night window). Monotonic-up → positive, monotonic-down → negative, flat → 0.0. Fewer than two points → 0.0.
Contracts
Pure analysis lives in lib.py (analyze, split_key, trend_slope, volatility) and is unit-tested in tests/test_backtest_trend_miner.py. scripts/run.py owns file I/O, env-var resolution, the AXI envelope, and the human text view. No registry change — this is a read-side analyzer, not an L3 strategy.
Configuration
| Env var | Required | Purpose |
MARKET_SKILLS_BACKTEST_PIPELINE_OUT_DIR | No | Pipeline output dir (defaults to data/backtest-nightly/ under the repo root) |
When runs.jsonl is missing (pipeline never ran, or wrong dir), the skill returns an AXI empty_state with a help line rather than crashing.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

