Order Types

Limit Order

A limit order is an order to buy or sell securities at a specific or more favorable price. If the market price doesn't match the specified price, the order won't be executed until the market price reaches the specified level. A limit order can be executed fully or partially. In the case of partial execution, only the portion that matches the counter-offer in terms of price and volume will be executed.

Market Order

A market order is an order to buy or sell an asset at the current market price. Unlike a limit order, it does not specify a price and aims for immediate execution (in one transaction). Here's how it works in the order book:

Market Order Execution Process:

  1. Order Creation: When a trader or algorithm creates a market order, it immediately enters the exchange's order book.

  2. Matching: The exchange matches the market order with limit orders already in the order book.

  3. Execution: The market order is executed at the best available prices from the opposite side's limit orders:

    • For a buy market order: It is executed at the lowest available price from the sell order book.

    • For a sell market order: It is executed at the highest available price from the buy order book.

  4. Partial Execution: If the market order volume is too large to be fully executed at the current best price, it is partially executed across multiple prices until fully satisfied:

    • For example, if you want to buy 1000 tokens but only 500 are available at the best price, 500 tokens are bought at that price, and the remaining 500 at the next best available price.

Example of Market Order Execution:

  1. Creating a market order to buy 1000 tokens.

  2. Order book before execution:

    • Sell limit orders:

      • 500 tokens at $10.00

      • 300 tokens at $10.05

      • 200 tokens at $10.10

  3. Order execution:

    • 500 tokens bought at $10.00 (first price level)

    • 300 tokens bought at $10.05 (second price level)

    • 200 tokens bought at $10.10 (third price level)

  4. Result:

    • Average purchase price: (500 * $10.00 + 300 * $10.05 + 200 * $10.10) / 1000 = $10.03

Market orders ensure fast execution but may result in less favorable prices with large volumes or insufficient liquidity. This makes market orders suitable when speed is more important than exact price.

Types of Limit Orders (available via SDK only):

  1. Immediate or Cancel (IOC): A limit order that must be executed immediately and fully or partially. The unfilled portion is canceled. Typically available via API for quick liquidity.

  2. Fill or Kill (FOK): A limit order that must be executed fully and immediately. If not possible, the order is fully canceled. Available via API for traders needing full execution.

  3. Good Till Cancelled (GTC): A limit order that remains active until executed or canceled. Often supported by API for long-term position holding.

  4. Post Only Order: A limit order ensuring the order enters the order book without immediate execution. If it can be executed immediately, it is canceled. Available via API to ensure maker rebates.

Last updated