Skip to main content

Module analytics

Module analytics 

Source
Expand description

DEX analytics utilities.

Builds synthetic order books from DexScreener liquidity data for Ethereum and Solana DEX venues (#37).

With the pool’s base reserve x0 and price P0, a constant-product pool (x·y=k) holds x(P) = x0·√(P0/P) base at price P. One level is placed at each price step; its quantity is the base the pool buys (bids) or sells (asks) between two steps. Without the reserve, the old single-level estimate is kept and marked as such.

Constants§

DEX_BOOK_QUOTE
Quote of a synthetic DEX book. Its prices are the pool’s USD price (DexPair::price_usd), whatever token the pool pairs with.
MAX_AMM_LEVELS
The most levels per side of a synthetic AMM book. It bounds the work for a very small step or a very wide band.

Functions§

order_book_from_analytics
Builds a synthetic order book from a DEX pair.