quantskills/agent-quantspace/strategy

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Use when tasks need reusable strategy contracts, cross-sectional selection types, or time-series signal-to-weight helpers.

Install

npx vskill@latest install quantskills/agent-quantspace/strategy

SKILL.md

Strategy

skills/strategy owns reusable strategy types that convert features, scores, labels, or signals into date × symbol target weights. Concrete public strategy behavior remains under strategies/.

Public API

python
from skills.strategy import StrategyContext, StrategyResult, WeightGenerator
from skills.strategy.cross_sectional import (
DynamicFactorWeightConfig,
ModularBacktester,
apply_rebalance_schedule,
combine_factor_scores,
estimate_factor_weights,
hold_weights_on_calendar,
normalize_factor_frames,
rank_factor_frames,
top_n_weights,
)
from skills.strategy.time_series import signal_to_single_asset_weights

Boundaries

  • contracts.py defines the strategy-neutral target-weight result and generator protocol.
  • ports.py defines only the MarketDataReader protocol needed by current workflows.
  • cross_sectional/ owns reusable ranking, selection, exit, risk-control, and

modular research types, including equal-rank, equal-vote, rolling IC, rolling ICIR, and correlation-aware maximum-IC / maximum-ICIR factor combinations.

  • hold_weights_on_calendar maps signal-day target weights onto the full trading

calendar (forward hold, flat before the first signal) before backtesting.

  • time_series.py owns signal-to-weight conversion and a research-only

TimeSeriesBacktester adapter that delegates execution to VectorBacktester.

  • Concrete factors, features, rules, model pipelines, and workflows belong in

strategies/.

  • Formal public execution always passes target weights to

skills.backtest.VectorBacktester.

TimeSeriesBacktester keeps exploratory prediction-frame analysis available, but does not implement a second return or metric engine. Published public strategy results should still use explicit target weights plus VectorBacktester.

Multi-factor combination recipe

python
from skills.strategy.cross_sectional import (
DynamicFactorWeightConfig,
combine_factor_scores,
)
config = DynamicFactorWeightConfig(
availability_delay=signal_lag + horizon,
lookback=252,
min_periods=126,
max_weight=0.5,
correlation_shrinkage=0.5,
)
result = combine_factor_scores(
raw_factors,
method="max_icir",
directions=factor_directions,
normalization="rank",
top_n=3,
ic_history=ic_history,
correlation_history=rolling_rank_correlations,
dynamic_config=config,
)

Supported methods are equal rank, equal vote, rolling IC, rolling ICIR, correlation-aware maximum IC, and correlation-aware maximum ICIR. max_ic applies the inverse rolling factor-correlation matrix to rolling mean IC; max_icir applies it to rolling ICIR. Both require tidy correlation history with columns eob, factor_a, factor_b, and correlation. result.factor_weights is the factor-level voice in the composite score; result.target_weights is the separate asset allocation produced after Top-N selection. The public combination entry point always applies factor direction and daily cross-sectional normalization. Use normalization="rank" for robust percentile ranks or normalization="zscore" to retain relative score distance; do not pre-normalize inputs.

Time-series recipe

python
from skills.backtest import VectorBacktester
from skills.strategy.time_series import signal_to_single_asset_weights
weights = signal_to_single_asset_weights(signal, symbol="SHSE.510300")
result = VectorBacktester(
panel,
signal_lag=1,
commission=0.0002,
slippage_bp=2.0,
).run(weights)

CLI command reference

<!-- BEGIN GENERATED: qs commands -->

Transport: --input-json FILE|-, --preview N, and --log-level LEVEL; flags override JSON. Use --print-template [FIELD] for fillable templates.

Shared parameter groups
PanelSource
OptionType / defaultDescription
--panelpath? / nullParquet/CSV panel, mutually exclusive with symbols or symbols-file.
--symbolslist[string] / factoryQuantSpace symbols such as SHSE.510300; repeat flag or comma-separate.
--symbols-filepath? / nullText lines or JSON list of QuantSpace symbols.
--frequencystring / 1dMarket store directory under data/market, for example 1d or 1d_adj.
--data-rootpath? / nullManaged data root; otherwise QUANTSPACE_DATA_ROOT or repository data/.
--startstring? / nullInclusive start date: YYYY-MM-DD or YYYYMMDD.
--endstring? / nullInclusive end date: YYYY-MM-DD or YYYYMMDD.
--fieldslist[string] / factoryOptional panel field subset.
OutputOptions
OptionType / defaultDescription
--outputpath? / nullExplicit output path outside managed store namespaces.
--overwriteboolean / falseAllow replacing an existing output artifact.
--data-rootpath? / nullManaged data root; otherwise QUANTSPACE_DATA_ROOT or repository data/.
uv run qs strategy top-n

Equal-weight the top N scores on each date.

Priority: P1. Side effects: writes-output.

Shared parameters: OutputOptions.

OptionType / defaultDescription
--outputpath / requiredDestination target-weight table.
--scorespath / requiredDate by symbol score table; higher is better.
--top-ninteger / requiredNames held per date.
--gross-exposurenumber / 1.0Total weight per date.

Output data fields: rows, columns, start, end, preview.

Inspect schemas: uv run qs schema strategy.top-n (add --part input|output or --file-field FIELD).

uv run qs strategy signal-weights

Turn a single-asset signal into target weights.

Priority: P1. Side effects: writes-output.

Shared parameters: OutputOptions.

OptionType / defaultDescription
--outputpath / requiredDestination one-column target-weight table.
--signalpath / requiredSignal table with an eob index or column.
--columnstring / signalSignal column; values are clipped to [-1, 1].
--symbolstring / requiredQuantSpace symbol that receives the weights.
--exposurenumber / 1.0Weight multiplier.

Output data fields: rows, columns, start, end, preview.

Inspect schemas: uv run qs schema strategy.signal-weights (add --part input|output or --file-field FIELD).

uv run qs strategy hold-calendar

Forward-hold signal-day weights across a panel's trading calendar.

Priority: P1. Side effects: writes-output.

Shared parameters: PanelSource, OutputOptions.

OptionType / defaultDescription
--outputpath / requiredDestination daily target-weight table.
--weightspath / requiredSignal-day target weights (date by symbol).

Output data fields: rows, columns, start, end, preview.

Inspect schemas: uv run qs schema strategy.hold-calendar (add --part input|output or --file-field FIELD).

uv run qs strategy combine

Combine raw factors into composite scores and Top-N weights.

Priority: P1. Side effects: writes-output.

Shared parameters: OutputOptions.

OptionType / defaultDescription
--factorsobject / requiredRaw factor tables by name, each date by symbol, e.g. mom=mom.parquet.
--directionsobject / requiredDirection for every factor: 1 if larger is better, -1 otherwise.
--method`equal_rank\equal_vote\rolling_ic\rolling_icir\max_ic\max_icir / required`Combination method.
--normalization`rank\zscore / rank`Daily cross-sectional normalization.
--top-ninteger / 3Assets selected from the composite score.
--ic-historypath? / nullIC of direction-oriented factors (pass --directions to analyze ic-surface); required by rolling and max methods. Either a date by factor table, or the tidy daily_ic table written by analyze ic-surface (factor, horizon, lag, eob, ic), which also needs --ic-horizon.
--ic-horizoninteger? / nullHorizon of the tidy daily_ic rows to use; required for a tidy --ic-history and rejected for a wide one.
--ic-laginteger / 0Lag of the tidy daily_ic rows to use (tidy input only).
--correlation-historypath? / nullTidy table with eob, factor_a, factor_b, correlation, computed on direction-oriented ranked factors (analyze factor-correlation --directions writes it); required by max methods.
--availability-delayinteger? / nullBars before an IC becomes known (signal_lag + horizon); required by rolling and max methods.
--lookbackinteger / 252Rolling IC window.
--min-periodsinteger / 126Minimum IC observations.
--max-weightnumber / 0.5Cap on one factor's weight.
--correlation-shrinkagenumber / 0.5Shrink factor correlations toward identity.
--out-dirpath / requiredDirectory for factor_weights, composite_scores and target_weights Parquet files.

Output data fields: method, factors, rows, start, end, latest_factor_weights.

Inspect schemas: uv run qs schema strategy.combine (add --part input|output or --file-field FIELD).

uv run qs strategy cs-run

Run a factor-voting Top-pct cross-sectional strategy with ModularBacktester.

Priority: P1. Side effects: writes-output.

Shared parameters: PanelSource.

OptionType / defaultDescription
--startstring? / nullFirst result date (start_date); earlier bars still load. Pass a trimmed --panel from qs store read to limit history.
--endstring? / nullLast result date (end_date); later bars still load. Pass a trimmed --panel from qs store read to limit history.
--factorslist[FactorItem] / requiredEntry factors voted into the Top-pct selection.
--exit-filterslist[ExitFilterItem] / factoryExit filters applied to selected weights.
--top-pctnumber / 0.2Fraction of names selected.
--trade-at`open\close / close`Execution price field.
--signal-laginteger / 1Bars between signal and execution.
--commissionnumber / 0.0002One-way commission rate.
--slippage-bpnumber / requiredOne-way slippage in basis points.
--rebalance-freqstring / 1D, W, M, or a positive number of bars between rebalances.
--weight-method`equal\risk_parity\inverse_variance\epo / equal`WEIGHT_METHODS key for selected names.
--vol-targetnumber? / nullOptional volatility target.
--exposure-policy`keep_cash\renormalize\allocate_defensive / keep_cash`What happens to weight removed by exit filters.
--defensive-symbolslist[string] / factorySymbols for the allocate_defensive policy.
--out-dirpath? / nullOptional directory for signal_weights, executed_weights, result Parquet files and metrics.json.
--overwriteboolean / falseAllow replacement of existing output files.

Output data fields: metrics, weight_stats, rows, start, end.

Inspect schemas: uv run qs schema strategy.cs-run (add --part input|output or --file-field FIELD).

<!-- END GENERATED: qs commands -->

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
57
Repository forks
11
7-day trend score
20

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/quantskills/agent-quantspace/strategy/badge)](https://verified-skill.com/skills/quantskills/agent-quantspace/strategy)

Something wrong with this skill or its page? Tell us.