Orders are identified by a unique orderId that is automatically generated for each order and returned upon order submission.
Orders can optionally be identified by specified customerOrderId that is unique for each accountId.
If order quantity is amended to a lower quantity that is present in the order book without a price change, its size will be reduced by the difference between the currently known remaining amount and the newly requested amount. The order will not lose its priority in the order book.
If order quantity is increased, or the price is changed, any existing orders will get cancelled and a new order will be placed with the same orderId and customerOrderId, since order priority in the order book will be lost because of these actions.
Orders for all instruments are placed into the central limit order book that matches orders based on price-time priority. Every single order on the exchange has a limit price.
Consider the following example, with the following limit buy orders placed in the order book:
- Quantity 20 at price 100 placed at 8:00,
- Quantity 10 at price 101 placed at 8:01,
- Quantity 30 at price 100 placed at 8:02.
When an incoming limit sell order with a limit price of 99 for quantity 45 arrives, it will be matched with order number 2 first (as it has the best price), then it will be matched with order number 1 (as it was placed earlier than the order number 3 that has the same price), and finally it will be partially matched with order number 3. The trades/fills will be:
- Quantity 10 at price 101,
- Quantity 20 at price 100,
- Quantity 15 at price 100.
For limit orders, the user specifies both quantity and limit price.
Any unfilled fraction of a limit order will be placed in the order book by default if no extra order flags are specified.
For example, suppose a limit order to buy was set at $9,900 and the mark price is $10,000. When the mark price hits the limit price (or goes below the limit price), the limit order is executed.
For a market order only the quantity is specified, while the limit price is set automatically to the maximum or minimum allowable price for buy and sell orders correspondingly.
For market orders, the price is bounded by trading bands, which are equal to the product of the initial margin percentage and the mark price. Trading bands ensure market integrity and prevent market manipulation.
For example, if the mark price for the derivative is $10,000 and the initial margin is 1%, the maximum limit price allowed for buy orders will be $10,100 ($10,000*1.01), and the minimum limit price for sell orders is $9,901 ($10,000/1.01).
If a market order remains unfilled or partially unfilled, the remaining fraction of it is cancelled (equivalent to a limit order with the ImmediateOrCancel time in force option).
Just as in the example above, when the mark price is $10,000, the limit price for buy market orders will be set to $10,100. The limit price for sell market orders is set to $9,901.
Stop market orders
Stop market orders function the same as market orders where:
- It’s activated or sent out only when the trigger price is crossed by the mark price,
- Limit price is set relative to the trigger price instead of the mark price of the best bid/offer.
For example, suppose a stop sell order was sent for a derivative with a trigger price of $9,000. The order will get triggered once mark price falls below $9,000 and its limit price will be set to $8,911 ($9,000/1.01 if initial margin is 1%). Once the mark price hits $8,911, the stop market order is executed.
Stop limit orders
Stop limit orders work the same as stop orders, except the limit price can be specified.
For example, suppose a buy stop limit order was used for a derivative using a trigger price of $10,000 and a limit price of $10,050. The limit order will be triggered once the mark price moves above $10,000 and the order is executed once the mark price reaches $10,050.
The limit price cannot exceed the limit price set for buy stop orders or be below the limit price for sell stop order, as described in the section above.
The Post-only flag specifies that the limit order will not get matched immediately and cancelled if there are existing orders in the order book that it can be matched with.
For example, if the current best ask is $102, but a buy limit order with a post-only flag is submitted with a limit price of $110, it will be immediately cancelled. However, if the limit price of the same order was $101, it will get placed into the order book just like any other limit order.
The flag is applicable to limit orders only.