Canada Iiroc Electronic Trading Rules logo

Canada Iiroc Electronic Trading Rules

Community
HimanshuJ16
canada-iiroc-electronic-trading-rules

Use when routing orders to Canadian marketplaces such as TSX, TSX Venture, Cboe Canada or an ATS, where NI 23-103 section 3 and UMIR Rule 7.1 require automated pre-trade controls and UMIR 6.2 order designations on every order.

Overview

PublisherHimanshuJ16
RepositoryAlgo-Trading-Skills
Skill namecanada-iiroc-electronic-trading-rules
Stars
50
Forks
7
Bundled files
5
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 5 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by HimanshuJ16 on GitHub. Read the source before you install it.

Installation

Install the Canada Iiroc Electronic Trading Rules AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/HimanshuJ16/Algo-Trading-Skills/tree/main/skills/canada-iiroc-electronic-trading-rules
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

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/canada-iiroc-electronic-trading-rules .claude/skills/canada-iiroc-electronic-trading-rules
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Canada Iiroc Electronic Trading Rules in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Canada Iiroc Electronic Trading Rules on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Canada Iiroc Electronic Trading Rules is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

When to Use

Use this skill when deploying algorithms that route orders to Canadian marketplaces (TSX, TSX Venture, Cboe Canada — formerly NEO — CSE, and the ATSs). Under National Instrument 23-103 s.3 and UMIR Rule 7.1, a marketplace participant must run automated pre-trade controls over every order before it reaches a marketplace: credit and capital thresholds, price and size parameters, limits on the value of unexecuted orders, and the regulatory designations that UMIR 6.2 requires on entry.

When NOT to Use

  • Non-Canadian venues. These controls are jurisdiction-specific. US market access is governed by SEC Rule 15c3-5 (sec-rule-15c3-5-risk-controls-us) and the EU by MiFID II RTS 6 (mifid-ii-algo-trading-compliance-eu). The short-marking exempt designation has no US or EU analogue — do not port it.
  • As the firm's only short-sale control. The engine checks designation, not the pre-borrow arrangements UMIR requires for certain short sales, and not failed-trade reporting.
  • As a substitute for marketplace-level controls. CIRO's marketplace threshold regime (single-stock circuit breakers, price freezes) runs at the venue. It does not discharge the participant's own obligation under NI 23-103 s.3(5) to set and control its own filters.

Prerequisites

  • Trading system that produces normalized order objects with side, quantity, limit price (or None for a market order), and the account's owned position in the security.
  • A live reference price (last traded price) per symbol. The engine fails closed when the reference price is missing, zero or non-finite — plan for stale-feed handling rather than being surprised by rejections.
  • Firm-determined threshold values. Neither NI 23-103 nor UMIR prescribes any numeric limit; the participant sets, documents and periodically reassesses each one (NI 23-103 s.3(5), s.3(6)).
  • A flag identifying accounts that qualify for the "short-marking exempt" designation.

Workflow

  1. Rule Initialization: Instantiate CiroPreTradeRiskEngine with a RiskLimits object. Set max_open_order_notional_cad if you want this engine to enforce the unexecuted-order-value control; leaving it None disables it and the obligation falls elsewhere in your stack.
  2. Order Interception: Call validate_order(order) synchronously before the order reaches the FIX gateway, and inspect is_compliant. If your routing path has no rejection branch, call enforce_order(order) instead — it raises RegulatoryViolationError so a forgotten return-value check cannot leak an order to the venue.
  3. Input Sanity, Fail Closed: Non-positive quantity, non-finite or negative price, and an unusable reference price are rejected up front (INVALID_ORDER_PARAMETERS, REFERENCE_PRICE_UNAVAILABLE). This is deliberate: NaN compares False against every threshold, so an unchecked NaN price would pass every downstream test.
  4. Size, Notional and Aggregate Checks: Quantity against max_order_quantity; this order's notional against max_order_value_cad; and, when configured, open_order_notional_cad + this order against max_open_order_notional_cad. A market order (price=None) is valued at the reference price so it is still caught by the notional controls.
  5. Price Collar: Limit orders deviating more than max_price_deviation_pct from the reference price are rejected. Market orders carry no limit price and are not collared — size and notional are their only constraints here.
  6. UMIR 6.2 Designation Check: Decide the designation before routing, not after:
    • If the account is short-marking exempt, every order from it — purchase as well as sale — must carry the SME designation and must not also be marked short (UMIR 6.2(1)(b)(ix)). Its use is mandatory, not optional.
    • Otherwise, a sale of a security the account does not own must be marked "short" (UMIR 6.2(1)(b)(viii)) — and a sale fully covered by owned inventory must not be. Over-marking is a misdesignation too.
  7. Rejection Handling: Log every rejection with its ViolationCode and halt routing. Persist the record for supervisory review under UMIR 7.1.

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

Common Pitfalls

  • Post-Trade Only: Relying on T+1 drop-copy reconciliation. NI 23-103 s.3(2) requires automated controls pre-trade; post-trade monitoring is an addition to them, not a substitute.
  • Failing Open on Missing Market Data: Skipping the price collar when the reference price is zero, None or NaN. A gap in the feed is exactly when a fat-finger order is most dangerous — a control that quietly stops running is worse than no control, because nobody notices.
  • Treating SME as an Optional Extra Flag: Marking a qualifying account's order both "short" and "short-marking exempt", or marking only sales SME and leaving its purchases unmarked. SME replaces the short marker and applies to both sides of the account's flow.
  • Only Checking Under-Marking: Marking a fully covered long sale as "short" is a UMIR 6.2 misdesignation in its own right and corrupts the audit trail CIRO relies on.
  • Static Price Limits: Hardcoding a "$50 limit" instead of linking price collars to the current reference price.
  • Confusing Single-Order and Aggregate Controls: A per-order notional cap does not satisfy the Policy 7.1 control on the value of unexecuted orders. A thousand small orders can breach a capital threshold that no single order does.
  • Citing Repealed Rules in Controls Documentation: UMIR 3.1 (short sale price restrictions, the tick test) was repealed effective September 1, 2012. Short-sale obligations now live in the UMIR 6.2 designations and the pre-borrow provisions.

Verification

  • Simulate a "fat-finger" market order for 1,000,000 shares and confirm the engine blocks it before FIX transmission.
  • Submit an order with a NaN limit price and with a zero reference price; confirm both are rejected rather than silently passed.
  • Submit a purchase from a short-marking exempt account with no designation; confirm IMPROPER_SME_MARK.
  • Run python -m unittest discover -s skills/canada-iiroc-electronic-trading-rules/scripts and confirm all tests pass.

Related Skills

  • broker-account-margin-call-handling
  • best-execution-record-keeping-global
  • sec-rule-15c3-5-risk-controls-us
  • mifid-ii-algo-trading-compliance-eu

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Canada Iiroc Electronic Trading Rules AI skill do?

Use when routing orders to Canadian marketplaces such as TSX, TSX Venture, Cboe Canada or an ATS, where NI 23-103 section 3 and UMIR Rule 7.1 require automated pre-trade controls and UMIR 6.2 order designations on every order.

Why use Canada Iiroc Electronic Trading Rules on TypingMind?

Because you install it once and use it with any model. Canada Iiroc Electronic Trading Rules is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Canada Iiroc Electronic Trading Rules in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/HimanshuJ16/Algo-Trading-Skills/tree/main/skills/canada-iiroc-electronic-trading-rules. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Canada Iiroc Electronic Trading Rules?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Canada Iiroc Electronic Trading Rules?

As many as you like. As long as a model supports skills, you can use Canada Iiroc Electronic Trading Rules with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Canada Iiroc Electronic Trading Rules AI skill free?

Yes. It is published on GitHub by HimanshuJ16 under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇