API Reference

Return historical DEX Pool Total Value Locked (TVL) and Liquidity Information.

Method: GET

Endpoint: https://api.syve.ai/v1/market-api/historical-pool-tvl

Request Parameters

NameType(s)Description
pool_addressstring, requiredThe DEX pool address or list addresses for which to return TVL and liquidity information for.

If making a GET request use a comma separated list to provide the list of addresses. If POST use a list in the request body.

This is a required parameter.
price_typestring, requiredThis parameter determines what price type to use when calculating dollar values in the response.

The default is price_token_usd_robust_tick_1. All possible options for price_type are given in the table below.
intervalstringDetermines the granularity of the data.

The format should be <value><freq>, where freq can be, "m" (minutes), "h" (hours), or "d" (days).

For example, "10m" would represent a 10-minute interval, and "1d" would represent a 1-day interval. The default value is "1d" (1 day).
from_timestampintegerReturn results whose timestamp are greater than or equal to the provided value.

Default: 0.
until_timestampintegerReturn results whose timestamp are less than or equal to the provided value.

Default: The current timestamp (at the time the request is made).
max_sizeintegerThe maximum number of records to return.

Must be between 1 and 2500. Default is 100.
orderstringThe order in which data is returned. Valid options are desc and asc.

If desc more recent data is returned first. If asc older data is returned first.

Default: desc.

📘

Possible Price Types

The possible price types correspond to the prices returned by our DEX Trades table. Each price type corresponds to a different method of calculating price.

Price TypeDescription
price_token_usd_tick_1The price at which a token was traded based on the most recent swap.
price_token_usd_robust_tick_1The same as price_token_usd_tick_1 but with significant outliers removed.
price_token_usd_robust_total_{1h|24h}This provides the total price, in USD, based on both buy and sell trades executed in the last 1 or 24 hour(s).
price_token_usd_robust_buy_{1h|24h}This metric gives the total price, in USD, based solely on buy trades that have occurred in the last 1 or 24 hour(s).
price_token_usd_robust_sell_{1h|24}This shows the total price, in USD, accumulated from all sell trades in the last 1 or 24 hour(s).
price_token_usd_robust_mid_{1h|24h}The mid price is the average of the buy price and the sell price.

Response Fields

NameTypeDescription
pool_addressintegerThe block number (i.e. height) of the event log.
token_0_addressstringThe address of the first token that makes up the pool.
token_1_addressstringThe address of the second token that makes up the pool.
timestampstringThe time in Unix timestamp format.
datestringThe time in ISO 8601 format.
token_0_balancedoubleThe total amount of the first token in the pool.
token_1_balancedoubleThe total amount of the second token in the pool.
token_0_balance_usddoubleThe value (in dollars) of the total amount of the first token in the pool.
token_1_balance_usddoubleThe value (in dollars) of the total amount of the second token in the pool.
liquidity_usddoubleThe USD value of the amount of WETH or stable coin that is in the pool.
tvl_usddoubleThe total dollar value locked in the pool. This equals to the token_0_balance_usd plus token_1_balance_usd.

Example: Hourly TVL and liquidity of $WBTC

📘

Try it out

In the Live Example section you can try out the request with different arguments.

Query

In the request below 0x4585fe77225b41b697c938b018e2ac67ac5a20c0 is the $WETH DEX pool address of $WBTC.

Example GET Request

Request: https://api.syve.ai/v1/market-api/historical-pool-tvl?pool_address=0x4585fe77225b41b697c938b018e2ac67ac5a20c0&interval=1h&order=desc&max_size=2

Response

{
    "pool_address": "0x4585fe77225b41b697c938b018e2ac67ac5a20c0",
    "token_0_address": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599",
    "token_1_address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
    "data": [
        {
            "timestamp": 1704823200,
            "date": "2024-01-09T18:00:00Z",
            "token_0_balance": 108.455988,
            "token_1_balance": 25902.525828178852,
            "token_0_balance_usd": 5066969.015229834,
            "token_1_balance_usd": 58679943.07389786,
            "liquidity_usd": 58679943.07389786,
            "tvl_usd": 63746912.0891277
        },
        {
            "timestamp": 1704819600,
            "date": "2024-01-09T17:00:00Z",
            "token_0_balance": 102.07143072,
            "token_1_balance": 26031.447794555592,
            "token_0_balance_usd": 4790895.769629918,
            "token_1_balance_usd": 58967636.98637878,
            "liquidity_usd": 58967636.98637878,
            "tvl_usd": 63758532.7560087
        }
    ]
}

Live Example

Press Try It to make a request and see what the response looks like. Feel free to try different query parameters.

Language
Click Try It! to start a request and see the response here!