Skip to main content

NewOrderSingle

A NewOrderSingle message allows a user to submit an order and receive execution reports over the same WebSocket session. Currently MARKET and LIMIT order types are supported. Example request:
{
  "messageType": "NewOrderSingle",
  "timestamp": "2023-03-12T22:22:09.925952Z",
  "payload": {
    "clOrderId": "47ce2580-5e57-45d8-b67f-71a5aa55d05f",
    "symbol": "BTC-USD",
    "side": "SELL",
    "currency": "USD",
    "quantity": "10000",
    "orderType": "LIMIT",
    "limitPrice": "21000",
    "timeInForce": "GTC",
    "accountId": "3fa8372d-b51d-44ab-a456-43e947e4be10"
  }
}
Example response:
{
  "messageType": "ExecutionReport",
  "timestamp": "2023-03-12T22:22:09.925952Z",
  "version": "1.0",
  "seqNum": 3,
  "payload": {
    "clOrderId": "47ce2580-5e57-45d8-b67f-71a5aa55d05f",
    "orderId": "99b60f12-a20c-4977-99ea-f9affdb8e5f2",
    "accountId": "3fa8372d-b51d-44ab-a456-43e947e4be10",
    "symbol": "BTC-USD",
    "orderQty": "1000",
    "side": "SELL",
    "currency": "USD",
    "orderType": "LIMIT",
    "limitPrice": "21000",
    "timeInForce": "GTC",
    "orderStatus": "FILLED",
    "execId": "58fd5afc-b85e-45d1-951e-d6429ea9cd54",
    "execType": "FILL",
    "avgPx": "21990.01",
    "avgPxAllIn": "21968.02",
    "cumQty": "10000",
    "fillPx": "21990.01",
    "fillQty": "10000",
    "leavesQty": "0",
    "cancelQty": "0",
    "fee": "0.00045521",
    "feeCurrency": "BTC",
    "submitTime": "2023-03-12T22:22:09.909251Z",
    "transactTime": "2023-03-12T22:22:09.925050Z"
  }
}
Example reject response:
{
  "messageType": "ExecutionReport",
  "timestamp": "2023-03-12T22:22:09.925952Z",
  "version": "1.0",
  "seqNum": 5,
  "payload": {
    "clOrderId": "47ce2580-5e57-45d8-b67f-71a5aa55d05f",
    "orderId": "99b60f12-a20c-4977-99ea-f9affdb8e5f2",
    "accountId": "3fa8372d-b51d-44ab-a456-43e947e4be10",
    "symbol": "BTC-USD",
    "orderQty": "1000",
    "side": "SELL",
    "currency": "USD",
    "orderType": "LIMIT",
    "limitPrice": "21000",
    "timeInForce": "GTC",
    "orderStatus": "REJECTED",
    "execId": "6a33f72c-ec2e-4c7a-b443-29de3f884145",
    "execType": "REJECT",
    "avgPx": "0",
    "avgPxAllIn": "0",
    "cumQty": "0",
    "fillPx": "0",
    "fillQty": "0",
    "leavesQty": "0",
    "cancelQty": "0",
    "rejectReason": "Invalid request",
    "rejectReasonText": "invalid price: 21500.0001, must be multiplication of 0.01",
    "fee": "0",
    "feeCurrency": "",
    "submitTime": "2023-03-12T22:22:09.909251Z",
    "transactTime": "2023-03-12T22:22:09.925050Z"
  }
}

Request parameters

ParameterTypeRequiredDescription
messageTypestringYesNewOrderSingle
timestampstring (date-time)YesRFC3990 date-time string
clOrderIdstringYesClient order ID, must be unique; recommend UUID
accountIdstringYesAnchorage brokerage account ID
symbolstringYesTrading symbol, e.g. "BTC-USD"
side"BUY" | "SELL"YesSide for the order
orderQtystringYesOrder quantity
currencystringYesCurrency the order quantity is specified in; can be either side of the symbol
orderType"MARKET" | "LIMIT"YesOrder type
limitPricestringNoLimit price; required if orderType is LIMIT
timeInForce"FOK" | "GTC" | "IOC"NoFOK = Fill Or Kill, GTC = Good Till Cancel, IOC = Immediate Or Cancel

Response parameters

ParameterTypeRequiredDescription
messageTypestringYesExecutionReport
timestampstring (date-time)YesRFC3990 date-time string
clOrderIdstringYesClient order ID as specified on the order request
orderIdstringYesAnchorage order ID
accountIdstringYesAnchorage brokerage account ID
symbolstringYesTrading symbol as specified on the order request
side"BUY" | "SELL"YesOrder side as specified on the order request
orderQtystringYesOrder quantity as specified on the order request
currencystringYesCurrency as specified on the order request
orderType"MARKET" | "LIMIT"YesOrder type as specified on the order request
limitPricestringNoLimit price as specified on the order request
timeInForce"FOK" | "GTC" | "IOC"NoTime in force as specified on the order request
orderStatusstringYesPENDING, NEW, REJECTED, PENDING_CANCEL, CANCELED, FILLED, PARTIALLY_FILLED
execIdstringNoExecution ID, can be used to query for trades
execTypestringNoNEW, FILL, CANCEL, REJECT, CANCEL_REJECT
avgPxstringNoAverage price of filled portion of the order
avgPxAllInstringNoAverage price including fees of filled portion
cumQtystringYesCumulative quantity filled
fillPxstringNoFill quantity of this execution (execType="FILL")
fillQtystringNoFill price of this execution (excluding fees)
leavesQtystringYesLeaves quantity of this order
cancelQtystringNoCanceled quantity of this order
feestringNoAnchorage commission charged for this execution
feeCurrencystringNoCurrency that the commission is charged in
rejectReasonstringNoReason for rejection
rejectReasonTextstringNoAdditional description for reason of reject
submitTimestring (date-time)YesOrder submission time in RFC3990 format
transactTimestring (date-time)NoTransaction time in RFC3990 format

CancelOrderRequest

Cancel an order. origClOrderId and accountId must match the original order request. orderId must match the order ID returned on execution reports. Cancel requests on any completed order will be rejected. Example cancel request:
{
  "messageType": "OrderCancelRequest",
  "timestamp": "2023-03-12T22:22:09.925952Z",
  "payload": {
    "origClOrderId": "3fa8372d-b51d-44ab-a456-43e947e4be10",
    "orderId": "0d479b19-1012-42d1-9558-ffb4d8db7153",
    "accountId": "3fa8372d-b51d-44ab-a456-43e947e4be10"
  }
}
Example response:
{
  "messageType": "ExecutionReport",
  "timestamp": "2023-03-13T13:44:05.244315Z",
  "version": "1.0",
  "seqNum": 9,
  "payload": {
    "clOrderId": "3fa8372d-b51d-44ab-a456-43e947e4be10",
    "orderId": "0d479b19-1012-42d1-9558-ffb4d8db7153",
    "accountId": "3fa8372d-b51d-44ab-a456-43e947e4be10",
    "symbol": "BTC-USD",
    "side": "SELL",
    "orderQty": "10000",
    "currency": "USD",
    "orderType": "LIMIT",
    "limitPrice": "23500",
    "timeInForce": "GTC",
    "orderStatus": "CANCELED",
    "cumQty": "0",
    "cancelQty": "10000",
    "leavesQty": "0",
    "execId": "7cfcbb67-76fa-46c3-8535-655fd8fe0eb8",
    "execType": "CANCEL",
    "submitTime": "2023-03-13T13:44:05.182005Z",
    "transactTime": "2023-03-13T13:44:05.185177Z"
  }
}
Example cancel reject response:
{
  "messageType": "ExecutionReport",
  "timestamp": "2023-03-13T13:59:01.668938Z",
  "payload": {
    "clOrderId": "3fa8372d-b51d-44ab-a456-43e947e4be10",
    "orderId": "0d479b19-1012-42d1-9558-ffb4d8db7153",
    "accountId": "3fa8372d-b51d-44ab-a456-43e947e4be10",
    "symbol": "BTC-USD",
    "side": "SELL",
    "orderQty": "10000",
    "currency": "USD",
    "orderType": "LIMIT",
    "limitPrice": "23500",
    "timeInForce": "GTC",
    "orderStatus": "NEW",
    "execId": "16532303-8478-4a6e-82db-5920e6553525",
    "execType": "CANCEL_REJECT",
    "avgPx": "0",
    "avgPxAllIn": "0",
    "cancelQty": "0",
    "cumQty": "0",
    "leavesQty": "10000",
    "rejectReason": "Invalid account",
    "rejectReasonText": "Invalid account id for cancel request",
    "submitTime": "2023-03-13T13:59:00.151982Z",
    "transactTime": "2023-03-13T13:59:01.668610Z"
  }
}

Request parameters

ParameterTypeRequiredDescription
messageTypestringYesOrderCancelRequest
timestampstring (date-time)YesRFC3990 date-time string
origClOrderIdstringYesClient order ID as specified on the order request
orderIdstringYesAnchorage order ID
accountIdstringYesAnchorage brokerage account ID as specified on the order request
Response: See response parameters for NewOrderSingle.

ExecutionReportResendRequest

Resend execution reports for an order. Allows a client to request execution reports for a live or completed order. If the order is completed, all previous execution reports are sent again. If the order is still alive, in addition to any previous execution reports, newer reports will be streamed on this WebSocket as they occur. Use this to synchronize order states after a WebSocket disconnect. Example resend request:
{
  "messageType": "ExecutionReportResendRequest",
  "timestamp": "2023-03-12T22:22:09.925952Z",
  "payload": {
    "origClOrderId": "3fa8372d-b51d-44ab-a456-43e947e4be10",
    "orderId": "0d479b19-1012-42d1-9558-ffb4d8db7153",
    "accountId": "3fa8372d-b51d-44ab-a456-43e947e4be10"
  }
}

Request parameters

ParameterTypeRequiredDescription
messageTypestringYesExecutionReportResendRequest
timestampstring (date-time)YesRFC3990 date-time string
origClOrderIdstringYesClient order ID as specified on the order request
orderIdstringYesAnchorage order ID
accountIdstringYesAnchorage brokerage account ID as specified on the order request
Response: A stream of execution reports. See response parameters for NewOrderSingle.