Allows to get historical TradingView chart data for specific token pair and period
Supported on: Ethereum Base BNB Chain Optimism Polygon Sonic Unichain Arbitrum Cronos Gnosis HyperEVM Arc Monad
Parameters
token0
* string pathBase token address
token1
* string pathQuote token address
seconds
* number (Enum)pathPeriod in seconds. Supported seconds: 300 ,900 ,3600 ,14400 ,86400 ,604800 ,2500000
chainId
* number (Enum)pathSupported chain: 1/56/137/42161/43114/100/10/8453/324/59144/146/130/4663/143/25/999/5042
toTimestamp
* number queryTo timestamp in seconds
fromTimestamp
* number queryFrom timestamp in seconds
orderBy
* string (Enum)queryOrder by timestamp
Request Body
This request doesn’t have any request body.
JavaScript
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const axios = require('axios');
async function httpCall() {
const url =
'https://api.1inch.com/charts/v1.0/chart/tradingview/{token0}/{token1}/{seconds}/{chainId}';
const config = {
headers: {
Authorization: `Bearer ${API_KEY}`,
},
params: {
toTimestamp: 1614556800,
fromTimestamp: 1612137600,
orderBy: 'asc',
},
paramsSerializer: {
indexes: null,
},
};
try {
const response = await axios.get(url, config);
console.log(response.data);
} catch (error) {
console.error(error);
}
}
Returns
data
* array TradingView candles array
items
TradingViewCandle object timestamp
* number Time in seconds
open
* number Candle open price
high
* number Candle high price
low
* number Candle low price
avg
* number Candle average price
close
* number Candle close price
volume0
* number Total swap volume of token0 across all pools and pairs within the candle, in token0 units. Volumes may lag real time, so the newest candles can temporarily show zero volume.
volume1
* number Total swap volume of token1 across all pools and pairs within the candle, in token1 units. Volumes may lag real time, so the newest candles can temporarily show zero volume.
swaps_count
* number Number of swap events touching either token of the pair within the candle
volume0_pair
* number Volume of direct token0 <-> token1 swaps within the candle, in token0 units. Multi-hop routes are not counted.
volume0_pair_buy
* number Buy side of the pair volume (swaps paying out token0), in token0 units
volume0_pair_sell
* number Sell side of the pair volume (swaps paying in token0), in token0 units
volume1_pair
* number Volume of direct token0 <-> token1 swaps within the candle, in token1 units. Multi-hop routes are not counted.
volume1_pair_buy
* number Buy side of the pair volume denominated in token1 units
volume1_pair_sell
* number Sell side of the pair volume denominated in token1 units
buys
* number Number of direct pair trades buying token0
sells
* number Number of direct pair trades selling token0
JSON
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{
"data": [
{
"timestamp": 1612137600,
"open": 164.16234062681954,
"high": 478.6617724313293,
"low": 164.16234062681954,
"avg": 210.87153123511283,
"close": 478.6617724313293,
"volume0": 254.53,
"volume1": 507431.96,
"swaps_count": 351,
"volume0_pair": 64.29,
"volume0_pair_buy": 40.68,
"volume0_pair_sell": 23.61,
"volume1_pair": 120549.38,
"volume1_pair_buy": 76280.16,
"volume1_pair_sell": 44269.22,
"buys": 32,
"sells": 35
}
]
}