Calendar Spread And Multi Leg Order Atomicityのロゴ

Calendar Spread And Multi Leg Order Atomicity

コミュニティ
HimanshuJ16
calendar-spread-and-multi-leg-order-atomicity

ネイティブなコンビネーション商品がない取引所で複数レッグの戦略を実行するときに使います。一方のレッグが約定してからもう一方が約定するまでに市場が動く場合のレッグ間リスクを管理します。ネイティブのスプレッド商品を使えば、この対応は不要です。

概要

公開者HimanshuJ16
リポジトリAlgo-Trading-Skills
スキル名calendar-spread-and-multi-leg-order-atomicity
スター
50
フォーク
7
同梱ファイル
5
ライセンスApache-2.0
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 5個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    HimanshuJ16がGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Calendar Spread And Multi Leg Order Atomicity」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/HimanshuJ16/Algo-Trading-Skills/tree/main/skills/calendar-spread-and-multi-leg-order-atomicity
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

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
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでCalendar Spread And Multi Leg Order Atomicityを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にCalendar Spread And Multi Leg Order Atomicityを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Calendar Spread And Multi Leg Order Atomicityは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

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

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Calendar Spread And Multi Leg Order Atomicity」では何ができますか?

ネイティブなコンビネーション商品がない取引所で複数レッグの戦略を実行するときに使います。一方のレッグが約定してからもう一方が約定するまでに市場が動く場合のレッグ間リスクを管理します。ネイティブのスプレッド商品を使えば、この対応は不要です。

TypingMindでCalendar Spread And Multi Leg Order Atomicityを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Calendar Spread And Multi Leg Order Atomicityはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにCalendar Spread And Multi Leg Order Atomicityをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/HimanshuJ16/Algo-Trading-Skills/tree/main/skills/calendar-spread-and-multi-leg-order-atomicityを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Calendar Spread And Multi Leg Order Atomicityを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Calendar Spread And Multi Leg Order Atomicityで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもCalendar Spread And Multi Leg Order Atomicityを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Calendar Spread And Multi Leg Order Atomicity」は無料ですか?

はい。HimanshuJ16がApache-2.0ライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇