Logotipo de Calendar Spread And Multi Leg Order Atomicity

Calendar Spread And Multi Leg Order Atomicity

Comunidad
HimanshuJ16
calendar-spread-and-multi-leg-order-atomicity

Úsalo para ejecutar una estrategia de varias patas en un mercado sin instrumento combinado nativo y gestionar el riesgo de ejecución por patas cuando una se ejecuta y el mercado se mueve antes de que se ejecute la otra. Un instrumento de spread nativo evita esta necesidad.

Descripción general

EditorHimanshuJ16
RepositorioAlgo-Trading-Skills
Nombre de la habilidadcalendar-spread-and-multi-leg-order-atomicity
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 Calendar Spread And Multi Leg Order Atomicity 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/calendar-spread-and-multi-leg-order-atomicity
  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/calendar-spread-and-multi-leg-order-atomicity .claude/skills/calendar-spread-and-multi-leg-order-atomicity
Reinicia Claude Code después de copiarla para que detecte la nueva habilidad.

Úsala en TypingMind

Activa Calendar Spread And Multi Leg Order Atomicity 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 Calendar Spread And Multi Leg Order Atomicity 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 Calendar Spread And Multi Leg Order Atomicity 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 when executing multi-leg derivatives strategies (e.g., selling near-month, buying far-month options) across exchanges that lack native "combo" or "spread" order types. Executing these legs independently exposes the portfolio to Legging Risk—where one leg is filled but the market moves away before the second leg fills, leaving the portfolio with unintended directional Delta risk.

When NOT to Use

  • A native combination instrument exists. CME Globex lists calendar spreads as tradable instruments in their own right and its implied-order engine matches spread and outright books together "without the risk to the trader/broker of being double filled or filled on one leg and not on the other leg." Eurex, Deribit and most listed-derivatives venues offer equivalent combo/strategy books. Native combos give exchange-guaranteed atomicity; this skill only approximates it. Always check for a native instrument first — see assets/checklist.md.
  • The legs are not simultaneously tradable (different sessions, one leg halted, one leg pre-open). Algorithmic legging cannot mitigate a leg that has no market at all; see execution-algo-behavior-under-halted-instrument.
  • You have no reliable order-terminal-state feed. This engine's legging-risk detection depends on being told when the hedge order finished, not merely when it filled. Without that event, a zero-fill hedge is indistinguishable from a hedge still working.

Prerequisites

  • Two or more correlated instruments forming a spread strategy.
  • A live connection to a broker API that provides order-status callbacks for both fills and terminal order states (cancelled / expired / rejected).
  • A predefined maximum allowable "slippage" tolerance for the net spread price.

Workflow

  1. Spread Definition: Define the target net spread price and the limit prices for individual legs. Validate leg ratios and prices up front — a zero or negative ratio is a sizing bug that would otherwise surface as a division error mid-execution.
  2. Anchor Leg Execution: The engine places a limit order for the most illiquid leg first (the "anchor" leg). Starting an already-started engine is refused, because a re-entry would duplicate a live order on the venue.
  3. Triggered Execution: Upon a partial or full fill of the anchor leg, the engine immediately fires an IOC (Immediate or Cancel) order for the hedging leg, sized to that specific fill so the leg ratio is preserved tranche by tranche. The IOC is priced at the far edge of the configured slippage tolerance, so the tolerance is expressed once in the limit price rather than by chasing the market with repeated re-prices.
  4. Legging Risk Assessment: Evaluate the hedge only when the hedge order reaches a terminal state, never on a fill report alone. An IOC may emit several execution reports before its remainder is cancelled, so an early shortfall is not yet a break; conversely a hedge that fills nothing emits no fill report at all, and a fill-driven check would stay silent on the worst possible outcome — a fully naked anchor position.
  5. Break Handling: If the terminated hedge leaves an unhedged quantity, transition to BROKEN, raise a critical alert for the firm's emergency hedge protocol, and cancel the resting anchor order so naked exposure stops growing. If no cancel path is wired up, the engine escalates that fact explicitly rather than failing quietly.

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

Common Pitfalls

  • Market Order Hedging: Using Market Orders to complete the second leg guarantees execution but opens the strategy to catastrophic slippage during flash crashes.
  • Executing the Liquid Leg First: Filling the highly liquid leg first, then finding out the illiquid leg has no bids. Always execute the illiquid leg first.
  • Ignoring Partial Fills: Failing to proportionately size the second leg based on the partial fill quantity of the first leg.
  • Treating a partial hedge fill as a broken spread: An IOC that trades against three resting orders produces three execution reports. Declaring BROKEN on the first one both fires a false emergency and — because BROKEN is terminal — permanently ignores the fills that complete the hedge moments later.
  • Detecting legging risk from fill events only: The dangerous case is the hedge that fills zero. It sends no fill callback, so a fill-driven state machine leaves the position naked and the state machine reporting "hedging" forever. Subscribe to terminal order states.
  • Leaving the anchor order resting after a break: A passive anchor limit order keeps working after the hedge fails. Every subsequent fill adds unhedged exposure to a position you have already declared broken.
  • Float equality on quantities: 0.1 + 0.2 < 0.3 in binary floating point. Comparing accumulated fractional fill quantities exactly will manufacture phantom broken spreads on crypto and other fractional-size venues; compare with a tolerance.

Verification

  • Simulate an illiquid anchor leg filling 50%, followed by the hedging leg filling 50%. Ensure the remaining 50% anchor leg is managed correctly.
  • Simulate a hedge IOC that reports two partial fills totalling the full quantity, and one that reports no fills at all. The first must complete; the second must break and cancel the anchor.
  • Compare realized_net_spread() (anchor VWAP minus hedge VWAP) against the target net spread to confirm the executed spread landed inside tolerance.
  • Run python -m unittest discover -s skills/calendar-spread-and-multi-leg-order-atomicity/scripts and confirm 100% pass rate.

Related Skills

  • execution-algo-behavior-under-halted-instrument
  • smart-order-routing-across-venues
  • multi-leg-strategy-margin-optimization
  • order-placement-idempotency

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 Calendar Spread And Multi Leg Order Atomicity?

Úsalo para ejecutar una estrategia de varias patas en un mercado sin instrumento combinado nativo y gestionar el riesgo de ejecución por patas cuando una se ejecuta y el mercado se mueve antes de que se ejecute la otra. Un instrumento de spread nativo evita esta necesidad.

¿Por qué usar Calendar Spread And Multi Leg Order Atomicity en TypingMind?

Porque la instalas una vez y la usas con cualquier modelo. Calendar Spread And Multi Leg Order Atomicity 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 Calendar Spread And Multi Leg Order Atomicity en TypingMind?

Abre Plugins → Habilidades → Instalar desde GitHub en TypingMind y pega https://github.com/HimanshuJ16/Algo-Trading-Skills/tree/main/skills/calendar-spread-and-multi-leg-order-atomicity. 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 Calendar Spread And Multi Leg Order Atomicity?

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 Calendar Spread And Multi Leg Order Atomicity?

Con tantos como quieras. Siempre que un modelo admita habilidades, puedes usar Calendar Spread And Multi Leg Order Atomicity 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 Calendar Spread And Multi Leg Order Atomicity?

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 👇