Back to Blog

research

Audit A-Share Factors Before You Trust the Backtest

A practical skill for validating A-share factor research against point-in-time, costs, and multiple-testing pitfalls.

OpenAgentSkillPublished:

Where this fits

You've built a promising A-share factor, ran a backtest, and the Sharpe ratio looks great. But before you pour more compute into it, you need to know whether the evidence actually holds up under point-in-time data, transaction costs, and statistical scrutiny. This skill gives your agent a structured audit workflow so it can separate research candidates from statistical noise.

Why agents benefit

  • Enforces point-in-time discipline: The skill explicitly blocks using AKShare snapshots as historical stock pools and requires a PIT data contract with announcement dates, historical constituents, and tradability flags.
  • Runs a reproducible validation pipeline: From pre-registered factor formulas to a final report, your agent can execute factor_validation.py with cost assumptions and get IC distributions, block bootstrap intervals, and group monotonicity.
  • Handles market microstructure: It models T+1 settlement, limit-up/down, suspensions, and builds realistic cost models (commissions, stamp duty, spread, impact) so backtests don't assume impossible fills.
  • Manages multiple testing and overfitting: The skill includes BH-FDR, CSCV-PBO, and purged walk-forward checks, plus a registry to track every experiment and parameter search.
  • Outputs a clear verdict: Your agent can label a factor as invalidated, inconclusive, research candidate, out-of-sample supported, or production unverified – so downstream decisions stay honest.

Practical scenarios

Pre-trade sanity check for a new factor

Your agent receives a request to evaluate a momentum factor on CSI 300. Instead of blindly running a backtest, it first pre-registers the factor formula, holding period, and universe, then pulls PIT data via china-market-data, and runs the validation script with realistic costs. The report flags that the factor's IC drops to zero after the 2021 regime shift – saving you from a false start.

Auditing an existing research pipeline

You have a legacy backtest script that produced a 30% annualized return. Your agent uses this skill to reconstruct the historical stock pool and apply the same cost model. It finds that the original script used future data for rebalancing (lookahead bias) and the true tradable return is −2%. The skill's registry captures the failure for future reference.

Comparing multiple factor candidates

Your agent needs to shortlist factors for a quant team. It runs the full validation workflow on five candidates, records the number of tests performed, and applies BH-FDR to control the false discovery rate. Only one factor survives as out-of-sample supported; the others are marked inconclusive with clear reasons.

Add it to your agent workflow

Install the skill via:

npx skills add cyijun/china-financial-services --skill a-share-factor-validation

Then invoke the validation script on a PIT-cleaned CSV with at least date,ts_code,factor,forward_return:

python scripts/factor_validation.py input.csv --cost-bps 30 --output report.json

The script returns a JSON report with IC stats, group returns, turnover, and cost-adjusted performance. For deeper checks, use the library functions for purged walk-forward and PBO.

Compare before adopting

When evaluating this skill, compare it against alternatives on four axes:

  • Quality signals: Does it enforce PIT data and market microstructure? This skill explicitly does.
  • Maintenance freshness: Check the GitHub repo for recent commits and issue responses – the A-share market rules change frequently.
  • Alternatives: General backtesting libraries (e.g., backtrader) lack A-share-specific constraints like T+1 and stamp duty.
  • Workflow fit: The skill's registry and pre-registration steps integrate well with agent-driven research pipelines that need audit trails.

Why it is worth tracking

With 18 stars and an active author, this skill is early but addresses a real pain point: most A-share factor research ignores point-in-time or cost realism. Its emphasis on pre-registration and multiple-testing controls aligns with current best practices in quant research. Track it if you build agents that evaluate or generate alpha signals – it could become the standard audit layer for Chinese equity research. Evaluate it when you need to trust a backtest enough to allocate real capital. For a curated overview of this and similar skills, see OpenAgentSkill's listing.

Featured Skill

a-share-factor-validation

Skill by cyijun