Query Markets & Products
In this section, we'll be going over fetching:
State and config for all markets & products.
Latest market price for one product.
Market liquidity for one product (i.e. amount of liquidity at each price tick).
For all available queries, consult the API reference.
All Markets Query
The getAllEngineMarkets
function returns the state of all markets from the offchain sequencer.
You can use getAllMarkets
to query the data in the same way. This fetches the latest on-chain data from Arbitrum / Arbitrum Goerli.
Info
getAllEngineMarkets
is off-chain andgetAllMarkets
is on-chain.This means that
getAllEngineMarkets
has slightly better performanceThis means that
getAllMarkets
may reflect delayed data if a state change has not yet been propagated
Latest market price
The getLatestMarketPrice
function returns the market price data of a single product given by its product id.
Market liquidity
The getMarketLiquidity
function returns the available liquidity at each price tick. The number of price levels for each side of the book is given by depth
. For example, a depth of 2
will retrieve 2 levels of bids and 2 levels of asks. Price levels are separated by the priceIncrement
of the market, given by the getAllEngineMarkets
query.
Full example
Last updated