Our pricing system can be broken down into two major components:
- Pricing Discovery (asynchronous process)
- Price Fetching (real-time)
When a token that hasn't been priced before is requested via the API (that is, a token address for a particular chain that the system hasn't priced before), it gets put into a discovery queue.
The discovery algorithm will find the best pricing solution depending on the strategy requested by the client. If, for example, the strategy requested is dexHighestLiquidity
, then the discovery algorithm will iterate through all known DEXes and liquidity pools in that chain, until it finds the liquidity pool where the token in question trades, and with the highest liquidity.
In general, when we say "highest liquidity", we mean so in dollar terms.
Once a solution has been found for a particular token, subsequent requests to price that token will be processed in real-time.
We currently support the following pricing strategies:
- DEX Highest Liquidity
- The algorithm here is to find the liquidity pool with most liquidity (in $ terms) where the token that needs to be priced is included. This can be either a "traditional" 2-token pool, or can be a multi-token pool.