IDEX is the first order book exchange to integrate a smart-contract Automated Market Maker (AMM) as a liquidity source. The AMM provides liquidity without a central operator, unlike traditional limit order market making which requires an API connection, algorithms, etc. AMM positions are represented by LP tokens, allowing for transfer and use in liquidity mining.
AMM liquidity exists as a continuous curve rather than at discrete price levels. Users do not need to distinguish between AMM and limit order liquidity as the IDEX trading engine automatically routes orders into the best combination of both.
To better visualize AMM liquidity in the UI, the curve is quantized into various synthetic price levels and quantities. These "virtual limit orders" are displayed on the order book alongside other limit orders from individual users. In addition to synthetic price levels, API traders are provided with the exact AMM asset balances, allowing them to construct a more precise view of the liquidity pool.
The IDEX smart contract contains three settlement functions:
Limit order only
Hybrid order (AMM + limit order)
AMM only and limit order only are self explanatory. A hybrid settlement takes AMM liquidity from the current AMM price to the next limit order, as well as the limit order liquidity, up to the full liquidity of the first limit order at that price level (by price/time priority). Any additional limit orders at that price level are settled as limit order only.
In practice, almost every executed order will result in an AMM only or hybrid settlement, as the 0% slippage of the liquidity pool makes it unlikely that a limit order is the best price. Orders that pass through multiple limit order price levels will result in multiple hybrid settlement transactions.