Order Processing Create/Cancel Request Mechanism
How to Ensure the Order of Create Order or Cancel Order Requests
To ensure the order of the create order or cancel order requests,
you must wait for an acknowledgment response which will contain the orderId
generated on the server side.
Also remember that the nonce parameter, for these two requests, must be a
unique increasing integer value.
For example, let us assume the following:
- You sent 10 create order requests in a row without waiting for an
orderId - The
nonceincreases with each request sent and thus - The
nonceis unique for each request
Because the requests received by the Bullish exchange are processed in parallel the following two possible scenarios can happen:
- happy scenario which has a small chance to occur: all 10 requests are processed in the exact order sent by the client, no error, all great and you are happy
- unhappy scenario which has a higher chance to occur: the requests are not
processed in the exact order sent by you, because the requests might arrive at the
Bullish processing server at different times and thus the validations
of the
noncefor each request take place at random times. Because of that all the requests that are validated and have thenoncehigher than the latest validnoncewill be accepted as valid and the ones which have thenoncesmaller than the last validnoncewill be considered invalid and dropped. In the worse case scenario the request with the highestnonce, the 10th request you sent, is validated first, and the rest of the 9 requests will fail the validation because they have thenoncesmaller than the 10th. Also if some requests are failing because of some other errors, e.g. incorrect inputs or internal error, you will not know because you did not wait for the acknowledgment from the server side for each request you sent.
If you wait the acknowledgment from the server side you ensure the order of the requests you sent and you can also verify the status of the order(s) you created or canceled.
How to Enable Out-of-Order Processing of Order Requests
The header BX-NONCE-WINDOW-ENABLED is a string representation of a boolean value which enables out-of-order
processing of Create Order or Cancel Order requests up to a window size of 100 from the highest previously used
nonce value (inclusive).
The nonce parameter is required to be both unique and incremental, but setting BX-NONCE-WINDOW-ENABLED to true
loosens this requirement such that the nonce is only required to be unique. For example, the client is able to
send nonce values from 1...100 in any order and all the values will be valid.
How Do EMS/Brokers Flag Their Executions Sent to Bullish
The header BX-REFERRER value is a unique identifier that can be used by EMS/brokers to flag their executions sent to Bullish.
This referrer header is applicable to the below mentioned authenticated endpoints:
For more details, please reach out to your relationship manager to understand which referrer you are assigned.