TypeScript SDK — Clearing: Clearing Orders
Create, manage, and query OTC clearing orders. All methods are on client.clearingInstant.
See the API specifications for full request/response schemas and the authentication guide for setup.
Methods
createNewClearingOrder
POST /v1/clearing/new · Authenticated
Creates a new OTC clearing order. The request body is validated client-side. The SDK enforces:
symbol— required stringamount— required decimal stringprice— required decimal stringside— required enum:"buy"or"sell"counterparty_id— optional stringexpires_in_hrs— optional finite numberaccount— optional string (required for Master API keys to target a specific sub-account)
Note: If you are using a Master API key, you must include the
accountfield to specify which sub-account the clearing order applies to.
Code
This is a POST mutation — never automatically retried. Prices and amounts must be decimal strings (e.g. "50000.00", not 50000).
getClearingOrder
POST /v1/clearing/status · Authenticated
Retrieves the current status of a clearing order by its clearing ID.
Code
This is a POST mutation — never automatically retried.
cancelClearingOrder
POST /v1/clearing/cancel · Authenticated
Cancels an active clearing order. The request body is validated client-side — clearing_id is a required string.
Code
This is a POST mutation — never automatically retried. Only orders in a cancellable state can be cancelled.
confirmClearingOrder
POST /v1/clearing/confirm · Authenticated
Confirms a clearing order, finalizing the trade. The request body is validated client-side. The SDK enforces:
clearing_id— required stringsymbol— required stringamount— required decimal stringprice— required decimal stringside— required enum:"buy"or"sell"
Code
This is a POST mutation — never automatically retried. Confirmation is irreversible — ensure the fields match the original order before confirming.
listClearingOrders
POST /v1/clearing/list · Authenticated
Lists clearing orders with optional time-range filtering. The response is a wrapper object with an orders array — not a bare array. Each order uses quantity (number) for the amount and price (number) for the price.
Code
Tip: Timestamp filters (
expiration_start,expiration_end,submission_start,submission_end) acceptbigintornumber. Note thatpriceandquantityin the list response are numbers, not strings.
listClearingTrades
POST /v1/clearing/trades · Authenticated
Returns a list of executed clearing trades. The response is a wrapper object with a results array. Trades use pair (not symbol) and quantity (not amount).
Code
Tip: The request body accepts an optional
timestamp(bigint or number) for pagination. Each trade includesclearingId,sourceAccount,targetAccount, and status timestamps (createdMs,lastUpdatedMs,expirationTimeMs).
listClearingBrokers
POST /v1/clearing/broker/list · Authenticated
Lists broker clearing orders. The response is a wrapper object with an orders array. Broker orders use source_counterparty_id (not counterparty_id) and source_side (not side).
Code
Tip: Timestamp filters accept
bigintornumbervalues. LikelistClearingOrders,priceandquantityare numbers in the response.
createNewBrokerOrder
POST /v1/clearing/broker/new · Authenticated
Creates a new clearing order as a broker on behalf of two counterparties. The request body is validated client-side. The SDK enforces:
source_counterparty_id— required stringtarget_counterparty_id— required stringsymbol— required stringamount— required decimal stringprice— required decimal stringside— required enum:"buy"or"sell"expires_in_hrs— required finite number
Code
This is a POST mutation — never automatically retried. All amounts and prices must be decimal strings. expires_in_hrs must be a finite number (not a string).
What's next
- Instant Orders — instant quote and execution
- Request Validation — how client-side validation works
- Data Types — decimal strings and bigint fields