Mobula Docs
Search…
⌃K

Dynamic API - Installation

Mobula's protocol data are available to builders through several APIs. The Dynamic API allows you get the liquidity, volume and price for the assets. Here is a little overview of the methods we're using. Mobula's APIs are extremely simple to integrate.

Request Dynamic API access

To obtain access to Mobula Dynamic API, simply fill out the form https://form.typeform.com/to/o8JAVzDV
If you have any questions or need any help, do not hesitate to DM us.

History data

Liquidity:

Subgraph supports tokenDayData (all but PancakeSwap)

  • Query tokenDayData (dailyLiquidityQuery) (last 1000 days)
  • It returns an amount in USD

Subgraph does not tokenDayData

  • Iterating pairDayData (dailyLiquidityQuery) (last 1000 days) with the 3 most liquid pairs
  • It returns an amount in USD, that we sum up.

Volume:

Subgraph supports tokenDayData (all but PancakeSwap)

  • Query tokenDayData (dailyVolumeQuery) (last 1000 days)
  • It returns an amount in USD

Subgraph does not tokenDayData

  • Iterating pairDayData (dailyVolumeQuery) (last 1000 days) with the 3 most liquid pairs
  • It returns an amount in USD, that we sum up.

Price:

Subgraph supports tokenDayData (all but PancakeSwap)

  • Query tokenDayData (priceUSD) (last 1000 days)
  • It returns an amount in USD
  • When formatting, we take liquidity * price / total liquidity

Subgraph does not tokenDayData

  • Iterating pairDayData (reserveUSD) (last 1000 days) with the 3 most liquid pairs
  • It returns the total liquidity amount in USD, and we find the price of the token (if token is token0) by (reserveUSD / 2) / reserve0 .

Recent data

Liquidity:

Subgraph supports tokenDayData (all but PancakeSwap)

  • Query Token object, with block time-travel (liquidityQuery) (last 8 days)
  • It returns an amount in token

Subgraph does not tokenDayData

  • Iterating Pair (reserve0 or reserve1) (last 8 days) with the 3 most liquid pairs
  • It returns the total liquidity amount in token
  • We multiply that amount by the price of the token to find liquidity in USD.

Total volume:

Subgraph supports tokenDayData (all but PancakeSwap)

  • Query Token object, with block time-travel (totalVolumeQuery) (last 8 days)
  • It returns the Total volume amount in USD

Subgraph does not tokenDayData

  • Same logic (in the first formatting, the push to recent, we get the Token equivalent of the block when iterating the pairs to format total volume without friction)

Volume:

  • We use Total volume USD, we take actualTokenTotalVolume - 24hOldTokenTotalVolume.

Price:

Subgraph returns derivedETH

  • We get ethPrice from Bundle and we multiply it by derivedETH

Subgraph returns 0

  • We query Etherem/Token pair to get derivedETH with reserve1 / reserve0 we multiply it by ethPrice