This endpoint allows sending limit or stop order(s) and/or cancelling open order(s) and/or editing open order(s) for a currently listed Futures contract in batch.
Authentication is required.
Endpoint |
Request Type | Permissible API Keys |
/api/v3/batchorder
|
POST | Read-write, Master |
Argument | Type | Required | Description |
json
|
structure of list | Yes | Contains the list batchOrder |
batchOrder
|
list of structures | Yes | A list containing structures of order sending and order cancellation instructions, see below. The list is in no particular order |
Order Placement
|
|||
order
|
string | Yes | Always send |
order_tag
|
string | Yes | An arbitrary string provided client-side to tag the order for the purpose of mapping order sending instructions to the API’s response |
orderType
|
string | Yes | either lmt for a limit order, post for a post-only limit order or stp for a stop order |
symbol
|
string | Yes | The symbol of the Futures |
side
|
string | Yes | The direction of the order, either buy for a buy order or sell for a sell order |
size
|
positive integer | Yes | The size associated with the order |
limitPrice
|
positive float | Yes | The limit price associated with the order. Must not have more than 2 decimal places |
stopPrice
|
positive float | No | The stop price associated with a stop order. Required if orderType is stp. Must not have more than 2 decimal places. Note that for stp orders, limitPrice is also required and denotes the worst price at which the stp order can get filled |
cliOrdId
|
UUID | No | The order identity that is specified from the user. It must be globally unique. |
reduceOnly
|
string | No | Set as 'true' if you wish the order to only reduce an exisiting position. Any order which increases an existing position will be rejected. Default 'false'. |
Order Cancellation
|
|||
order | string | Yes | Always cancel |
order_id | UUID | No | The unique identifier of the order to be cancelled |
cliOrdId | UUID | No | The unique client identifier of the order to be cancelled |
Order Edit |
|||
order | UUID | Yes | Always edit |
order_id | UUID | No | ID of the order you wish to edit |
size
|
positive integer | No | The size associated with the order |
limitPrice
|
positive float | No | The limit price associated with the order. Must not have more than 2 decimal places |
stopPrice
|
positive float | No | The stop price associated with a stop order. Required if old orderType is stp. Must not have more than 2 decimal places. Note that for stp orders, limitPrice is also required and denotes the worst price at which the stp order can get filled |
cliOrdId
|
UUID | No | The order identity that is specified from the user. It must be globally unique. |
Sample Call | ||||||
https://www.cryptofacilities.com/derivatives/api/v3/batchorder?json={'batchOrder': [{'reduceOnly': 'false', 'symbol': 'PI_XBTUSD', 'size': 1000, 'orderType': 'lmt', 'order': 'send', 'order_tag': '1', 'side': 'buy', 'limitPrice': 9400.0}, {'order': 'edit', 'order_id': '022f6393-11ef-4eb7-ac1b-266f62f1c153', 'size': 1000, 'limitPrice': 9400.0}, {'order': 'cancel', 'order_id': 'd77eee0d-5ed2-4ae4-ac16-de0d145d1b85'}]} Example Authent Generation:
URL encoded (Only if data is sent in the URL): https://www.cryptofacilities.com/derivatives/api/v3/batchorder? |
Sample Return if Successful |
{ |
Field |
Type | Description |
result
|
String | Always success |
serverTime
|
ISO8601 datetime | The server date and time |
batchStatus
|
list of structures | A structure containing information on the send order request, see below |
Sent Orders
|
||
dateTimeReceived | ISO8601 datetime | The date and time the order was received |
status | string | The status of the order, either of:
|
orderEvents | Structure | Order Events |
order_id | UUID | The unique identifier of the order |
order_tag | string | The arbitrary string provided client-side when the order was sent for the purpose of mapping order sending instructions to the API’s response |
cliOrdId | UUID | The unique client order identifier. This field is returned only if the order has a client order id. |
Order Cancellations | ||
receivedTime | ISO8601 datetime | The date and time the order cancellation was received |
status | string | The status of the order cancelation, either of:
|
order_id | string | The cancelled order id |
cliOrdId | string | The client order id. Shown only if exists |
Order Edits | ||
receivedTime | ISO8601 datetime | The date and time the order cancellation was received |
status | string | The status of the order, either of:
|
order_id | string | The edited order id |
cliOrdId | string | The client order id. Shown only if exists |
Sample Return if Unsuccessful |
{ "result":"error", "serverTime":"2016-02-25T09:45:53.818Z", "error":"apiLimitExceeded", } |
Field |
Type | Description |
result
|
String | Always error |
serverTime
|
ISO8601 datetime | The server date and time |
error
|
string |
The reason the API call failed, either of:
|