Live-streamed bar chart data to track token price changes over time.
This endpoint is available on Codex Growth and Enterprise Plans
Endpoint: onBarsUpdated
Method: POST
Arguments
Name | Type | Description |
---|---|---|
pairId | String | The ID of the pair ( |
quoteToken | QuoteToken | The token of interest within the pair. Can be |
Response
Name | Type | Description |
---|---|---|
aggregates | ResolutionBarData! | Price data broken down by resolution. |
eventSortKey | String! | The sortKey for the bar (blockNumber #transactionIndex #logIndex , zero padded).For example, 0000000016414564#00000224#00000413 . |
networkId | Int! | The network ID the pair is deployed on. |
pairAddress | String! | The contract address for the pair. |
pairId | String! | The ID for the pair (pairAddress :networkId ). |
quoteToken | QuoteToken | The quote token within the pair. |
statsType | TokenPairStatisticsType! | The type of statistics used. Can be Filtered or Unfiltered . |
timestamp | Int! | 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"
}
}
}
}
Ask questions, share what you're working on and request new features 👬👭