Logotipo de Backtest Vs Live Performance Divergence Tracking

Backtest Vs Live Performance Divergence Tracking

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

Úsalo tras pasar una estrategia a trading en vivo para medir y desglosar la diferencia entre el Sharpe, la tasa de aciertos y el deslizamiento del backtest y los valores reales, y recibir una alerta cuando la divergencia supere lo que pueden explicar las fricciones de ejecución.

Add to TypingMind

Descripción general

EditorHimanshuJ16
RepositorioAlgo-Trading-Skills
Nombre de la habilidadbacktest-vs-live-performance-divergence-tracking
Estrellas
50
Forks
7
Archivos incluidos
5
LicenciaApache-2.0
Enlaces
  • Instrucciones en Markdown

    Un archivo SKILL.md que el modelo carga cuando lo necesita, de modo que solo consume tokens cuando la petición encaja con la habilidad.

  • Funciona con cualquier LLM

    Las habilidades de IA están en Markdown, no en código específico de un proveedor, por lo que funcionan con GPT, Claude, Gemini, Grok o un modelo local.

  • Archivos incluidos: 5

    Scripts, plantillas y referencias que el modelo puede leer mientras trabaja. Los archivos son de solo lectura y nunca se ejecutan.

  • Código abierto

    Publicada por HimanshuJ16 en GitHub. Revisa el contenido original antes de instalarla.

Instalación

Instala la habilidad de IA Backtest Vs Live Performance Divergence Tracking en TypingMind para usarla con cualquier LLM, o añádela a otro agente que lea SKILL.md.

1

Instalar en TypingMind

TypingMind instala una habilidad directamente desde su carpeta de GitHub: lee SKILL.md, empaqueta los archivos de recursos y guarda el resultado localmente.

  1. Abre la aplicación y ve a Plugins → Habilidades.
  2. Elige «Instalar desde GitHub».
  3. Pega la URL de la carpeta de la habilidad que se muestra a continuación y confirma.
    https://github.com/HimanshuJ16/Algo-Trading-Skills/tree/main/skills/backtest-vs-live-performance-divergence-tracking
  4. Activa la habilidad en cada chat en el que quieras tenerla disponible.
Plugins → Habilidades → Añadir habilidad → URL de GitHub; después, pega la URL de la carpeta y pulsa Continuar.
2

Instalar en otro agente

Cualquier agente que lea el formato Agent Skills puede usar esta habilidad: copia la carpeta en el directorio de habilidades de ese agente.

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
Reinicia Claude Code después de copiarla para que detecte la nueva habilidad.

Úsala en TypingMind

Activa Backtest Vs Live Performance Divergence Tracking en cualquier chat de TypingMind y el modelo se encargará del resto. Su nombre y descripción se incluyen en el prompt del sistema y, en cuanto una petición encaja con la habilidad, el modelo carga las instrucciones completas por sí solo. No tienes que invocarla manualmente y no consume tokens hasta que se utiliza.

El modelo carga Backtest Vs Live Performance Divergence Tracking automáticamente en cuanto una petición es relevante para esa habilidad.

Funciona con cualquier modelo de IA

Las habilidades de IA son instrucciones en Markdown, no código específico de un proveedor, por lo que Backtest Vs Live Performance Divergence Tracking no está vinculada al modelo para el que se creó. Instálala una sola vez en TypingMind y úsala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modelo local que ejecutes tú, todo con tus propias claves API.

  • Se carga solo cuando se necesita

    El prompt del sistema solo incluye el nombre y la descripción. Las instrucciones se cargan con la primera petición que encaja con la habilidad, por lo que una habilidad que no se usa no supone ningún coste.

  • Cambia de modelo durante el chat

    Como la habilidad contiene instrucciones y no código, cambiar de modelo no impide que funcione: el nuevo modelo lee el mismo archivo SKILL.md.

Instrucciones de la habilidad

Este es el contenido de SKILL.md que carga el modelo. Léelo antes de instalar la habilidad: contiene instrucciones que tu modelo seguirá.

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

Archivos incluidos

El modelo los lee según los necesita mientras la habilidad está cargada. Son archivos de solo lectura y nunca se ejecutan.

Preguntas frecuentes

¿Qué hace la habilidad de IA Backtest Vs Live Performance Divergence Tracking?

Úsalo tras pasar una estrategia a trading en vivo para medir y desglosar la diferencia entre el Sharpe, la tasa de aciertos y el deslizamiento del backtest y los valores reales, y recibir una alerta cuando la divergencia supere lo que pueden explicar las fricciones de ejecución.

¿Por qué usar Backtest Vs Live Performance Divergence Tracking en TypingMind?

Porque la instalas una vez y la usas con cualquier modelo. Backtest Vs Live Performance Divergence Tracking está escrita en Markdown, no en código específico de un proveedor, por lo que la misma habilidad funciona con GPT-5, Claude, Gemini, Grok o un modelo local, y puedes cambiar de modelo en mitad del chat sin que deje de funcionar. TypingMind utiliza tus propias claves API, de modo que pagas directamente a los proveedores en lugar de pagar una suscripción por puesto, y tus habilidades y chats permanecen en tu propio almacenamiento.

¿Cómo instalo Backtest Vs Live Performance Divergence Tracking en TypingMind?

Abre Plugins → Habilidades → Instalar desde GitHub en TypingMind y pega https://github.com/HimanshuJ16/Algo-Trading-Skills/tree/main/skills/backtest-vs-live-performance-divergence-tracking. TypingMind lee el archivo SKILL.md de esa carpeta, empaqueta los archivos de la carpeta e instala el conjunto como una habilidad que puedes activar en cada chat.

¿Qué modelos de IA pueden usar Backtest Vs Live Performance Divergence Tracking?

Cualquier modelo que conectes en TypingMind. Las habilidades de IA son instrucciones en Markdown, no código específico de un proveedor, por lo que GPT, Claude, Gemini, Grok y los modelos locales pueden cargar esta habilidad cuando una solicitud se corresponda con ella.

¿Con cuántos modelos de IA puedo usar Backtest Vs Live Performance Divergence Tracking?

Con tantos como quieras. Siempre que un modelo admita habilidades, puedes usar Backtest Vs Live Performance Divergence Tracking con él: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama y muchos más, todos en TypingMind con tus propias claves API.

¿Es gratuita la habilidad de IA Backtest Vs Live Performance Divergence Tracking?

Sí. HimanshuJ16 la ha publicado en GitHub bajo la licencia Apache-2.0. Solo pagas a tu proveedor de IA por los tokens que utilizas.

¿Qué son las habilidades de IA?

Una habilidad de IA es un conjunto de instrucciones reutilizables que enseña a un modelo de IA a realizar una tarea concreta. Sigue el formato abierto Agent Skills: un archivo SKILL.md con un nombre y una descripción, además de los scripts, plantillas o archivos de referencia que pueda necesitar el modelo. El modelo solo lee las instrucciones cuando tu solicitud se corresponde con la habilidad, por lo que una habilidad instalada no supone ningún coste hasta que se utiliza.

¿En qué se diferencian las habilidades de IA de los plugins o los servidores MCP?

Un plugin o un servidor MCP proporciona al modelo nuevas herramientas que puede invocar: código que se ejecuta en algún lugar y devuelve un resultado. En cambio, una habilidad de IA aporta conocimientos y procedimientos al modelo: cómo abordar una tarea, qué pasos seguir y qué se considera un buen resultado. Las habilidades son instrucciones en Markdown, por lo que no necesitan servidor, clave API ni entorno de ejecución, y funcionan con cualquier modelo.

Ver el directorio

Crea ya tu propio espacio de trabajo con IA

Suscríbete a nuestro boletín para recibir avisos sobre nuevas funciones y próximos sorteos 👇