Dex
Understanding the hyperliquid dex
This a collection of extra documentation on the workings of Hyperliquid L1.
It is not exhaustive, rather it complements the Hyperliquid Docs.
Orders
For order types and options see the hyperliquid docs
Market order fills
- Sources:
- datasteam - topic: hyperliquid.orders
- datastream - topic: hyperliquid.fills
- table: hyperliquid.raw.orders
- status = ‘filled’
- type = ‘market’
Limit order fills
- Sources:
- datasteam - topic: hyperliquid.orders
- datastream - topic: hyperliquid.fills
- table: hyperliquid.raw.orders
- status = ‘filled’
- type = ‘limit’
What are TWAP Orders?
TWAP stands for Time-Weighted Average Price.
It is an order which is divided into multiple suborders. A suborder is sent every 30 seconds during the course of the TWAP.
In hyperliquid TWAPs are executed automatically by the validators and as such they do not have a transaction hash, only the order to place a twap has a transaction hash. As such you will very often see trades and fills with 0x0000000000000000000000000000000000000000000000000000000000000000 as the transaction hash.
Twap fills
- Sources:
- datastream - topic: hyperliquid.trades
- datastream - topic: hyperliquid.fills
- table: hyperliquid.raw.transactions
- hash = ‘0x0000000000000000000000000000000000000000000000000000000000000000’
Twap Open
- Sources:
- datastream - topic: hyperliquid.transactions
- table: hyperliquid.raw.transactions
- action:type = ‘twapOrder’
Twap Cancel
- Sources:
- datastream - topic: hyperliquid.transactions
- table: hyperliquid.raw.transactions
- action:type = ‘twapCancel’
Staking Activity
- Sources:
- datastream - topic: hyperliquid.misc_events
- table: hyperliquid.raw.misc_events
- look for
inner: { CDeposit
for deposits - look for
inner: { CWithdrawal
for withdrawals
Liquidations
There are two types of liquidations in hyperliquid.
Market Liquidations -> This is when Hyperliquid places an order to sell (for longs) and buy (for shorts) a user’s position on the market.
HLP Vault Liquidations -> This is a last effort, when the above Market Liquidations fails, ie due to lack of liquidity. In this case the HLP Vault acquires the position, and takes the loss (if any).
Market Liquidations
- datastream - topic: hyperliquid.fills
- table: hyperliquid.raw.fills
HLP Vault Liquidations
- datastream - topic: hyperliquid.misc_events
- table: hyperliquid.raw.misc_events