/algo-trading-skills:broker-order-type-capability-matrixfrom algo-trading-skills
Plans order decomposition across brokers with different native order types (bracket, OCO, trailing stop, iceberg, TWAP). Checks native support and emulates locally when missing, conserving parent quantity and price geometry.
Ships in algo-trading-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Invoke this skill when deploying algorithmic strategies across broker APIs whose
native order-type support differs. IBKR exposes bracket orders, OCA groups, iceberg
via displaySize and the TWAP/VWAP IBALGOs; Alpaca exposes bracket and OCO order
classes but no iceberg and no execution algos; Zerodha withdrew bracket orders but
offers a native iceberg variety; Binance Spot covers OCO, OTOCO and icebergQty but
reaches TWAP only through a separate Algo API. Submitting an unsupported type gets it
rejected. This skill checks native support first and, where it is missing,
decomposes the order into a primary leg plus explicitly typed legs for a local
Execution Management System.
The two things it must get right, because everything downstream trusts them: the quantity conservation (does the plan execute exactly the requested size?) and the price geometry (are the protective legs on the side of the market that protects?).
scripts/capability_matrix.py plans an order. It performs no network
I/O, submits nothing, watches no quotes and holds no state. The trigger watching,
the timers, the sibling cancellation and the persistence are all yours.DEFAULT_CAPABILITIES is a dated, sourced
template. Support changes and varies by asset class, product and entitlement —
re-verify against references/standards.md's links before trading it.order-placement-idempotency.references/standards.md lists them with sources.min_slice_qty
and for rounding the slice schedule before dispatch.Register capability profiles, and make them self-consistent. The supports_*
booleans are a view of native_order_types, not a second switch — a profile where
they disagree raises at construction rather than reaching order time claiming
native OCO while silently taking the emulation path.
Validate before deciding how to route. plan_order_execution checks quantity,
prices, leg completeness and price geometry ahead of the native/emulated branch.
A bracket with no exit legs, or with the stop on the profitable side, is malformed
regardless of whether the broker would have accepted it — the native path is not a
validation bypass. Arguments the requested type does not consume are refused by
name rather than discarded: a stop_loss_price silently dropped from a MARKET
order leaves the caller believing a position is protected that nothing is watching.
Read action per order type — they are not the same. For BRACKET it is the
entry side and the exits invert it. For OCO it is the side of both exit
legs, matching the same-side constraint Binance and Alpaca document for their
native OCOs. BRACKET+BUY therefore wants the target above the stop, and
OCO+BUY (closing a short) wants it below.
Execute the plan exactly as written. If has_primary_order, fire
primary_quantity of primary_order_type at primary_price once; then register
emulated_legs. primary_quantity plus every scheduling leg's quantity already
equals the requested quantity — do not re-slice the parent. When
primary_order_type is None (emulated OCO), fire nothing now.
Persist before you submit. plan.to_dict() serializes the plan losslessly.
Write it down before the primary order goes out, not after.
Full procedure, EMS contract and the price-geometry table: see
references/workflows.md. Per-broker capability evidence with sources: seereferences/standards.md. Printable pre-flight checklist: seeassets/checklist.md.
quantity + one slice — a 100-unit
iceberg in 3 slices sends 133. The feeder here carries only what the primary did not.ocaType "with block", which routes one order at
a time; ocaType=3 carries the same exposure a local emulation does.primary_order_type=OCO sends the caller back to the exact endpoint that
just failed the native-support check.if not stop_loss_price reads 0 as "not supplied" and
plans a bracket with a silently missing leg instead of rejecting a bad price.LOT_SIZE and a minimum notional. A slice below the floor is a guaranteed
rejection — pass min_slice_qty so the plan fails at planning time.python -m unittest discover -s skills/broker-order-type-capability-matrix/scriptsprimary_quantity + sum(metadata["slice_schedule"]) equals exactly
1000. This is the highest-value single assertion in the suite.primary_order_type is None and
has_primary_order is False.BRACKET+BUY and OCO+BUY accept opposite price orderings.0 price is rejected rather than treated as absent.min_slice_qty rejects a schedule whose slices fall below the venue floor.BrokerOrderCapabilityMatrix(custom_matrix={}) resolves no brokers at all.references/standards.md against the broker's live
documentation before promoting to live trading.broker-agnostic-adapter-interfaceorder-placement-idempotencyexecution-algo-twap-vwap-slicingiceberg-order-native-broker-support-vs-simulationminimum-fill-size-and-lot-rounding-logicpaper-to-live-promotion-checklistWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub himanshuj16/algo-trading-skills --plugin algo-trading-broker-integration36 skills in this plugin
/alpaca-paper-live-key-separationUse when a bot connects to the Alpaca Trading API and must never cross paper keys with the live endpoint; pins the base URL per environment, checks the key prefix, probes /v2/account and requires an explicit ALLOW_LIVE_TRADING flag./api-key-least-privilege-audit-toolUse before deploying a live bot, to audit existing broker API keys for scopes they do not need. Flags withdrawal, transfer and admin rights that turn a leaked execution key into theft./broker-account-margin-call-handlingUse when a bot trades a Reg T, portfolio or futures margin account and must act before the broker liquidates: tiered maintenance-margin warnings cross-checked against broker excess liquidity, initial-margin order gating and liquidity-aware de-leveraging.Other plugins' skills for the same job