Runs vectorized backtests on target weights or lots strategies, converts votes to weights (equal, risk parity, inverse variance), applies market overlays, blends return streams, and prices A-share trigger-time costs.
Ships in quantspace. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Use the uv run qs backtest commands below; research tasks do not require
reading skills/backtest/ source. Each command prints one JSON envelope on
stdout (ok, data, artifacts, warnings, or error with a hint).
Exact options: uv run qs backtest <command> --help or
uv run qs schema backtest.<command>.
uv run qs store read --symbols 510300.SH,159915.SZ,518880.SH --frequency 1d_adj \
--output out/panel.parquet
uv run qs backtest weigh --votes out/targets.parquet --panel out/panel.parquet \
--method risk_parity --lookback 60 --min-periods 20 --output out/weights.parquet
uv run qs backtest overlay --weights out/weights.parquet --panel out/panel.parquet \
--index-close out/index_close.parquet \
--index-trend '{"scale_downtrend": 0.5, "ma_period": 60}' --output out/overlaid.parquet
uv run qs backtest run --panel out/panel.parquet --weights out/overlaid.parquet \
--commission 0.0002 --slippage-bp 2 --out-dir out/run
uv run qs backtest combine --returns out/candidates.parquet --method equal \
--output out/blend.parquet
uv run qs backtest cost --time "2026-03-02 14:50" --sell-price 4.12 --buyback-price 4.05
Lots strategies (futures need the dominant table and every contract it names, from
qs ingest contracts):
uv run qs ingest contracts --underlyings RB --start 2023-01-01 --freq 1d,1m --write
uv run qs backtest run --symbols RB_DOMINANT.SHF --weights out/lots.parquet \
--unit lots --capital 1000000 --multipliers out/multipliers.json \
--commission 0.0001 --slippage-bp 1 --out-dir out/run_lots
--weights and --votes are date by symbol tables (eob index or column,
one column per symbol).--panel is a (symbol, eob) OHLCV table from qs store read; run can
read the store directly with --symbols and --frequency instead.run --out-dir holds result.parquet (per-bar returns, the input of
qs analyze perf), executed_weights.parquet, and metrics.json; with
--unit lots also executed_lots.parquet, and executed_weights is the
exposure the lots imply.--unit lots: --weights holds whole lots; --multipliers is a JSON object by
--weights symbol ({"RB_DOMINANT.SHF": 10}); continuous futures take their
actual contracts from --contracts (trading day by symbol) or the stored
dominant tables data/market/dominant/, and with --symbols those contracts'
bars load too; stocks and funds need --adjusted-frequency (such as 1d_adj).--returns for combine is an eob by strategy table of periodic returns.run requires --commission and --slippage-bp; there is no default cost.--signal-lag 1), the
safe convention for close-derived signals.--start and --end limit the result dates only; earlier bars still load.
Trim the panel with qs store read to limit history.--capital; a bar's return
is its net profit over the equity before it. A roll closes the old contract and
opens the new one at their own prices on the roll bar, both legs paying costs, so
the gap between contracts never enters equity. Stocks and funds earn the adjusted
return on the unadjusted value (dividends count) and follow T+1 on intraday bars.
Margin is not modelled. Fractions and short stocks raise instead of rounding.VectorBacktester,
weighting, filters, cost model, and exit A/B helpers. Read it when changing
this Skill or writing strategy code.Before using a command, run it with --help to see its options and defaults. uv run qs schema <skill>.<command> shows its input and output fields; add --file-field FIELD for the structure of an option that takes a JSON file.
| Command | What it does | Side effects |
|---|---|---|
uv run qs backtest run | Execute target weights through VectorBacktester with costs and metrics. | writes-output |
uv run qs backtest weigh | Convert a vote matrix into portfolio weights. | writes-output |
uv run qs backtest overlay | Scale weights with market breadth, index trend, or volatility targeting. | writes-output |
uv run qs backtest combine | Blend strategy return streams with StrategyCombiner. | writes-output |
uv run qs backtest cost | Look up the A-share trigger-time cost layer and single T PnL. | read-only |
__init__.py (opens in a new tab)cli.py (opens in a new tab)combiner.py (opens in a new tab)cost_model.py (opens in a new tab)exit_analysis.py (opens in a new tab)filters.py (opens in a new tab)overlay_metrics.py (opens in a new tab)protocols.py (opens in a new tab)quantity.py (opens in a new tab)references/python-api.md (opens in a new tab)units.py (opens in a new tab)vector.py (opens in a new tab)weighting.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
10 skills in this plugin
/analyzeMeasure returns (performance metrics, drawdowns, overfitting tests), screen factors by IC, grouped returns, horizon and lag IC surfaces, and factor correlation, run deterministic factor preflight and evaluation, and test stationarity with `uv run qs analyze ...`./computeCompute technical indicators and factor values on OHLCV panels, build log-difference features and forward-return or triple-barrier labels, resample one-minute bars to five minutes, and forward-adjust stored bars with `uv run qs compute ...`./factor-miningRun governed AI factor mining: template and validate versioned research contracts (ResearchBrief, FactorSpec, ReviewReport, PoolDecision), check generated factor functions with `uv run qs factor-mining ...`, and follow the multi-agent role protocol for generating, reviewing, and pooling factors./quantspace:backtestfrom quantspace
quantspace@quantskills is listed by quantskills/registry — review the source before installing
npx claudepluginhub quantskills/registry --plugin quantspaceOther plugins' skills for the same job