Get Detailed Pair Stats

Returns bucketed stats for a given token within a pair.

Endpoint: getDetailedPairStats

Method: POST

Arguments

NameTypeDescription
bucketCountInt

The number of aggregated values to receive. Note: Each duration has predetermined bucket sizes.
The first n-1 buckets are historical. The last bucket is a snapshot of current data.
duration day1: 6 buckets (4 hours each) plus 1 partial bucket
duration hour12: 12 buckets (1 hour each) plus 1 partial bucket
duration hour4: 8 buckets (30 min each) plus 1 partial bucket
duration hour1: 12 buckets (5 min each) plus 1 partial bucket
duration min5: 5 buckets (1 min each) plus 1 partial bucket
For example, requesting 11 buckets for a min5 duration will return the last 10 minutes worth of data plus a snapshot for the current minute.

durations[DetailedPairStatsDuration]

The list of durations to get detailed pair stats for.

networkIdInt!

The network ID the pair is deployed on.

Required
pairAddressString!

The contract address of the pair.

Required
statsTypeTokenPairStatisticsType

The type of statistics returned. Can be FILTERED or UNFILTERED

timestampInt

The unix timestamp for the stats. Defaults to current.

tokenOfInterestTokenOfInterest

The token of interest used to calculate token-specific stats for the pair. Can be token0 or token1.

Response

NameTypeDescription
bucketCountIntNumber of aggregated buckets specified in input
lastTransactionIntThe unix timestamp for the last transaction to happen on the pair.
networkIdInt!The network ID the pair is deployed on.
pairPair
pairAddressString!The contract address of the pair.
queryTimestampIntThe timestamp specified as input to the query
stats_day1WindowedDetailedPairStatsThe breakdown of stats over a 24 hour window.
stats_day30WindowedDetailedPairStatsThe breakdown of stats over a 30 day window.
stats_hour1WindowedDetailedPairStatsThe breakdown of stats over an hour window.
stats_hour4WindowedDetailedPairStatsThe breakdown of stats over a 4 hour window.
stats_hour12WindowedDetailedPairStatsThe breakdown of stats over a 12 hour window.
stats_min5WindowedDetailedPairStatsThe breakdown of stats over a 5 minute window.
stats_min15WindowedDetailedPairStatsThe breakdown of stats over a 15 minute window.
stats_week1WindowedDetailedPairStatsThe breakdown of stats over a 7 day window.
statsTypeTokenPairStatisticsType!The type of statistics returned. Can be FILTERED or UNFILTERED
tokenOfInterestTokenOfInterestThe token of interest used to calculate token-specific stats.

Picking Duration

The duration chosen as input for the query will be used in the following ways:

  • Provides the currentValue, previousValue, and percent change between the two.
  • Determines the bucket size and default bucketCount (the number of buckets per window) that will be returned.

Buckets Explained

DurationBucket SizeDefault bucketCount
5 minutes1 minute5 + 1 = 6
15 minutes1 minute15 + 1 = 16
1 hour5 minutes12 + 1 = 13
4 hours30 minutes8 + 1 = 9
12 hours1 hour12 + 1 = 13
1 day4 hours6 + 1 = 7
1 week12 hours14 + 1 = 15
30 days1 day30 + 1 = 31

Bucket sizes are predetermined for each duration. The first n-1 buckets are always historical, while the last bucket is a snapshot of current data. Defaults for bucketCount are displayed above, but can be overridden by query input to receive more or less aggregated values.

For example, requesting a min5 duration with a bucketCount of 11 at 12:00:30PM will return

  • aggregated stats and the percent change between
    • the most current 5 minute window (11:55AM-12:00PM),
    • the previous 5 minute window (11:50AM-11:55AM).
  • 10 completed aggregated stats for each minute over those 10 minutes (11:50AM-11:51AM ... 11:59AM-12:00PM) plus 1 partial snapshot of stats for the current minute (12:00:00PM-12:00:30PM).
    • the first 5 stats will add up to the previousValue,
    • the second 5 stats will add up to the currentValue.
This endpoint can be seen in action on Defined's [pair](https://www.defined.fi/arb/0xc31e54c7a869b9fcbecc14363cf510d1c41fa443?quoteToken=token0) page under the Stats tab. Hover along the line graph to get the value for each 1 minute bucket.

This endpoint can be seen in action on Defined's pair page under the Stats tab. Hover along the line graph to get the value for each 1 minute bucket.

Explore

πŸ‘‹

Join our Discord

Ask questions, share what you're working on and request new features :two-men-holding-hands::two-women-holding-hands: