Query the Pool
The Pool shared object represents a market, such as a SUI/USDC market. That Pool is the only one representing that unique pairing (SUI/USDC) and the pairing is the only member of that particular Pool. See DeepBookV3 Design to learn more about the structure of pools.
To perform trades, you pass a BalanceManager and TradeProof into the relevant Pool. Unlike Pools, BalanceManager shared objects can contain any type of token, such that the same BalanceManager can access multiple Pools to interact with many different trade pairings. See BalanceManager to learn more.
API
DeepBookV3 exposes a set of endpoints that can be used to query any pool.
Check whitelist status
Accessor to check whether the pool is whitelisted.
packages/deepbook/sources/pool.move. You probably need to run `pnpm prebuild` and restart the site.Check quote quantity against base (DEEP fees)
Dry run to determine the quote quantity out for a given base quantity. Uses DEEP as fee.
packages/deepbook/sources/pool.move. You probably need to run `pnpm prebuild` and restart the site.Check base quantity against quote (DEEP fees)
Dry run to determine the base quantity out for a given quote quantity. Uses DEEP as fee.
packages/deepbook/sources/pool.move. You probably need to run `pnpm prebuild` and restart the site.Check quote quantity against base (input token fees)
Dry run to determine the quote quantity out for a given base quantity. Uses input token as fee.
packages/deepbook/sources/pool.move. You probably need to run `pnpm prebuild` and restart the site.Check base quantity against quote (input token fees)
Dry run to determine the base quantity out for a given quote quantity. Uses input token as fee.
packages/deepbook/sources/pool.move. You probably need to run `pnpm prebuild` and restart the site.Check quote quantity against quote or base
Dry run to determine the quantity out for a given base or quote quantity. Only one out of base or quote quantity should be non-zero. Returns the (base_quantity_out, quote_quantity_out, deep_quantity_required).
packages/deepbook/sources/pool.move. You probably need to run `pnpm prebuild` and restart the site.Check fee required
Returns the DEEP required for an order if it's a taker or maker given quantity and price (deep_required_taker, deep_required_maker).
packages/deepbook/sources/pool.move. You probably need to run `pnpm prebuild` and restart the site.Retrieve mid price for a pool
Returns the mid price of the pool.
packages/deepbook/sources/pool.move. You probably need to run `pnpm prebuild` and restart the site.Retrieve order IDs
Returns the order_id for all open orders for the balance_manager in the pool.
packages/deepbook/sources/pool.move. You probably need to run `pnpm prebuild` and restart the site.Retrieve prices and quantities for an order book
Returns vectors holding the prices (price_vec) and quantities (quantity_vec) for the level2 order book. The price_low and price_high are inclusive, all orders within the range are returned. is_bid is true for bids and false for asks.
packages/deepbook/sources/pool.move. You probably need to run `pnpm prebuild` and restart the site.Returns vectors holding the prices (price_vec) and quantities (quantity_vec) for the level2 order book. ticks are the maximum number of ticks to return starting from best bid and best ask. (bid_price, bid_quantity, ask_price, ask_quantity) are returned as four vectors. The price vectors are sorted in descending order for bids and ascending order for asks.
packages/deepbook/sources/pool.move. You probably need to run `pnpm prebuild` and restart the site.Retrieve balances
Get all balances held in this pool.
packages/deepbook/sources/pool.move. You probably need to run `pnpm prebuild` and restart the site.Retrieve pool ID
Get the ID of the pool given the asset types.
packages/deepbook/sources/pool.move. You probably need to run `pnpm prebuild` and restart the site.Retrieve order information
Returns the Order struct using the order ID.
packages/deepbook/sources/pool.move. You probably need to run `pnpm prebuild` and restart the site.Returns a vector of Order structs using a vector of order IDs.
packages/deepbook/sources/pool.move. You probably need to run `pnpm prebuild` and restart the site.Returns a vector of Order structs for all orders that belong to a BalanceManager in the pool.
packages/deepbook/sources/pool.move. You probably need to run `pnpm prebuild` and restart the site.Retrieve locked balance
Returns the locked balance for a BalanceManager in the pool (base_quantity, quote_quantity, deep_quantity).
packages/deepbook/sources/pool.move. You probably need to run `pnpm prebuild` and restart the site.Retrieve pool parameters
Returns the trade parameters for the pool (taker_fee, maker_fee, stake_required).
packages/deepbook/sources/pool.move. You probably need to run `pnpm prebuild` and restart the site.Returns the trade parameters for the next epoch for the currently leading proposal of the pool (taker_fee, maker_fee, stake_required).
packages/deepbook/sources/pool.move. You probably need to run `pnpm prebuild` and restart the site.Returns the quorum needed to pass proposal in the current epoch.
packages/deepbook/sources/pool.move. You probably need to run `pnpm prebuild` and restart the site.Returns the book parameters for the pool (tick_size, lot_size, min_size).
packages/deepbook/sources/pool.move. You probably need to run `pnpm prebuild` and restart the site.Returns the OrderDeepPrice struct for the pool, which determines the conversion for DEEP fees.
packages/deepbook/sources/pool.move. You probably need to run `pnpm prebuild` and restart the site.Related links
The DeepBookV3 repository on GitHub.