Market Order
Last updated
Last updated
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)
Currently Market Orders on Spark are available only via the SDK. We are currently working on adding the Market Order functionality to the frontend via the Swap page. Market orders will also be available through the standard order book page.
Order Creation: When a trader or algorithm creates a market order, it immediately enters the exchange's order book.
Matching: The exchange matches the market order with limit orders already in the order book.
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.
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:
Creating a market order to buy 1000 tokens.
Order book before execution:
Sell limit orders:
500 tokens at $10.00
300 tokens at $10.05
200 tokens at $10.10
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)
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.