Submit order

NewOrderSingle

A NewOrderSingle message allows user to submit an order and receive execution reports over the same websocket session.
Currently MARKET and LIMIT order types are supported.

Example new order 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, recommed UUID
accountIdstringYesAnchorage brokerage account ID
symbolstringYesTrading symbol for the order, e.g. "BTC-USD"
side["BUY", "SELL"]YesSide for the order, BUY or SELL
orderQtystringYesOrder quantity
currencystringYesCurrency that the order quantity is specified in, can be either side of the symbol
orderType["MARKET", "LIMIT"]YesOrder type, MARKET or LIMIT
limitPricestringNoLimit price, required if order type is LIMIT
timeInForce["FOK", "GTC", "IOC"]NoTime in force, FOK = Fill Or Kill, GTC = Good Till Cancel, IOC = Immediate Or Cancel



Response

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 as specified on the order request
symbolstringYesTrading symbol as specified on the order request, e.g. "BTC-USD"
side["BUY", "SELL"]YesOrder side, BUY or SELL, as specified on the order request
orderQtystringYesOrder quantity as specified on the order request
currencystringYesCurrency that the order quantity is specified in, as specified on the order request
orderType["MARKET", "LIMIT"]YesOrder type, MARKET or LIMIT, 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
orderStatus["PENDING", "NEW", "REJECTED", "PENDING_CANCEL", "CANCELED", "FILLED", "PARTIALLY_FILLED"]["PENDING", "NEW", "REJECTED", "PENDING_CANCEL", "CANCELED", "FILLED", "PARTIALLY_FILLED"]YesOrder status
execIdstringNoExecution ID that can be used later to query for trades.
execType["NEW", "FILL", "CANCEL", "REJECT", "CANCEL_REJECT"]["NEW", "FILL", "CANCEL", "REJECT", "CANCEL_REJECT"]NoType of the execution
avgPxstringNoAverage price of filled portion of the order
avgPxAllInstringNoAverage price including fees of filled portion of the order
cumQtystringYesCumulative quantity filled for the order
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, date-time in RFC3990 format
transactTimestring (date-time)NoTransaction time, date-time in RFC3990 format



CancelOrderRequest

Cancel an order, origClOrderId and accountId must matches the original order request. orderId must match the order id returned on the execution reports.

Cancel request 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 of 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
messageTypestringYOrderCancelRequest
timestampstring (date-time)YRFC3990 date-time string
origClOrderIdstringYClient order ID as specified on the order request
orderIdstringYAnchorage order ID
accountIdstringYAnchorage brokerage account ID as specified on the order request

Response

See response for "NewOrderSingle" request.




ExecutionReportResendRequest

Resend execution reports for an order. This request allows 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.

This request can be used to 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
messageTypestringYExecutionReportResendRequest
timestampstring (date-time)YRFC3990 date-time string
origClOrderIdstringYClient order ID as specified on the order request
orderIdstringYAnchorage order ID
accountIdstringYAnchorage brokerage account ID as specified on the order request

Response

A stream of execution reports. See response for "NewOrderSingle" request.


Did this page help you?