Sequence/docs

Orders & Execution Graphs

Every order is an execution graph. A simple market buy is a 1-node graph. A multi-leg hedge is a multi-node graph with dependency edges. One endpoint handles both.


Submit Order

POST/v1/orders

Accepts two formats: simple order (auto-wrapped into a 1-node graph) or full execution graph.

Simple Order

json
{
  "symbol": "BTC-USD",
  "side": "buy",
  "qty": 0.1
}

Prediction-market simple orders use the same endpoint. symbol can be a Polymarket slug, :yes / :no slug, raw token ID, or a full polymarket.com/event/... URL.

Optional fields:

FieldTypeDescription
symbolstringRequired. Trading pair, Polymarket slug, token ID, or full Polymarket event URL
sidestringRequired. buy or sell
qtynumberRequired. Quantity in human units (e.g., 0.1 = 0.1 BTC)
pricenumberLimit price. Omit for market order.
venuestringPin to specific venue. Omit for SOR routing.

Full Execution Graph

json
{
  "nodes": [
    {
      "node_id": "spot",
      "instrument": {"symbol": "ETH-USD", "type": "spot"},
      "side": "buy",
      "order_type": "market",
      "quantity": {"fixed": {"qty_1e8": 20000000000}},
      "execution": {"policy": "sor", "urgency": "medium"},
      "activation": "root"
    },
    {
      "node_id": "hedge",
      "instrument": {"symbol": "ETH-USD-PERP", "type": "perp", "venue": "hyperliquid"},
      "side": "sell",
      "order_type": "market",
      "quantity": {"fixed": {"qty_1e8": 20000000000}},
      "execution": {"policy": "aggressive_chase"},
      "activation": "wait"
    }
  ],
  "edges": [
    {
      "edge_id": "e0",
      "from_node": "spot",
      "to_node": "hedge",
      "trigger": "on_fill_ratio",
      "condition": {"fill_ratio_gte": 0.5}
    }
  ],
  "risk": {
    "admission": {"max_notional_usd": 500000},
    "runtime": {"max_loss_usd": 10000}
  },
  "is_sandbox": false
}

Node Fields

FieldTypeDescription
node_idstringUnique ID within the graph
instrument.symbolstringTrading pair, or Polymarket slug / token ID / full event URL
instrument.typestringspot, perp, or prediction. Polymarket slug/URL inputs are auto-normalized to prediction before routing.
instrument.venuestringPin to venue (optional)
sidestringbuy or sell
order_typestring/object"market" or {"limit": {"price_1e9": N}}
quantityobject{"fixed": {"qty_1e8": N}} or "derived"
execution.policystringsor, ioc_sweep, passive_limit, aggressive_chase, passive_ladder, time_drip
execution.urgencystringlow, medium, high
execution.max_slippage_bpsintMax slippage in basis points
execution.horizon_msintExecution time horizon
execution.tifstringGTC, IOC, FOK
execution.pacingobjectTWAP: {"uniform": {"num_slices": 10, "interval_ms": 30000}}
activationstringroot (start immediately) or wait (wait for edge trigger)

Response

json
{
  "graph_id": "graph_7d769677a7b4448b...",
  "status": "active",
  "node_count": 2,
  "edge_count": 1
}
Note

For Polymarket, /v1/orders resolves the symbol to the venue token ID server-side before the execution graph is submitted. You do not need to pre-resolve token IDs yourself.


Get Graph Status

GET/v1/execution_graphs/{graph_id}
json
{
  "graph_id": "graph_7d769...",
  "client_id": "client_abc",
  "status": "active",
  "nodes": {
    "spot": {
      "status": "filled",
      "target_qty_1e8": 20000000000,
      "filled_qty_1e8": 20000000000,
      "avg_fill_price_1e9": 2325530000000,
      "fill_count": 3
    },
    "hedge": {
      "status": "executing",
      "target_qty_1e8": 20000000000,
      "filled_qty_1e8": 10000000000,
      "avg_fill_price_1e9": 2324800000000,
      "fill_count": 1
    }
  },
  "edges": {
    "e0": {"status": "fired", "fired": true}
  }
}

Graph status values: active, completed, cancelled, failed, paused.

Node status values: pending, executing, filled, partial_fill, cancelled, rejected, failed.

Transient vs terminal failures

The router distinguishes transient failures (worth retrying) from terminal rejects (don't retry — fix the input first). Inspect traces on the order to see the underlying classification:

Trace eventMeaningClient action
EXCHANGE_REJECT with code: 429 or 5xx bodyVenue rate-limited or transient outage. The router automatically backs off + retries; the parent order stays executing.Wait — no client action.
EXCHANGE_REJECT with "market metadata not yet indexed (gamma)"Polymarket-only: the token's market hasn't been indexed by Gamma yet. The edge refused to sign with placeholder defaults that would silently produce invalid signature.Retry in ~30 s. Gamma typically catches up within minutes.
EXCHANGE_REJECT with "Size (N) lower than the minimum: M"Venue business-rule reject (e.g. Polymarket's 5-share minimum, Kalshi tick-size).Fix the order shape and resubmit.
EXCHANGE_REJECT with "invalid signature"Venue rejected the signature. Should be very rare post-deploy — the edge guards against the placeholder-spec class. If you see this on a known-active market, surface it.Surface to support.

List Orders

GET/v1/orders
ParamTypeDefaultDescription
limitint50Max results
offsetint0Pagination offset
symbolstringFilter by symbol
node_order_idstringFilter by specific order ID
json
{
  "orders": [
    {
      "node_order_id": "graph:graph_7d769...:spot:1",
      "client_id": "client_abc",
      "side": "BUY",
      "symbol": "ETH-USD",
      "qty_1e8": 20000000000,
      "filled_qty_1e8": 20000000000,
      "status": "COMPLETED",
      "created_unix_ns": 1776208527263141000,
      "updated_unix_ns": 1776208529872926000,
      "failure_reason": null
    }
  ],
  "total": 42,
  "limit": 50,
  "offset": 0,
  "has_more": false
}
Warning

Status and side values are UPPERCASE in order responses: BUY, SELL, COMPLETED, FAILED.


Cancel Order / Graph

DELETE/v1/execution_graphs/{graph_id}

Cancels all active nodes in the graph. Returns 200 on success.

To cancel a specific order, extract the graph_id from the node_order_id:

code
node_order_id: "graph:graph_7d769...:spot:1"
                      ^^^^^^^^^^^^^^^^
                      graph_id

Resume Paused Graph

POST/v1/execution_graphs/{graph_id}/resume

Resumes a paused graph. Pending nodes will re-evaluate their edge triggers.


Amend Graph Node

PATCH/v1/execution_graphs/{graph_id}/nodes/{node_id}

Amend a running graph node's execution parameters (urgency, slippage, horizon):

json
{
  "qty_1e8": 15000000000,
  "urgency": "high",
  "max_slippage_bps": 25,
  "horizon_ms": 5000
}

All fields are optional. Only provided fields are updated.


Amend Order (uniform verb)

PATCH/v1/orders/{node_order_id}

Venue-agnostic price/qty amend. Designed for prediction markets (Kalshi + Polymarket) and spot CEX venues behind one call. The graph-level API executes through the parent-order amend / cancel-replace workflow today; Kalshi's lower-level transport supports native atomic /portfolio/orders/{id}/amend, but CC does not yet preserve that native amend path end-to-end through this endpoint.

json
{
  "new_qty_1e8": 12000000000,
  "new_constraints": {
    "max_price_1e9": 550000000
  }
}
FieldDescription
new_qty_1e8New total quantity (not a delta). Omit to keep current.
new_constraints.max_price_1e9New limit price. Omit to keep current.

At least one of new_qty_1e8 / new_constraints.max_price_1e9 must be present.

Response:

json
{
  "node_order_id": "graph_abc...:node_0:2",
  "status": "accepted"
}

The SDK wraps this and surfaces a mode field (cancel_replace today) so queue-sensitive market makers can branch on execution mode.


Decrease Order (uniform verb)

Shrink a resting order's remaining size without touching its price. SDK-only verb (no distinct REST endpoint today — the SDK reads the current size, computes new_qty, and issues a regular amend). Kalshi's lower-level transport supports native /portfolio/orders/{id}/decrease, but CC does not yet preserve that native decrease path end-to-end through this SDK method, so the SDK reports cancel_replace_shrink today.

python
r = seq.decrease(order_id, reduce_by=5.0)
# {"order_id": "...", "mode": "cancel_replace_shrink", "status": "accepted"}

Batch Orders (uniform verb, SDK-orchestrated)

The SDK batch() builder collects submits/cancels for a target venue and flushes graph roots together. Today the graph-level SDK path serializes and returns mode="serial" for both Kalshi and Polymarket.

The lower venue transports support native batches where the execution engine preserves a transport batch window: Kalshi uses /portfolio/orders/batched (20-op atomic) and Polymarket uses CLOB POST /orders (15 orders, per-order result). Those native paths are not yet surfaced by this SDK graph builder, so queue-sensitive callers must branch on the returned mode.

python
# Kalshi — works directly, mode=serial today
with seq.batch("kalshi") as b:
    b.buy_limit("KXBTCZ-26DEC31-T99000", 10, 0.55)
    b.cancel(stale_id)
 
# Polymarket — graph-level SDK batch is serial today
seq.batch("polymarket").buy("TOKEN_ID", 10).end()
# → {"mode": "serial", "responses": [...]}

Redeem Prediction Market

POST/v1/markets/{slug}/redeem?venue={venue}

Uniform settlement claim. Kalshi auto-settles (returns mode="auto_settled", no action taken); Polymarket fires an authenticated POST to the CLOB relayer (returns mode="relayer_submitted"). See Prediction Markets for full response shape.


List Fills

GET/v1/fills
ParamTypeDefaultDescription
limitint50Max results
offsetint0Pagination offset
symbolstringFilter by symbol
node_order_idstringFilter by order

Each fill carries a Phase-1 TCA breakdown when the venue reported one:

FieldDescription
fee_1e9Realized fee in USD scaled to 1e9. Authoritative for accounting — use this, not the pre-trade estimate.
is_makertrue if liquidity-providing leg, false if taker, null if the venue didn't classify.
fee_breakdownStructured commission decomposition (JSONB). Keys: commission_1e9, commission_asset (e.g. "USD", "USDC"), and per-component fields where applicable. null for fills from older code paths.
taker_fee_bps_applied, maker_fee_bps_appliedRealized rate (in bps) the venue actually charged on this fill — useful for TCA prediction-error vs expected_fee_bps set at submit.
commission_assetWhat unit the fee was charged in (USD for Kalshi, USDC for Polymarket / Polygon CTF, etc.)
venue_reported_cum_fee_1e9Running cumulative commission per the venue's accounting (drift check against sum(fills.fee_1e9)).
Note

Polymarket fills now carry the realized fee derived from the venue's fee schedule (fd.r × C × p × (1-p) keyed by the trade's asset_id). Earlier TCA / accounting reports may have under-counted Polymarket fees because the WS event doesn't include fee_rate_bps per-leg and the old code coerced absent → 0. Cross-check against expected_fee_bps (snapshot at submit) for prediction-error analysis.


Kill Switch

PUT/v1/kill_switch

Emergency circuit breaker. Cancels all active orders and blocks new submissions.

json
{"active": true, "reason": "risk limit breach"}

To clear: {"active": false}


Execution Policies

PolicyBehavior
sorSmart order routing — splits across best venues (default)
ioc_sweepSingle immediate-or-cancel sweep
passive_limitPost at touch, hold until TTL
aggressive_chaseCross spread, widen on timeout
passive_ladderPost passively, escalate after horizon_ms
time_dripSOR picks tactic based on urgency + spread

Edge Triggers

TriggerFires when
on_acceptedSOR acknowledges the order
on_first_fillFirst fill arrives
on_fillEvery fill (streaming hedge mode)
on_fill_ratioFill ratio reaches condition.fill_ratio_gte
on_full_fill100% filled
on_timeout{"on_timeout": {"ms": 5000}}
on_pricePrice condition: {"on_price": {"symbol": "BTC-USD", "direction": "below", "reference": "graph_entry_price", "offset_pct": -5.0}}
on_cancelParent cancelled
on_doneAny terminal state