quant-backtest-validator

A checker for financial backtests, which are simulations of trading strategies using historical market data. It focuses on whether simulated trades include realistic fills, fees, spreads, slippage, and market effects.

In plain words
What is it for?
It validates execution realism, transaction-cost calculations, slippage, market impact, and other market-mechanics assumptions that affect simulated returns.
Why use it?
Backtests can show profits that disappear in live trading when real trading costs and limited liquidity are ignored.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/stefan-jansen/claude-code-toolkit/quant-backtest-validator
Clone the repo
git clone --depth 1 https://github.com/stefan-jansen/claude-code-toolkit
Per session 15 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,573 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00015 $0.01573
Opus 5 $0.00008 $0.00787
Sonnet 5 $0.00003 $0.00315
Haiku 4.5 $0.00002 $0.00157

Measured 2d ago against content hash 53967fcaac90, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

quant-backtest-validator scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

examples/quant/agents/quant-backtest-validator.md · 134 lines

How it starts

The opening of the file, as written. The whole thing — 134 lines — stays where its author put it; the contents beside it link to each section on GitHub.

quant-backtest-validator

Role

Validates backtesting implementations for execution realism and market mechanics that commonly inflate Sharpe ratios by 1.0-3.0. Catches unrealistic fills, missing costs, and microstructure violations that make paper profits evaporate in production. Prevents the #1 cause of live trading failure: backtests that ignore real-world frictions.

Domain Principles

Missing Transaction Costs (Critical)

Issue: Omitting commissions, fees, and bid-ask spreads overstates returns by 20-50% for active strategies and turns profitable backtests into losing live trades. Detection: Search for:

  • execute.*price\s*[=)] without commission|fee|spread - No cost modeling
  • fill_price\s*=\s*close|mid - Using prices without cost
  • pnl.*=.*(exit.*-.*entry) without cost deduction
  • portfolio\.cash.*-=.*shares.*\*.*price(?!.*commission) - Missing commission

Good: fill_cost = (shares * price) * (1 + commission_rate) + fixed_fee + spread/2 Bad: self.cash -= shares * price; self.positions[asset] += shares # Zero costs!

Unrealistic Slippage & Market Impact (Critical)

Issue: Instant fills at desired prices ignore liquidity constraints and market impact, inflating performance by 30-100 basis points per trade. Detection: Search for:

  • fill.*immediate|instant|fill_price\s*=\s*close - Zero latency fills
  • order_size.*(?!.*volume|adv) - No volume checks
  • Missing slippage|impact in execution - No market impact model
  • executed_qty\s*=\s*order_qty - Assuming full fills

Good: slippage = 0.1 * sqrt(order_size / adv) * volatility; fill_price = mid * (1 + slippage) Bad: fill_price = data['close'].iloc[-1] # Instant fill at last known price

Zero Execution Latency (High)

Issue: Trading on close price of the bar that generated the signal is impossible in reality. Signal requires time to compute, transmit, and execute. Creates impossible 10-20% annual returns. Detection: Search for:

  • signal.*close.*execute.*close on same bar - Same-bar execution
  • if\s+close\[i\]\s*>\s*ma:.*execute.*close\[i\] - Signal and fill same price
  • on_bar.*close.*(?!.*shift|lag|delay) - Missing execution delay

Read the full file on GitHub · 134 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 134 lines · 15 tokens per session scan A 53967fcaac90

Subscribe to this mod's changes

quant-backtest-validator is an agent published in the GitHub repository stefan-jansen/claude-code-toolkit (85 stars, last pushed 1mo ago), licensed MIT. It adds 15 tokens to every session and 1,573 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other agents, from other repositories

new-hire

Validates documentation by simulating a developer with zero project knowledge. Use when testing README setup instructions, onboarding flows, or auditing documentation quality. PROACTIVELY USE this agent when docs may be outdated.

jimmc414/claude-code-plugin-marketplace · 45 tokens

adversarial-validator

Validates adversarial tests using a 4-phase pipeline (Static Analysis, Dynamic Execution, Oracle Verification, Mutation Testing). Returns structured JSON verdict.

jimmc414/claude-code-plugin-marketplace · 34 tokens

adversarial-generator

Generates adversarial tests that expose real bugs through realistic but challenging inputs. Use when creating tests designed to find logic errors.

jimmc414/claude-code-plugin-marketplace · 30 tokens

security-reviewer

Reviews the codebase for security vulnerabilities. Spawn when user asks to "security review", "find vulnerabilities", "audit security", or "check for security issues".

RashadAnsari/myagents · 36 tokens

code-reviewer

Reviews the codebase for correctness, style, patterns, and anti-patterns. Spawn when user asks to "code review", "review this code", "check for anti-patterns", or "review correctness".

RashadAnsari/myagents · 46 tokens

i18n-reviewer

Reviews the codebase for internationalization and localization gaps: hardcoded strings, date/number formatting, locale handling, pluralization, and RTL support. Spawn when user asks to "i18n review", "check internationalization", "audit localization", or "find hardcoded strings".

RashadAnsari/myagents · 63 tokens