DeFi API

V3 Depth Price History Chart#

Use this endpoint when you want to view the liquidity depth distribution or historical price trends of a V3 Pool. Pass in the investment product ID, chart type (depth chart or price history chart), and time range. Returns the corresponding depth/price data list for rendering liquidity distribution charts or price candlestick charts. Only applicable to V3 Pool type investment products.

URL: GET /api/v6/defi/product/depth-price/chart

Request Parameters#

FieldTypeRequiredDefaultExplanation
investmentIdStringYesInvestment product ID (integer string)
chartTypeStringNoDEPTHChart type: DEPTH=depth chart, PRICE=price history chart
timeRangeStringNoDAYOnly used when chartType=PRICE. Time range: DAY=24h, WEEK=1W

Request Examples#

Example 1: Query Depth Chart (default, last 24h)#

GET /api/v6/defi/product/depth-price/chart?investmentId=1589649169

Example 2: Query Price History Chart (last 1 week)#

GET /api/v6/defi/product/depth-price/chart?investmentId=1589649169&chartType=PRICE&timeRange=WEEK

Response Parameters#

Returns an Array, each element has the following structure:

FieldTypeExplanation
tickIntegerTick index (has value in depth chart, empty in price history chart)
liquidityStringLiquidity at this tick (has value in depth chart)
liquidityNetStringNet liquidity at this tick (has value in depth chart)
token0PriceStringDepth chart: token0 price at this tick; Price history chart: historical token0 price at this timestamp
token1PriceStringDepth chart: token1 price at this tick; Price history chart: historical token1 price at this timestamp
timestampLongTimestamp in milliseconds (only has value in price history chart)

Response Examples#

Depth Chart (chartType=DEPTH)#

Json
{
    "code": 0,
    "msg": "",
    "data": [
        {
            "tick": -32932,
            "liquidity": "1234567890123456",
            "liquidityNet": "500000000000000",
            "token0Price": "0.9985",
            "token1Price": "1.0015"
        },
        {
            "tick": -32931,
            "liquidity": "1234567890123456",
            "liquidityNet": "0",
            "token0Price": "0.9986",
            "token1Price": "1.0014"
        }
    ]
}

Price History Chart (chartType=PRICE)#

Json
{
    "code": 0,
    "msg": "",
    "data": [
        {
            "token0Price": "0.9985",
            "token1Price": "1.0015",
            "timestamp": 1741737600000
        },
        {
            "token0Price": "0.9990",
            "token1Price": "1.0010",
            "timestamp": 1741651200000
        }
    ]
}

Error Example: Non-V3 Pool Investment Product#

Json
{
    "code": 84032,
    "msg": "This api is only supported for V3 DEX Pool products",
    "data": null
}