Logotipo de Black Swan Playbook For Halted Markets

Black Swan Playbook For Halted Markets

Comunidad
HimanshuJ16
black-swan-playbook-for-halted-markets

Úsala cuando un mercado comunique una pausa LULD o un interruptor de circuito de mercado para un símbolo que tengas en cartera. Abarca el bloqueo de órdenes, la ampliación de límites de riesgo y la cobertura con instrumentos proxy, ajustada al nominal y consciente del riesgo de base; no se cubre con instrumentos proxy durante una interrupción general del mercado.

Add to TypingMind

Descripción general

EditorHimanshuJ16
RepositorioAlgo-Trading-Skills
Nombre de la habilidadblack-swan-playbook-for-halted-markets
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 Black Swan Playbook For Halted Markets 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/black-swan-playbook-for-halted-markets
  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/black-swan-playbook-for-halted-markets .claude/skills/black-swan-playbook-for-halted-markets
Reinicia Claude Code después de copiarla para que detecte la nueva habilidad.

Úsala en TypingMind

Activa Black Swan Playbook For Halted Markets 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 Black Swan Playbook For Halted Markets 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 Black Swan Playbook For Halted Markets 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 during Black Swan events, elevated market volatility, or whenever an exchange disseminates a HALTED_LULD or HALTED_CIRCUIT_BREAKER status for traded symbols. Standard "Gaussian" risk models and naïve algorithmic retries fail catastrophically during microstructure breakdowns. This skill automates the institutional response:

  1. Avoiding trapped capital by cancelling pending limit/stop orders.
  2. Expanding risk parameters for extreme volatility regimes.
  3. Deploying notional-scaled proxy hedges (filtered by basis risk) to protect delta while the primary asset is frozen — but only when a proxy is actually tradable.
  4. Intelligently liquidating or rebalancing positions during re-opening auctions at model-derived fair value.

When NOT to Use

  • During a market-wide circuit breaker, for hedging purposes. The engine still performs order lockdown and risk-limit expansion, but it deliberately emits no proxy hedge: a US MWCB halts every NMS security (including SPY/QQQ) and CME coordinates a simultaneous halt of all US-based equity index futures and options, so no proxy exists to trade. HaltedMarketReport.hedge_suppression_reason records this.
  • Outside US NMS equities, without re-deriving the mechanics. LULD and MWCB thresholds, durations and reopening procedures are US-specific; other venues (NSE/BSE, Eurex, JPX, ASX) use different price-band and auction regimes.
  • As a fill-aware position manager. The engine emits intents, not executions. Reconciling fills, partial fills and rejects is the execution layer's job.

Prerequisites

  • Real-time Exchange Feed Status Notifications (HALT, RESUME, RESUME_AUCTION, PRE_OPEN).
  • Quantified correlation map identifying liquid proxy instruments (e.g. ETFs, index futures) and their return betas (r_asset = beta * r_proxy) relative to portfolio constituents.
  • Current prices for both legs — the halted asset's last trade / pre-halt reference price and the live proxy price. Without both, hedge size cannot be made notional-correct and the engine refuses to hedge.
  • Basis risk metrics to disable hedges when proxy correlations structurally break down.
  • A Fair-Value pricing model for the halted asset to determine optimal auction participation prices.

Workflow

  1. Detect Trading Halt Event: Engine receives a Halt signal (status, halt_reason, symbol). Structurally invalid events (empty symbol, non-finite position, non-MarketStatus status) raise ValueError rather than being silently absorbed.
  2. Microstructure Lockdown: Cancel all open orders for the halted symbol to prevent adverse selection upon un-halt — resting orders survive a US halt in the book and remain eligible for the reopening auction. Orders carrying a foreign symbol are excluded from the cancel set. Expand local VaR thresholds for the fat-tail environment.
  3. Classify the halt before hedging:
    • If the halt is market-wide (HALTED_CIRCUIT_BREAKER), suppress hedging entirely and record the reason — the proxy is halted too.
    • If a hedge is already working for this symbol, do nothing further; exchanges re-disseminate halt status and a second message must not fire a second hedge.
  4. Dynamic Proxy Hedging (single-name pauses only):
    • Reject unusable inputs first — a NaN basis-risk reading must fail closed, because NaN > limit evaluates to False.
    • Check that current basis risk does not exceed the configured limit for that proxy pair.
    • Size on beta-adjusted notional, not share count: ProxyUnits = Position × Beta × (AssetPrice / ProxyPrice). A negative beta (inverse proxy) flips the hedge direction.
    • Fire a PROXY_HEDGE order offsetting the held position's beta-adjusted delta, and record the exact instrument, size and side for the unwind.
  5. Auction Resumption:
    • Upon a RESUME_AUCTION or PRE_OPEN signal, compute the asset's estimated fair value.
    • Inject an AUCTION_RESUME_ORDER (limit) at fair value. If no usable fair value is available, skip auction participation rather than send an unpriced order into a reopening cross.
    • Issue the PROXY_HEDGE_UNWIND unconditionally whenever the symbol is resuming — including on a direct transition to NORMAL — so the hedge is never orphaned by a missing fair value or a flat position.

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

Common Pitfalls

  • Proxy hedging through a market-wide circuit breaker: An MWCB halt covers all NMS securities and, by coordinated CME halt, all US-based equity index futures and options. A SELL QQQ hedge routed during a Level 1/2 halt cannot execute; if the router queues it, it fires blind into the reopen at an unknown price. Classify the halt before hedging.
  • Sizing a beta hedge in share count: Position × Beta is only correct when the asset and proxy trade at the same price. A 1,000-share position in a $450 stock hedged with a $375 ETF at beta 1.5 needs 1,800 proxy units, not 1,500 — a 17% under-hedge from omitting the price ratio.
  • Risk gates that fail open on NaN: float('nan') > basis_risk_limit is False, so a naive comparison passes a stale or corrupt basis-risk reading straight through and deploys the hedge it was meant to block. Validate for finiteness explicitly.
  • Orphaning the hedge: Nesting the unwind inside the auction-order branch means that whenever fair value is unavailable or the position is flat, the proxy hedge stays working after the halted name resumes — converting a hedge into naked directional exposure in the proxy.
  • Treating repeated halt messages as new halts: Exchange status is re-disseminated. Non-idempotent handling fires a second hedge while recording only one, so the eventual unwind is undersized and residual proxy exposure survives the event. The engine's guard is deliberately coarse — it keeps the first hedge and will not resize it if a late fill report changes the position after the hedge was placed; a desk needing that must compute and route the delta adjustment itself.
  • Unwinding on submission rather than on fill: This engine emits the auction order and the unwind together. If the auction limit order does not fill, the position is left unhedged. Production systems should trigger the unwind from the auction fill notification, not from order entry.
  • Assuming a reopening auction always follows: A Level 3 (20%) MWCB closes the market for the remainder of the day. There is no reopen to participate in, and the position carries overnight with the hedge decision already made.
  • Ignoring Basis Risk: Deploying a proxy hedge when the proxy instrument itself is decoupling from historical correlations, exacerbating losses instead of muting them.
  • Spamming Orders During Halt: Continuing to send execution API requests, leading to broker throttling, limits, or outright account suspension.
  • Static Risk Limits: Using static Value-at-Risk (VaR) or stop-loss limits during Black Swans. High volatility will instantly blow through these, triggering cascading liquidations. Dynamic, volatility-adjusted limits are required.

Verification

  • Inject a HALTED_LULD event on a 1,000-share long at 450.00 with a beta-1.5 proxy at 375.00. Verify order cancellation (with order IDs), risk limit adjustment, and a SELL 1800 QQQ proxy hedge — the notional-correct size, not 1,500.
  • Inject a high basis-risk scenario, then a NaN basis-risk scenario; confirm the proxy hedge aborts in both and hedge_suppression_reason is populated.
  • Inject a HALTED_CIRCUIT_BREAKER event; confirm lockdown occurs but no PROXY_HEDGE action is emitted.
  • Re-send the same HALTED_LULD event; confirm no second hedge order and an unchanged active_hedges entry.
  • Inject a resume event with no fair value; confirm no auction order but a full-size PROXY_HEDGE_UNWIND.
  • Run python -m unittest discover -s skills/black-swan-playbook-for-halted-markets/scripts and confirm 100% pass rate.

Related Skills

  • greeks-based-portfolio-hedging-automation
  • vendor-outage-fallback-data-source-hierarchy
  • kill-switch-and-drawdown-circuit-breakers
  • tail-risk-hedging-with-options
  • execution-algo-behavior-under-halted-instrument

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 Black Swan Playbook For Halted Markets?

Úsala cuando un mercado comunique una pausa LULD o un interruptor de circuito de mercado para un símbolo que tengas en cartera. Abarca el bloqueo de órdenes, la ampliación de límites de riesgo y la cobertura con instrumentos proxy, ajustada al nominal y consciente del riesgo de base; no se cubre con instrumentos proxy durante una interrupción general del mercado.

¿Por qué usar Black Swan Playbook For Halted Markets en TypingMind?

Porque la instalas una vez y la usas con cualquier modelo. Black Swan Playbook For Halted Markets 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 Black Swan Playbook For Halted Markets en TypingMind?

Abre Plugins → Habilidades → Instalar desde GitHub en TypingMind y pega https://github.com/HimanshuJ16/Algo-Trading-Skills/tree/main/skills/black-swan-playbook-for-halted-markets. 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 Black Swan Playbook For Halted Markets?

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 Black Swan Playbook For Halted Markets?

Con tantos como quieras. Siempre que un modelo admita habilidades, puedes usar Black Swan Playbook For Halted Markets 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 Black Swan Playbook For Halted Markets?

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 👇