backtest
Skill0 starsChanged 52 days agoMITView on GitHub
Use when asked to backtest hypothetical momentum, mean-reversion, sector-rotation or custom rules against the local factor store. Verify coverage and availability, use next-close fills and explicit costs, and compare net results to buy-and-hold SPY. Report survivorship, timing and selection limits; a historical simulation cannot establish alpha or production eligibility.
- Reads credentials
6 other projects use a version of this.
Adopted by
Most recently taken up by
- cecewu3/agent-trading-skillstheir own version, first seen Nov 8, 2026
- upbit-official/upbit-strategy-toolkittheir own version, first seen Jul 13, 2026
- marketcalls/vectorbt-backtesting-skillstheir own version, first seen Jul 12, 2026
- Starchild-ai-agent/official-skillstheir own version, first seen May 21, 2026
- jackson-video-resources/skillstheir own version, first seen May 14, 2026
- Vaibhavkkm/vkkm-aegis-plugintheir own version, first seen Mar 10, 2026
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 6
- marketcalls/vectorbt-backtesting-skills★ 200same name
- Starchild-ai-agent/official-skills★ 32same name
- jackson-video-resources/skills★ 17same name
- upbit-official/upbit-strategy-toolkit★ 8same name
- Vaibhavkkm/vkkm-aegis-plugin★ 2same name
- cecewu3/agent-trading-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository18 other files it gives its agents.
The file
We split this skill into the rules it gives an agent
12 rules. 0 are common, 8 are distinctive, and 4 are very specific to this project.
0
Common
Most of the 6 edited versions we read keep these.
8
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 32
Run a rule-based strategy over historical bars from the point-in-time factor store, report standardized performance metrics, benchmark …
- Very specific: line 77
Never use an unbounded signal query.
- Distinctive: line 79
If data is missing, report coverage gaps instead of fetching.
- Very specific: line 86
Use tools/fis/tournament_runner.py simulate_target_weights for accounting.
- Very specific: line 87
If a driver is required, keep it under Efforts/osanwe-v2-overhaul/_work/backtests/.
- Distinctive: line 88
Before viewing scores, register the full candidate set, window, universe, input hashes, costs, timing, metrics and failure handling.
- Very specific: line 95
Never read .raw/, private/, finance/, credentials/, .env*, auth.json, or *.local.md.
- Distinctive: line 132
If the best sector has zero investable members that month, stay in SPY and note it.
- Distinctive: line 180
Follow with <=5 bullets of interpretation.
- Distinctive: line 185
Every report MUST carry both lines, even when clean:
- Distinctive: line 193
Keep all candidates and failures, same-window baselines and net-cost metrics.
- Distinctive: line 194
Do not invent significance or omit a losing regime.
“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Current causal simulation and comparison contract: docs/institutional-methods.md.
Frozen historical tournaments remain archival; the old full-run entry refuses
unregistered reruns. New simulations must declare decision/fill timing, costs,
universe availability, complete candidate lists and failure accounting. Only the
explicit synthetic sandbox may use the legacy firewall; locked evaluation is
available solely through the canonical gateway when a reviewed backend exists.
Plugin interoperability: .agents/skills/finance-data/SKILL.md owns typed
evidence intake and portable Finance/Data handoffs. This skill retains its
financial procedure and gates. Probe callable tools at run time; installed
plugin metadata alone does not establish a usable connector or source schema.
/backtest -- hypothetical strategy simulation against the factor store
Run a rule-based strategy over historical bars from the point-in-time factor store, report standardized performance metrics, benchmark against buy-and-hold SPY, and flag methodological bias. This is a SIMULATION tool. Past performance does not guarantee future results. Every number produced here is hypothetical.
When to use
- "Backtest momentum with a 90-day lookback" -- does top-N momentum beat SPY?
- "Test mean reversion below RSI 30" -- what is the win rate on dip buys?
- "Would rotating into the best sector have worked?" -- quarterly-style rotation.
- "Backtest custom: buy when VIX > 25 and sell after 10 up days" -- any rule the store's data can express (bars: ticker/date/close; factors: FRED series).
- Calibrating a thesis before promoting it to /invest or a live position decision.
Not for
- Live trading or order placement (read-only simulation; no broker tools allowed)
- Portfolio snapshot (use
/networth) or single-name analysis (use/invest) - Grading past /invest calls (that is
tools/backtest-v2.py, prediction calibration) - Any claim of predictive power -- output is descriptive history, never advice
Mode routing
| Request | Mode | Parameters |
| momentum | Mode 1 | lookback trading days, default 90 |
| meanreversion | Mode 2 | RSI threshold, default 30 |
| sector-rotation | Mode 3 | monthly decision schedule and dated sector map |
| custom | Mode 4 | explicit rules, sizing and exit schedule |
Phase A -- Data and preregistration
Store: Efforts/osanwe-v2-overhaul/_work/factors.db via python tools/factor-store.py.
The historical inventory recorded ~130k bar rows across ~107 tickers (daily closes, roughly 2021-08 .. 2026-08;
crypto goes back to 2015-class depth where ingested) plus factor observations
(VIXCLS, UNRATE, TREAST, WALCL, WRESBAL from FRED snapshots). SPY is present --
it is both tradable candidate and benchmark.
Refresh those coverage counts from --stats; they are not current verification. Contracts you MUST honor:
- KNOWN_AS_OF: every query passes an
as_ofdate; the store returns only rows withdate <= as_of. This date filter alone does not establish publication availability, historical revisions, or a point-in-time universe. Require those timestamps for a causal claim; absent metadata means exploratory-only results. Never use an unbounded signal query. Use tools/pit/pit_join.py for availability. - OFFLINE: no network calls during a backtest. The store is already ingested. If data is missing, report coverage gaps instead of fetching.
- PROVENANCE: keep the
srccolumn through any export; cite it in outputs.
Inspect coverage first: python tools/factor-store.py --stats.
Phase B -- Execution rules
Use tools/fis/tournament_runner.py simulate_target_weights for accounting.
If a driver is required, keep it under Efforts/osanwe-v2-overhaul/_work/backtests/.
Before viewing scores, register the full candidate set, window, universe, input
hashes, costs, timing, metrics and failure handling. Preserve every result and
failed run; corrections get a new receipt. Do not change the store or ingest.
Signals at close T fill at the next calendar close T+1, after existing holdings
are marked. Entry/rebalance/exit costs and cash must reconcile. Overlapping
cohorts share finite capital; never count the same cash twice. A terminal signal
without another price cannot fill. Missing held/fill prices cause refusal.
Never read .raw/, private/, finance/, credentials/, .env*,
auth.json, or *.local.md; nothing here needs account data.
Mode 1: momentum
/backtest momentum <lookback_days> (default 90 if omitted)
- Universe: all tickers with bars at the entry date (state the count).
- At entry: rank by trailing
<lookback_days>-day return computed ONLY from bars dated <= entry (KNOWN_AS_OF); buy top N=10, equal weight. - Hold exactly
<lookback_days>trading days, then close all and re-enter (rolling overlapping cohorts are fine; state which you used). - Report strategy equity curve vs SPY buy-and-hold over the identical window.
Mode 2: meanreversion
/backtest meanreversion <rsi_threshold> (default 30 if omitted)
- Compute RSI(14) from daily closes (Wilder smoothing); this is derived from bars, not read from the factors table.
- Entry: first day RSI drops below
<rsi_threshold>; buy one equal-sized unit. - Exit: first day RSI rises above 70, OR after 63 trading days (time stop), whichever comes first. State the time stop.
- One position per ticker at a time; cash otherwise earns nothing.
- Primary metrics are win rate and average gain per trade; still report the full metric block vs SPY.
Mode 3: sector-rotation
/backtest sector-rotation
- Map tickers to sectors using a dated classification. The current
sector:line underwiki/entities/is an exploratory fallback with lookahead disclosed. Tickers without a sector label go tounknownand are excluded; say how many. - On the first trading day of each month: compute each sector's trailing 3-month (~63 trading days) mean return from bars <= that day; hold the best sector's members equally weighted until next rebalance.
- If the best sector has zero investable members that month, stay in SPY and note it.
Mode 4: custom
/backtest custom "<plain-English rules>"
- Restate the rules as pseudocode BEFORE running; get the user's confirmation if any ambiguity could change results materially (entry timing, exits, position sizing).
- Implement only what bars/factors support. If a rule needs data the store lacks (fundamentals, intraday, options), say so and stop -- do not silently substitute a proxy without flagging it.
- Same metric block, same SPY benchmark, same bias flags.
Assumptions to state in EVERY run (verbatim section)
- Entry timing: signals computed at close T, filled at the next calendar close T+1.
- Position sizing: state target weights, cap, overlapping-cohort funding and cash.
- Costs: explicit one-way cost assumptions charged on entry, rebalance and exit; include a higher-cost sensitivity. Zero cost is a labeled idealized control. Taxes, borrow and market impact are excluded unless separately supported.
- Data: report adjusted/raw price basis, split/dividend treatment, availability and lifecycle coverage. Source labels alone do not verify adjustment semantics.
- Cash earns nothing between trades.
Phase C -- Output format (fixed block, then prose)
== BACKTEST REPORT: <mode> <params> ==
Window: <first trade date> .. <last trade date> (<n> trading days)
Universe: <n> tickers (<m> excluded: <reason>)
Trades: <count> round trips
Total return: <x>% (SPY same window: <y>%, excess: <z> pp)
Annualized: <x>% (SPY: <y>%)
Max drawdown: <x>% (SPY: <y>%)
Sharpe (rf=0): <x.x> (SPY: <x.x>)
Win rate: <x>% (<wins>/<trades>)
Avg gain/win: <x>% Avg loss: <y>% Profit factor: <z>
Assumptions: next-calendar-close fills, <sizing>, <costs and stress costs>,
<tax/borrow exclusions>, zero cash interest, <price basis> per <provenance>.
Bias flags:
- Survivorship: <see ref-backtest-methodology.md S1-S3; name which apply>
- Lookahead: <confirm as_of discipline held; name any exception>
SIMULATION ONLY -- past performance does not guarantee future results.Follow with <=5 bullets of interpretation. Never upgrade this into advice; the verdict belongs to the human.
Quality Rules
Every report MUST carry both lines, even when clean:
- Survivorship: a present-day curated watchlist is not the historical investable universe. Report selection and missing-delisting coverage; neither the size nor the direction of bias is established by a warning or a date filter.
- Lookahead: record signal cutoffs, actual availability/revision metadata, classification dates and first eligible fill. Unknown availability remains unknown. A current sector map cannot certify a historical classification.
- Keep all candidates and failures, same-window baselines and net-cost metrics. Do not invent significance or omit a losing regime. Follow the canonical promotion gateway; a completed synthetic run never authorizes promotion.
Full treatment: ref-backtest-methodology.md (same directory).
Failure modes
- Empty result set: report coverage gap from
--stats, do not fabricate. - Fewer than 60 trading days in window: refuse, window too short for annualize/ drawdown stats to mean anything.
- Script crashes mid-run: retain the failed receipt, diagnose, freeze the corrected source and rerun under a disclosed new receipt. Never hand-transcribe partial numbers as a successful run or tune the rules after viewing their scores.
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.

