Trading Volume Endpoints

Current

The volume endpoint,

/v1/tokens/<chain id>/<token address>/volume

returns the trade volume of a token over a period of time. ⚠️ This is DeFi trade volume as we have no visibility into centralized exchanges.

You will find the formal API definition here.

The Scaling section should be consulted to understand the optional scaled parameter.

The Historical Data section should be consulted to understand the meaning of start and end parameters.

Given the following call:

curl -X 'GET' \
-H 'Authorization: Bearer <API KEY>' \
'https://gateway.credmark.com/v1/tokens/1/0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9/volume?scaled=true&startBlockNumber=17000000&endBlockNumber=17000500' \

in which we retrieve the traded volume between blocks 17000000 and 17000500, the endpoint returns:

{
  "chainId": 1,
  "startBlockNumber": 17000000,
  "endBlockNumber": 17000500,
  "startTimestamp": 1680911891,
  "endTimestamp": 1680917999,
  "tokenAddress": "0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9",
  "scaled": true,
  "volume": 28341.124337106903
}

Historical

The price/historical endpoint,

/v1/tokens/<chain id>/<token address>/volume/historical

returns a list of trade volumes over time for a token.

The list start and end, as well as periodicity arguments are described in the Historical Data section. ⚠️ Note that typical historical functions divide the time period up and return data for each point implied by start, end, and interval. In this case, start, end, and interval are used to construct segments. The reported volume is for the entire period designated for the segment.

Given the following call:

curl -X 'GET' \
-H 'Authorization: Bearer <API KEY>' \
'https://gateway.credmark.com/v1/tokens/1/0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9/volume/historical?scaled=true&startBlockNumber=17000000&endBlockNumber=17000500&blockInterval=100' \

in which we retrieve the traded volume for 5 intervals between blocks 17000000 and 17000500, the endpoint returns:

{
  "chainId": 1,
  "startBlockNumber": 17000000,
  "endBlockNumber": 17000500,
  "startTimestamp": 1680911891,
  "endTimestamp": 1680917999,
  "tokenAddress": "0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9",
  "scaled": true,
  "data": [
    {
      "startBlockNumber": 17000001,
      "startTimestamp": 1680911903,
      "endBlockNumber": 17000100,
      "endTimestamp": 1680913127,
      "volume": 25184.110194312245
    },
    {
      "startBlockNumber": 17000101,
      "startTimestamp": 1680913139,
      "endBlockNumber": 17000200,
      "endTimestamp": 1680914351,
      "volume": 417.19228833533765
    },
    {
      "startBlockNumber": 17000201,
      "startTimestamp": 1680914363,
      "endBlockNumber": 17000300,
      "endTimestamp": 1680915587,
      "volume": 70.0715240885528
    },
    {
      "startBlockNumber": 17000301,
      "startTimestamp": 1680915599,
      "endBlockNumber": 17000400,
      "endTimestamp": 1680916787,
      "volume": 2483.0220726195107
    },
    {
      "startBlockNumber": 17000401,
      "startTimestamp": 1680916799,
      "endBlockNumber": 17000500,
      "endTimestamp": 1680917999,
      "volume": 186.72825775125887
    }
  ]
}

Last updated