Batch Order

This endpoint allows sending limit or stop order(s) and/or cancelling 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.
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
Sample Call

Before URL encoding

https://www.cryptofacilities.com/derivatives/api/v3/batchorder?
json={"batchOrder":[{"order":"send","order_tag":"1","orderType":"lmt","symbol":"FI_XBTUSD_180511","side":"buy","size":1,"limitPrice":1.0,"cliOrdId":"my_another_client_id"},{"order":"cancel","cliOrdId":"my_client_id"}]}

Example Authent Generation:

Public Key YF20J/d7vwsurRbu/Iq6u7eU/gi49AbHzyuZt8VSwdVpJvOJ3X954MsT
Private Key yzKjV2AAo0e+yI6RB08cw8RaTyd4O+T4jtdpSVEZLW3xXqB6mDs1SBHEpIFRcJ37dWMwQ8j0+lFPsROQEjJQ/Kxq
Authent wRTH1utD8dgmgNncjXS+nmydDRbbS7KchEDLaLx3Oie5AVz1gBuDZC1aBWQ4HXdvXKOxNuzr/SUn5NDM41oaGQ==

After URL encoding:

https://www.cryptofacilities.com/derivatives/api/v3/batchorder?
json=%7B%22batchOrder%22%3A%5B%7B%22order%22%3A%22send%22%2C%22order_tag%22%3A%221%22%2C%22orderType%22%3A%22lmt%22%2C%22symbol%22%3A%22FI_XBTUSD_180511%22%2C%22side%22%3A%22buy%22%2C%22size%22%3A1%2C%22limitPrice%22%3A1.0%2C%22cliOrdId%22%3A%22my_another_client_id%22%7D%2C%7B%22order%22%3A%22cancel%22%2C%22cliOrdId%22%3A%22my_client_id%22%7D%5D%7D
Sample Return if Successful
{  
    "result":"success",
    "serverTime":"2016-02-25T09:45:53.818Z",
    "batchStatus":[  
        {  
            "receivedTime":"2016-02-25T09:45:53.601Z",
            "status":"placed",
            "order_id":"f375266d-6c46-4eae-8732-507bd71406f3",
            "cliOrdId":"31b81939-9a58-4ed9-a114-0b0b35f3845e",

            "order_tag":"1"
        },
        {  
            "receivedTime":"2016-02-25T09:45:53.601Z",
            "status":"cancelled",
            "order_id":"c18f0c17-9971-40e6-8e5b-10df05d422f0"

        },
        {  
            "receivedTime":"2016-02-25T09:45:53.602Z",
            "status":"cancelled",
            "order_id":"bf5cb212-5962-4b75-a71d-98aad3b0603a",

            "cliOrdId":"4a2d600a-e557-4d50-8f46-170bd364ca3e"

        }

    ]
}

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
   
receivedTime ISO8601 datetime The date and time the order was received
status string The status of the order, either of:
  • placed: the order was placed successfully
  • attempted: the post-order will be attempted. If it is successful it will be shown in open orders
  • invalidOrderType: the order was not placed because orderType is invalid
  • invalidSide: the order was not placed because side is invalid
  • invalidSize: the order was not placed because size is invalid
  • invalidPrice: the order was not placed because limitPrice and/or stopPrice are invalid
  • insufficientAvailableFunds: the order was not placed because available funds are insufficient
  • selfFill: the order was not placed because it would be filled against an existing order belonging to the same account
  • tooManySmallOrders: the order was not placed because the number of small open orders would exceed the permissible limit
  • marketSuspended: the order was not placed because the market is suspended
  • marketInactive: the order was not placed because the market is inactive 
  • clientOrderIdAlreadyExist: the specified client id already exist
  • clientOrderIdTooLong: the client id is longer than the permissible limit
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 cancellation, either of:
  • cancelled: the order was found untouched and the entire size was cancelled successfully
  • filled: the order was found completely filled and could not be cancelled
  • notFound: the order was not found, either because it had already been cancelled or it never existed
  • requiredArgumentMissing: the request does not contain order_id and/or cliOrdId parameters
order_id string The cancelled 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:

  • apiLimitExceeded: the API limit for the calling IP address has been exceeded
  • authenticationError: the request could not be authenticated
  • accountInactive: the Crypto Facilities account the request refers to is inactive 
  • requiredArgumentMissing: a required argument was missing
  • invalidArgument: <argument>:argument "<argument>" is invalid
  • nonceBelowThreshold: <threshold> the provided nonce is below the <threshold>
  • nonceDuplicate: <duplicate> the provided nonce is a duplicate as it has been used in a previous request
  • Bad Request: The URL contains invalid characters. (Please encode the json URL parameter)