DEX API

FAQ#

What is the difference between a limit order and a swap?#

A swap is executed at the real-time market price, whereas a limit order allows trading at a specified price, granting the trader control over pricing. Swaps are immediately executed and don’t require waiting. In contrast, a limit order is executed only when the token’s price reaches the set limit.

Who is the counterparty for a limit order?#

The API limit order is integrated into the OKX DEX to provide liquidity. The counterparties in this case are the users of OKX DEX. Users trading on OKX DEX can complete a transaction once they match an execution path coming from a limit order.

How are network fees charged?#

Network fees for limit orders are incurred only during the execution of an order. Placing or withdrawing a limit order doesn’t incur any network fees. In the context of API limit orders on OKX DEX, the network fees are borne by the transactions’ counterparties.

Why doesn’t an order execute immediately even when the market price reaches the set limit?#

Non-execution can occur for two reasons:

  1. If the market price reaches the limit price but there’s insufficient liquidity to fulfill the order, the order can’t be executed.
  2. If there’s no available counterparty on OKX DEX to carry out the transaction, the order remains unexecuted.

Why can’t I sell ETH with a limit order?#

ETH can’t be sold via a limit order because it isn’t an ERC-20 token. Limit orders on OKX DEX are currently designed only for ERC-20 tokens. If you want to sell ETH using a limit order, you should first wrap your ETH and use WETH (Wrapped ETH) as the sell token.