Token Chart Data

Live-streamed bar chart data to track token price changes over time.

ℹ️

This endpoint is available on Defined Growth and Enterprise Plans

Endpoint: onBarsUpdated

Method: POST

Arguments

NameTypeDescription
pairIdString

The ID of the pair (address:networkId).

quoteTokenQuoteToken

The token of interest within the pair. Can be token0 or token1.

Response

NameTypeDescription
aggregatesResolutionBarData!Price data broken down by resolution.
eventSortKeyString!The sortKey for the bar (blockNumber#transactionIndex#logIndex, zero padded).
For example, 0000000016414564#00000224#00000413.
networkIdInt!The network ID the pair is deployed on.
pairAddressString!The contract address for the pair.
pairIdString!The ID for the pair (pairAddress:networkId).
quoteTokenQuoteTokenThe quote token within the pair.
statsTypeTokenPairStatisticsType!The type of statistics used. Can be Filtered or Unfiltered.
timestampInt!The unix timestamp for the new bar.

πŸ“˜

O, H, L, C, V, T, and S are in their abbreviated format so that you can easily insert the data into the TradingView charting library.

πŸ‘¨β€πŸ’» Example

Query

subscription OnBarsUpdated($pairId: String) {
  onBarsUpdated(pairId: $pairId, quoteToken: token1) {
    eventSortKey
    networkId
    pairAddress
    pairId
    timestamp
    quoteToken
    aggregates {
    r1 {
      t
      usd {
        t
        o
        h
        l
        c
        volume
      }
      token {
        t
        o
        h
        l
        c
        volume
      }
    }
    r5 {
      t
      usd {
        t
        o
        h
        l
        c
        volume
      }
      token {
        t
        o
        h
        l
        c
        volume
      }
    }
    r15 {
      t
      usd {
        t
        o
        h
        l
        c
        volume
      }
      token {
        t
        o
        h
        l
        c
        volume
      }
    }
    r30 {
      t
      usd {
        t
        o
        h
        l
        c
        volume
      }
      token {
        t
        o
        h
        l
        c
        volume
      }
    }
    r60 {
      t
      usd {
        t
        o
        h
        l
        c
        volume
      }
      token {
        t
        o
        h
        l
        c
        volume
      }
    }
    r240 {
      t
      usd {
        t
        o
        h
        l
        c
        volume
      }
      token {
        t
        o
        h
        l
        c
        volume
      }
    }
    r720 {
      t
      usd {
        t
        o
        h
        l
        c
        volume
      }
      token {
        t
        o
        h
        l
        c
        volume
      }
    }
    r1D {
      t
      usd {
        t
        o
        h
        l
        c
        volume
      }
      token {
        t
        o
        h
        l
        c
        volume
      }
    }
    r7D {
      t
      usd {
        t
        o
        h
        l
        c
        volume
      }
      token {
        t
        o
        h
        l
        c
        volume
      }
    }
  }
}

Response

{
  "id": "77a14156-faae-4944-8f3d-9067606c815e",
  "type": "data",
  "payload": {
    "data": {
      "onUpdateAggregateBatch": {
        "eventSortKey": "0000000026839632#00000055#00000161",
        "networkId": 56,
        "pairAddress": "0x16b9a82891338f9ba80e2d6970fdda79d1eb0dae",
        "pairId": "0x16b9a82891338f9ba80e2d6970fdda79d1eb0dae:56",
        "timestamp": 1679955077,
        "quoteToken": "token1",
        "aggregates": {
          "r1": {
            "t": 1679955060,
            "usd": {
              "t": 1679955060,
              "o": 307.8663811197661,
              "h": 307.87212151226925,
              "l": 307.8559486544298,
              "c": 307.8559486544298,
              "volume": "3101.6014653402",
              "__typename": "IndividualBarData"
            },
            "token": {
              "t": 1679955060,
              "o": 307.8663811197661,
              "h": 307.87212151226925,
              "l": 307.8559486544298,
              "c": 307.8559486544298,
              "volume": "3101.6014653402",
              "__typename": "IndividualBarData"
            },
            "__typename": "CurrencyBarData"
          },
          "r5": {
            "t": 1679955000,
            "usd": {
              "t": 1679955000,
              "o": 307.903985155485,
              "h": 307.9041357199035,
              "l": 307.8559486544298,
              "c": 307.8559486544298,
              "volume": "9735.5396260502",
              "__typename": "IndividualBarData"
            },
            "token": {
              "t": 1679955000,
              "o": 307.903985155485,
              "h": 307.9041357199035,
              "l": 307.8559486544298,
              "c": 307.8559486544298,
              "volume": "9735.5396260502",
              "__typename": "IndividualBarData"
            },
            "__typename": "CurrencyBarData"
          },
          "r15": {
            "t": 1679954400,
            "usd": {
              "t": 1679954400,
              "o": 307.8477904861367,
              "h": 307.929380892052,
              "l": 307.81786536263485,
              "c": 307.8559486544298,
              "volume": "61896.4686937702",
              "__typename": "IndividualBarData"
            },
            "token": {
              "t": 1679954400,
              "o": 307.8477904861367,
              "h": 307.929380892052,
              "l": 307.81786536263485,
              "c": 307.8559486544298,
              "volume": "61896.4686937702",
              "__typename": "IndividualBarData"
            },
            "__typename": "CurrencyBarData"
          },
          "r30": {
            "t": 1679954400,
            "usd": {
              "t": 1679954400,
              "o": 307.8477904861367,
              "h": 307.929380892052,
              "l": 307.81786536263485,
              "c": 307.8559486544298,
              "volume": "61896.4686937702",
              "__typename": "IndividualBarData"
            },
            "token": {
              "t": 1679954400,
              "o": 307.8477904861367,
              "h": 307.929380892052,
              "l": 307.81786536263485,
              "c": 307.8559486544298,
              "volume": "61896.4686937702",
              "__typename": "IndividualBarData"
            },
            "__typename": "CurrencyBarData"
          },
          "r60": {
            "t": 1679954400,
            "usd": {
              "t": 1679954400,
              "o": 307.8477904861367,
              "h": 307.929380892052,
              "l": 307.81786536263485,
              "c": 307.8559486544298,
              "volume": "61896.4686937702",
              "__typename": "IndividualBarData"
            },
            "token": {
              "t": 1679954400,
              "o": 307.8477904861367,
              "h": 307.929380892052,
              "l": 307.81786536263485,
              "c": 307.8559486544298,
              "volume": "61896.4686937702",
              "__typename": "IndividualBarData"
            },
            "__typename": "CurrencyBarData"
          },
          "r240": {
            "t": 1679947200,
            "usd": {
              "t": 1679947200,
              "o": 306.98002474715656,
              "h": 307.929380892052,
              "l": 306.61552873861007,
              "c": 307.8559486544298,
              "volume": "1075228.7769214702",
              "__typename": "IndividualBarData"
            },
            "token": {
              "t": 1679947200,
              "o": 306.98002474715656,
              "h": 307.929380892052,
              "l": 306.61552873861007,
              "c": 307.8559486544298,
              "volume": "1075228.7769214702",
              "__typename": "IndividualBarData"
            },
            "__typename": "CurrencyBarData"
          },
          "r720": {
            "t": 1679918400,
            "usd": {
              "t": 1679918400,
              "o": 328.57274566358774,
              "h": 329.14889651661645,
              "l": 306.61552873861007,
              "c": 307.8559486544298,
              "volume": "15546692.7166114702",
              "__typename": "IndividualBarData"
            },
            "token": {
              "t": 1679918400,
              "o": 328.57274566358774,
              "h": 329.14889651661645,
              "l": 306.61552873861007,
              "c": 307.8559486544298,
              "volume": "15546692.7166114702",
              "__typename": "IndividualBarData"
            },
            "__typename": "CurrencyBarData"
          },
          "r1D": {
            "t": 1679875200,
            "usd": {
              "t": 1679875200,
              "o": 328.47580794284136,
              "h": 329.14889651661645,
              "l": 306.61552873861007,
              "c": 307.8559486544298,
              "volume": "20268329.5738114702",
              "__typename": "IndividualBarData"
            },
            "token": {
              "t": 1679875200,
              "o": 328.47580794284136,
              "h": 329.14889651661645,
              "l": 306.61552873861007,
              "c": 307.8559486544298,
              "volume": "20268329.5738114702",
              "__typename": "IndividualBarData"
            },
            "__typename": "CurrencyBarData"
          },
          "r7D": {
            "t": 1679529600,
            "usd": {
              "t": 1679529600,
              "o": 321.50096944960103,
              "h": 331.1824744296178,
              "l": 306.61552873861007,
              "c": 307.8559486544298,
              "volume": "77769509.0406114702",
              "__typename": "IndividualBarData"
            },
            "token": {
              "t": 1679529600,
              "o": 321.50096944960103,
              "h": 331.1824744296178,
              "l": 306.61552873861007,
              "c": 307.8559486544298,
              "volume": "77769509.0406114702",
              "__typename": "IndividualBarData"
            },
            "__typename": "CurrencyBarData"
          },
          "__typename": "ResolutionBarData"
        },
        "__typename": "UpdateAggregateBatchResponse"
      }
    }
  }
}

πŸ‘‹

Join our Discord

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