Backtest Vs Live Performance Divergence Tracking logo

Backtest Vs Live Performance Divergence Tracking

Community
HimanshuJ16
backtest-vs-live-performance-divergence-tracking

Use after promoting a strategy to live trading, to measure and decompose the gap between backtested and realised Sharpe, hit rate and slippage, and alert when the divergence exceeds what execution friction explains.

Overview

PublisherHimanshuJ16
RepositoryAlgo-Trading-Skills
Skill namebacktest-vs-live-performance-divergence-tracking
Stars
50
Forks
7
Bundled files
5
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 5 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by HimanshuJ16 on GitHub. Read the source before you install it.

Installation

Install the Backtest Vs Live Performance Divergence Tracking AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/HimanshuJ16/Algo-Trading-Skills/tree/main/skills/backtest-vs-live-performance-divergence-tracking
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/HimanshuJ16/Algo-Trading-Skills.git /tmp/Algo-Trading-Skills
mkdir -p .claude/skills
cp -r /tmp/Algo-Trading-Skills/skills/backtest-vs-live-performance-divergence-tracking .claude/skills/backtest-vs-live-performance-divergence-tracking
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Backtest Vs Live Performance Divergence Tracking in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Backtest Vs Live Performance Divergence Tracking on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Backtest Vs Live Performance Divergence Tracking is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

When to Use

Invoke this skill after promoting a strategy from backtesting to live trading. Every strategy experiences some divergence between its backtested equity curve and realized live performance. Small divergence ($<20%$ Sharpe decay) is expected due to execution friction. Large unexplained divergence ($>30%$ Sharpe decay, or max drawdown $2\times$ backtest worst case) signals model overfitting, regime shift, or execution infrastructure failure. This skill provides a structured framework for tracking, decomposing, and alerting on backtest-vs-live divergence.

The decomposition is the point. A strategy whose Sharpe halved because fill rate collapsed and slippage tripled has an execution problem; one whose Sharpe halved with execution metrics intact has an alpha problem. Those need different responses, and the per-metric breakdown separates them.

When NOT to Use

  • Not real-time monitoring, and not a kill switch. This compares two periodic snapshots. It cannot detect a runaway algorithm within a session. Firms subject to a real-time monitoring obligation — EU investment firms engaged in algorithmic trading fall under Article 16 of RTS 6 (Commission Delegated Regulation (EU) 2017/589) — do not discharge it with a divergence report. See mifid-ii-algo-trading-compliance-eu, sec-rule-15c3-5-risk-controls-us, and kill-switch-and-drawdown-circuit-breakers. (Sourcing note: EUR-Lex was not retrievable during review; the article number and title are corroborated from secondary reproductions of RTS 6, not read from the primary text.)
  • Not a cause attribution. It reports which metrics moved, not why. Slippage amplification and Sharpe decay moving together is consistent with an execution problem and with a volatility regime change that widened spreads and hurt the signal simultaneously.
  • Not a validated threshold set. No authoritative source prescribes backtest-vs-live divergence limits. Every default here is an implementation default. Calibrate against your own strategy population before wiring the output to a suspension workflow.
  • Not usable on a short live sample. Comparing a multi-year backtest Sharpe against two weeks of live results measures noise. Supply observation_periods and set min_live_observations so the report flags it; the flag warns in both directions, since a short sample can hide a real problem as easily as invent one.
  • Not a substitute for a paired like-for-like backtest. The backtest snapshot must cover a comparable regime and instrument universe, otherwise the divergence is an artefact of the comparison, not of the strategy.

Prerequisites

  • Backtested performance metrics: Sharpe ratio, max drawdown, win rate, avg slippage assumption.
  • Live performance metrics over equivalent observation window.
  • One drawdown sign convention across both snapshots. Either $-15.0$ or $15.0$ works; magnitudes are compared. Mixing them raises, because it means the two snapshots came from different sources.
  • Win rate and fill rate as percentages in $[0, 100]$, not fractions.
  • Optionally observation_periods on each snapshot, to enable the sample-adequacy flag.

Workflow

  1. Capture Paired Metric Snapshots:

    • Record backtest baseline metrics $M_{\text{bt}}$ and live realized metrics $M_{\text{live}}$ at equivalent time horizons.
  2. Compute Divergence Scores — five metrics on three different comparison bases. comparison_value carries the quantity actually classified and shares the scale of the thresholds; divergence_pct is for display only.

    • Sharpe Decay, relative %: $\Delta_{\text{sharpe}} = \frac{S_{\text{bt}} - S_{\text{live}}}{S_{\text{bt}}} \times 100%$
    • Win Rate Decay, relative %: same form on win rate
    • Drawdown Blow-Up, ratio: $|DD_{\text{live}}| / |DD_{\text{bt}}|$
    • Slippage Amplification, ratio: $SL_{\text{live}} / SL_{\text{bt}}$
    • Fill Rate Gap, percentage points: $\Delta_{\text{fill}} = \text{FillRate}{\text{bt}} - \text{FillRate}{\text{live}}$
  3. Handle Comparisons That Cannot Be Formed: A zero or non-positive baseline — a backtest that assumed no slippage, recorded no drawdown, or produced a non-positive Sharpe — admits no ratio or relative decay. Such a metric is escalated to WARNING with an explanatory notes string, never reported as ACCEPTABLE. An unassessed dimension is not a benign one.

  4. Classify Divergence Severity — thresholds are inclusive, and the classified value is rounded first so the number in the report can never contradict the verdict printed beside it.

    • ACCEPTABLE: All divergence metrics within tolerance thresholds.
    • WARNING: One or more metrics at or beyond the soft threshold (e.g., Sharpe decay $\ge 20%$), or any comparison that could not be formed.
    • CRITICAL: Sharpe decay $\ge 50%$, live drawdown $\ge 2\times$ backtest, win rate decay $\ge 25%$, fill rate gap $\ge 15$ points, or slippage $\ge 4\times$ backtest — triggers strategy suspension review.
    • Overall severity is the worst individual metric; driving_metrics names which ones sit at that level.
  5. Check Sample Adequacy Before Acting: If is_sample_adequate is False the verdict is noise-dominated. Investigate rather than act — the severity is deliberately not downgraded, because a short sample is not evidence of safety.

  6. Generate Divergence Report & Alerts:

    • Emit structured divergence audit report with per-metric breakdown. DivergenceSeverity is a string enum, so the report serialises directly to JSON for an alerting pipeline.

Full procedure: see references/workflows.md. Standards reference: see references/standards.md. Printable pre-flight checklist: see assets/checklist.md.

Common Pitfalls

  • Comparing Mismatched Time Windows: Comparing 3-year backtest Sharpe against 2-week live Sharpe, inflating noise-driven divergence.
  • Ignoring Survivorship Bias in Backtest: Backtest includes delisted winners; live portfolio never held them.
  • Attributing All Divergence to Execution: Assuming all Sharpe decay is slippage when it may be regime-driven alpha decay.
  • Mixed Drawdown Sign Conventions: A tracker guarding on backtest_drawdown > 0 silently skips the comparison when fed the negative convention that backtest-reporting-standardized-tearsheet emits. A live drawdown five times the backtest then reports ACCEPTABLE.
  • A Zero-Slippage Backtest: The most common backtest omission is also the one that defeats a ratio-based slippage check. Against a zero baseline there is no amplification factor to compute, and defaulting it to $1\times$ blesses unlimited live execution cost.
  • NaN Passing Every Threshold: max(0.0, nan) is 0.0 and nan >= threshold is False, so an unguarded NaN in any live metric reports no divergence and no suspension. Reject non-finite inputs at the boundary.
  • Thresholds That Invert the Ladder: A warning threshold above its critical counterpart makes mild divergence classify CRITICAL and severe divergence WARNING. Validate on construction.
  • Floating-Point Deciding a Threshold Case: A Sharpe of $2.0$ decaying to $1.6$ is exactly $20%$, but computes as $19.999999999999996$. Classifying the unrounded value while displaying the rounded one produces an audit record reading "divergence 20.0, warning threshold 20.0, severity ACCEPTABLE".
  • Reading divergence_pct Against a Threshold: For the two ratio metrics the displayed percentage and the threshold are on different scales — 80.0 versus 1.5. Compare comparison_value.

Verification

  • Submit paired metrics with 25% Sharpe decay, verify WARNING classification.
  • Submit paired metrics with 60% Sharpe decay, verify CRITICAL classification.
  • Submit the same drawdown pair under both sign conventions and assert identical verdicts; submit mixed conventions and assert it raises.
  • Submit a zero backtest slippage against 50 bps live and assert the metric is not ACCEPTABLE.
  • Submit a NaN live metric and assert it raises rather than classifying.
  • Submit exactly 20.0% Sharpe decay and assert WARNING, with divergence_pct and comparison_value both reading 20.0.
  • Run python -m unittest discover -s skills/backtest-vs-live-performance-divergence-tracking/scripts and confirm 100% pass rate.

Related Skills

  • transaction-cost-analysis-tca-integration
  • paper-to-live-promotion-checklist
  • multi-year-regime-coverage-requirement
  • backtest-reporting-standardized-tearsheet
  • kill-switch-and-drawdown-circuit-breakers
  • strategy-performance-decay-detection-vs-market-wide-decay

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Backtest Vs Live Performance Divergence Tracking AI skill do?

Use after promoting a strategy to live trading, to measure and decompose the gap between backtested and realised Sharpe, hit rate and slippage, and alert when the divergence exceeds what execution friction explains.

Why use Backtest Vs Live Performance Divergence Tracking on TypingMind?

Because you install it once and use it with any model. Backtest Vs Live Performance Divergence Tracking is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Backtest Vs Live Performance Divergence Tracking in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/HimanshuJ16/Algo-Trading-Skills/tree/main/skills/backtest-vs-live-performance-divergence-tracking. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Backtest Vs Live Performance Divergence Tracking?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Backtest Vs Live Performance Divergence Tracking?

As many as you like. As long as a model supports skills, you can use Backtest Vs Live Performance Divergence Tracking with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Backtest Vs Live Performance Divergence Tracking AI skill free?

Yes. It is published on GitHub by HimanshuJ16 under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇