Logo von Conditional Order Logic For Execution Triggers

Conditional Order Logic For Execution Triggers

Community
HimanshuJ16
conditional-order-logic-for-execution-triggers

Use when implementing client-side conditional orders such as if-touched, bracket, one-cancels-other or cross-asset triggers, evaluating a nested Boolean tree against market data and releasing each child exactly once.

Übersicht

HerausgeberHimanshuJ16
RepositoryAlgo-Trading-Skills
Skill-Nameconditional-order-logic-for-execution-triggers
Sterne
50
Forks
7
Mitgelieferte Dateien
5
LizenzApache-2.0
Links
  • Anweisungen in Markdown

    Eine SKILL.md-Datei, die das Modell bei Bedarf lädt. So werden nur dann Token verbraucht, wenn eine Anfrage tatsächlich dazu passt.

  • Funktioniert mit jedem LLM

    KI-Skills bestehen aus reinem Markdown, nicht aus anbieterspezifischem Code. Daher funktionieren sie mit GPT, Claude, Gemini, Grok oder einem lokalen Modell.

  • Mitgelieferte Dateien: 5

    Skripte, Vorlagen und Referenzmaterial, die das Modell bei der Arbeit lesen kann. Die Dateien sind schreibgeschützt und werden niemals ausgeführt.

  • Open Source

    Von HimanshuJ16 auf GitHub veröffentlicht. Prüfen Sie vor der Installation die Quelldateien.

Installation

Installieren Sie den KI-Skill Conditional Order Logic For Execution Triggers in TypingMind, um ihn mit jedem LLM zu nutzen, oder fügen Sie ihn einem anderen Agenten hinzu, der SKILL.md lesen kann.

1

In TypingMind installieren

TypingMind installiert einen Skill direkt aus seinem GitHub-Ordner. Dabei liest die App SKILL.md, bündelt die Ressourcendateien und speichert das Ergebnis lokal.

  1. Öffnen Sie die App und gehen Sie zu Plugins → Skills.
  2. Wählen Sie „Von GitHub installieren“.
  3. Fügen Sie die unten angegebene URL des Skill-Ordners ein und bestätigen Sie.
    https://github.com/HimanshuJ16/Algo-Trading-Skills/tree/main/skills/conditional-order-logic-for-execution-triggers
  4. Aktivieren Sie den Skill in jedem Chat, in dem er verfügbar sein soll.
Plugins → Skills → Skill hinzufügen → Über GitHub-URL. Fügen Sie dann die Ordner-URL ein und klicken Sie auf „Weiter“.
2

In einem anderen Agenten installieren

Jeder Agent, der das Agent-Skills-Format unterstützt, kann diesen Skill nutzen. Kopieren Sie den Ordner in das Skill-Verzeichnis des jeweiligen Agenten.

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/conditional-order-logic-for-execution-triggers .claude/skills/conditional-order-logic-for-execution-triggers
Starten Sie Claude Code nach dem Kopieren neu, damit der neue Skill erkannt wird.

In TypingMind verwenden

Aktivieren Sie Conditional Order Logic For Execution Triggers in einem beliebigen Chat in TypingMind. Den Rest übernimmt das Modell. Name und Beschreibung des Skills stehen im System-Prompt. Sobald eine Anfrage passt, lädt das Modell selbstständig die vollständigen Anweisungen — Sie müssen den Skill nie manuell aufrufen, und er verbraucht erst Token, wenn er tatsächlich genutzt wird.

Das Modell lädt Conditional Order Logic For Execution Triggers automatisch, sobald eine passende Anfrage gestellt wird.

Funktioniert mit jedem KI-Modell

KI-Skills bestehen aus reinen Markdown-Anweisungen statt aus anbieterspezifischem Code. Daher ist Conditional Order Logic For Execution Triggers nicht an das Modell gebunden, für das der Skill geschrieben wurde. Installieren Sie ihn einmal in TypingMind und nutzen Sie ihn mit GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder einem selbst betriebenen lokalen Modell — alles mit Ihren eigenen API-Schlüsseln.

  • Wird nur bei Bedarf geladen

    Der System-Prompt enthält nur den Namen und die Beschreibung. Die Anweisungen werden bei der ersten passenden Anfrage geladen. Ein ungenutzter Skill verursacht daher keine Kosten.

  • Modell im laufenden Chat wechseln

    Da der Skill aus Anweisungen statt aus Code besteht, funktioniert er auch nach einem Modellwechsel — das nächste Modell liest dieselbe SKILL.md-Datei.

Skill-Anweisungen

Dies ist der Inhalt von SKILL.md, den das Modell lädt. Lesen Sie ihn vor der Installation — ein Skill besteht aus Anweisungen, denen Ihr Modell folgt.

When to Use

Use this skill when implementing client-side conditional order logic (If-Touched, bracket, One-Cancels-the-Other, or cross-asset triggers) in an OMS/EMS. Conditional orders remain dormant in local memory until incoming market data evaluates a nested Boolean condition tree to TRUE, upon which child orders are released for pre-trade risk checking and venue routing.

Client-side simulation is the right answer when the trigger the strategy needs does not exist at the venue or the broker: a condition spanning two instruments, a condition mixing price with volume and wall-clock time, or a trigger on an exchange that does not accept the order type at all. NYSE and NYSE MKT stopped accepting stop orders and GTC orders on 26 February 2016 and cancelled the resting ones, so equity stop logic on those books lives in a broker's or a client's simulator, not on the exchange.

When NOT to Use

  • A native or broker-resident conditional order does the same job. IBKR's conditional orders support price, time, margin, execution, volume and percent-change conditions combined with AND/OR, and IBKR states that active orders remain active after exiting Trader Workstation — you can be filled without being logged in. CME Globex triggers stop orders natively against the last trade price. A broker- or exchange-resident trigger survives your process crashing, your feed dropping and your host rebooting. This engine survives none of those: if the process is down when the market touches the level, nothing fires and nothing tells you so. Prefer native; simulate only what native cannot express.
  • Latency-sensitive triggering against fast markets. A client-side trigger fires one network round trip after the price prints, then the child order still has to travel to the venue. For stop logic on a fast-moving book, an exchange-resident stop (with protection points, where the venue offers them) fills closer to the level.
  • As a risk control. A kill switch or exposure limit must not depend on a condition tree that goes quiet when the data feed dies. Keep circuit breakers in a path that fails closed — see execution-algorithm-kill-switch-integration.
  • On an instrument that may be halted or in an auction. A dormant trigger evaluating a stale pre-open or halted book will fire on the first print of a re-opening auction. Gate the tree with an explicit session/state condition; see execution-algo-behavior-under-halted-instrument.

Prerequisites

  • Streaming market data for the target instrument and every referenced benchmark, each quote carrying a timestamp (epoch seconds, UTC) if staleness enforcement is wanted.
  • A decision on the trigger price type per condition — last trade, bid, ask, or mid. FIX TriggerPriceType(1107) enumerates exactly this choice (Best Offer, Last Trade, Best Bid, Best Bid or Last Trade, Best Offer or Last Trade, Best Mid), and it changes when the trigger fires.
  • A unique client order identifier and a fully specified child order (symbol, side, quantity, order_type, price for limits).
  • A downstream pre-trade risk check: a fired trigger emits an intent, not an authorised order.

Workflow

  1. Condition Tree Construction: Build atomic nodes — PriceCondition, VolumeCondition, TimeCondition, CrossAssetCondition — and compose them with AndCondition / OrCondition / NotCondition. Choose the price field deliberately (last vs bid vs ask): a >= trigger read off the bid and one read off the last trade fire at different moments on the same tape. Empty composites are rejected at construction, because an empty AND gate is vacuously true and would fire on the first tick.
  2. Staleness Policy: Pass max_quote_age_seconds to any condition whose input can go stale — always to cross-asset legs, whose benchmark feed can disconnect while the primary keeps ticking. With it set, a quote whose timestamp is missing or older than the limit evaluates to UNKNOWN, not to a value.
  3. Conditional Order Registration: Wrap the tree and a validated ChildOrderPayload in a ConditionalOrderTrigger, then ConditionalOrderEngine.register(trigger, oco_group=...). Triggers sharing an oco_group are one-cancels-the-other; a bracket registers its target and its stop in one group so both legs cannot reach the venue.
  4. Tick Processing: Call engine.process_tick(market_state, now=...) on each update. The engine pins one evaluation clock for the whole tick, so a time condition cannot read a different instant than its siblings in the same tree.
  5. Trigger Firing and Dispatch: The engine returns the child orders released by this tick. Firing is a single atomic DORMANT → TRIGGERED transition under a lock — evaluation and state change happen together, so two feed-handler threads delivering the same tick cannot both release the order. On fire, dormant OCO siblings are cancelled.
  6. Undecided is not false: The tree evaluates in three-valued (Kleene) logic. A missing or stale input yields UNKNOWN; only a definite TRUE fires. Route UNKNOWN to monitoring — a trigger that has been undecided for minutes means a feed is down, and it will not fire when the level trades.

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

Common Pitfalls

  • Firing duplicate orders: Checking status == DORMANT and setting TRIGGERED as two separate steps. Two threads can interleave between the check and the set and both release the child order. Evaluate and transition under one lock.
  • Treating missing data as False: Under two-valued logic a missing quote reads as FALSE, so NotCondition(missing) reads as TRUE and releases a live order on data you never received. Negation is where a fail-safe FALSE stops being safe.
  • A dropped benchmark silently rewriting the trigger: AAPL >= 150 AND SPY >= 500 with the SPY feed dead is not "wait"; under two-valued logic it is a permanent FALSE that never fires, and if the composition is OR it becomes a bare AAPL >= 150 outright trigger. Set max_quote_age_seconds on cross-asset legs and alert on UNKNOWN.
  • Exact float equality as a trigger: last == 150.00 against a decimal price feed effectively never matches. Use a band with an explicit tolerance, or an ordering operator.
  • Silently ignoring an unknown operator: Returning False for a typo'd '=>' produces a trigger that can never fire and reports no error — discovered when the order never arrives. Validate operators at construction.
  • Naive datetimes in time conditions: A trigger meant for 15:50 New York fires at 15:50 in whatever zone the host happens to be in. Require timezone-aware targets.
  • Confusing the trigger price type: Simulated triggers only fire on the field you feed them. IBKR's trigger methods exist for the same reason (double bid/ask, last, double last, bid/ask, last-or-bid/ask, mid-point) and apply only to simulated orders — a natively handled stop ignores them entirely.
  • Blocking the hot path: Heavy parsing, disk I/O or network calls inside the market-data callback that evaluates the tree. Keep evaluation to arithmetic on already-parsed values.
  • Treating a fired trigger as a fill: The trigger produces an order intent. It still has to pass pre-trade risk, reach the venue, and be accepted — and it can be rejected.

Verification

  • Build (AAPL.last >= 150.00) AND (SPY.last >= 500.00) on a ConditionalOrderEngine. Feed AAPL 150.50 / SPY 499.00: the trigger must stay DORMANT and process_tick must return []. Feed SPY 500.50: it must transition to TRIGGERED and return exactly one child order payload; a third tick must return nothing.
  • Register a bracket as one oco_group and drive the take-profit level: the stop-loss leg must be CANCELLED and must stay silent when its own level trades afterwards.
  • Drive one satisfying tick from 16 threads concurrently and assert exactly one payload is released.
  • Feed a cross-asset tree with the benchmark quote removed and confirm evaluate_tristate returns None (UNKNOWN), not False, and that NotCondition over it does not fire.
  • Set max_quote_age_seconds=5.0 and feed a quote timestamped 30 seconds ago: no fire, and a stale-quote warning logged.
  • Run python -m unittest discover -s skills/conditional-order-logic-for-execution-triggers/scripts and confirm a 100% pass rate.

Related Skills

  • broker-order-type-capability-matrix
  • execution-algorithm-kill-switch-integration
  • execution-algo-behavior-under-halted-instrument
  • order-placement-idempotency
  • close-auction-participation-strategy

Mitgelieferte Dateien

Das Modell liest diese Dateien bei Bedarf, während der Skill geladen ist. Sie werden als lesbare Dateien bereitgestellt und niemals ausgeführt.

Häufig gestellte Fragen

Was macht der KI-Skill Conditional Order Logic For Execution Triggers?

Use when implementing client-side conditional orders such as if-touched, bracket, one-cancels-other or cross-asset triggers, evaluating a nested Boolean tree against market data and releasing each child exactly once.

Warum Conditional Order Logic For Execution Triggers in TypingMind nutzen?

Weil Sie den Skill einmal installieren und mit jedem Modell verwenden können. Conditional Order Logic For Execution Triggers besteht aus reinem Markdown statt aus anbieterspezifischem Code. So funktioniert derselbe Skill mit GPT-5, Claude, Gemini, Grok oder einem lokalen Modell – und Sie können das Modell mitten im Chat wechseln, ohne dass der Skill seine Funktion verliert. TypingMind verwendet Ihre eigenen API-Schlüssel. Sie bezahlen die Anbieter daher direkt statt über ein Abonnement pro Nutzerplatz, und Ihre Skills und Chats bleiben in Ihrem eigenen Speicher.

Wie installiere ich Conditional Order Logic For Execution Triggers in TypingMind?

Öffnen Sie in TypingMind Plugins → Skills → Von GitHub installieren und fügen Sie https://github.com/HimanshuJ16/Algo-Trading-Skills/tree/main/skills/conditional-order-logic-for-execution-triggers ein. TypingMind liest die Datei SKILL.md, bündelt die zugehörigen Dateien und installiert alles als Skill, den Sie für jeden Chat einzeln aktivieren können.

Welche KI-Modelle können Conditional Order Logic For Execution Triggers nutzen?

Jedes Modell, das Sie mit TypingMind verbinden. KI-Skills bestehen aus reinen Markdown-Anweisungen statt aus anbieterspezifischem Code. Daher können GPT, Claude, Gemini, Grok und lokale Modelle diesen Skill laden, wenn eine Anfrage dazu passt.

Wie viele KI-Modelle kann ich mit Conditional Order Logic For Execution Triggers verwenden?

So viele Sie möchten. In TypingMind können Sie Conditional Order Logic For Execution Triggers mit jedem Modell verwenden, das Skills unterstützt, etwa mit GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama. Dabei nutzen Sie Ihre eigenen API-Schlüssel.

Ist der KI-Skill Conditional Order Logic For Execution Triggers kostenlos?

Ja. Der Skill wird von HimanshuJ16 auf GitHub unter der Lizenz Apache-2.0 veröffentlicht. Sie bezahlen nur Ihren eigenen KI-Anbieter für die verwendeten Token.

Was sind KI-Skills?

Ein KI-Skill ist ein wiederverwendbares Anweisungspaket, das einem KI-Modell vermittelt, wie es eine bestimmte Aufgabe erledigt. Es folgt dem offenen Format Agent Skills: Die Datei SKILL.md enthält den Namen und die Beschreibung des Skills. Hinzu kommen bei Bedarf Skripte, Vorlagen oder Referenzdateien für das Modell. Das Modell liest die Anweisungen nur, wenn Ihre Anfrage zum Skill passt. Ein installierter Skill verursacht daher erst Kosten, wenn er verwendet wird.

Wie unterscheiden sich KI-Skills von Plugins oder MCP-Servern?

Ein Plugin oder MCP-Server stellt einem Modell neue aufrufbare Tools bereit – Code, der auf einem System ausgeführt wird und ein Ergebnis zurückgibt. Ein KI-Skill vermittelt dem Modell stattdessen Wissen und Vorgehensweisen: wie es eine Aufgabe angeht, welche Schritte es befolgt und wie eine gute Ausgabe aussieht. Skills bestehen aus reinem Markdown und kommen daher ohne Server, API-Schlüssel und Laufzeitumgebung aus. Sie funktionieren mit jedem Modell.

Alle anzeigen

Jetzt eigenen KI-Arbeitsbereich einrichten

Abonnieren Sie unseren Newsletter und erfahren Sie mehr über neue Funktionen und kommende Gewinnspiele 👇