OHLCV (Token)
This endpoint retrieves OHLCV (Open, High, Low, Close, Volume) candles for an EVM token, computed from Base Uniswap v3-style swap data. Candles are available at intervals from 1 minute to 1 week, and an optional consensus filter can be applied to reduce noisy data.
GET
https://api.cambrian.org/evm/ohlcv/token
Parameters
chain_id (integer)
EVM chain ID.
token_address* (string)
after_time* (integer)
Unix timestamp (in seconds) after which to retrieve OHLCV data.
before_time* (integer)
Unix timestamp (in seconds) before which to retrieve OHLCV data.
interval* (string)
use_filter* (boolean)
Whether to use the RWM7+pool consensus filter for the OHLCV query.
limit (integer)
Limit the number of results.
offset (integer)
Offset the results, allows you to skip a number of rows before starting to return rows.
Responses
Code
Description
200
Successful response
Media type: application/vnd.cambrian.table.v1.0.0+json
[
{
"columns": [
{
"name": "chainId",
"type": "UInt16"
},
{
"name": "openPriceUsd",
"type": "Float32"
},
{
"name": "highPriceUsd",
"type": "Float32"
},
{
"name": "lowPriceUsd",
"type": "Float32"
},
{
"name": "closePriceUsd",
"type": "Float32"
},
{
"name": "volumeBoughtUsd",
"type": "Float64"
},
{
"name": "volumeSoldUsd",
"type": "Float64"
},
{
"name": "volumeBoughtToken",
"type": "Float64"
},
{
"name": "volumeSoldToken",
"type": "Float64"
},
{
"name": "unixTime",
"type": "UInt32"
},
{
"name": "interval",
"type": "String"
},
{
"name": "tokenAddress",
"type": "FixedString(42)"
}
],
"data": [
[
8453,
3330.990478515625,
3364.1650390625,
3329.244873046875,
3355.182373046875,
11671535.248008711,
5507519.430472437,
3488.2146569223637,
1646.954404558065,
1735689600,
"1h",
"0x4200000000000000000000000000000000000006"
],
[
8453,
3357.3486328125,
3365.47119140625,
3335.1826171875,
3339.875,
6751136.450000179,
10180055.82014424,
2015.1833968635947,
3041.051452456663,
1735693200,
"1h",
"0x4200000000000000000000000000000000000006"
],
[
8453,
3338.6494140625,
3363.337158203125,
3337.80517578125,
3354.95263671875,
9739772.744918142,
7228014.350250291,
2908.0411885952317,
2159.3021282572067,
1735696800,
"1h",
"0x4200000000000000000000000000000000000006"
],
[
8453,
3354.678466796875,
3360.015380859375,
3339.6748046875,
3348.86181640625,
6269153.96153974,
7260200.927784716,
1870.8947318233345,
2167.935624969013,
1735700400,
"1h",
"0x4200000000000000000000000000000000000006"
],
[
8453,
3348.94580078125,
3353.947021484375,
3331.03076171875,
3334.624267578125,
5133926.383942099,
8521547.333653519,
1536.0399937461798,
2551.3398254204767,
1735704000,
"1h",
"0x4200000000000000000000000000000000000006"
],
[
8453,
3333.260009765625,
3349.83251953125,
3331.072509765625,
3338.666259765625,
5074005.124108528,
4045804.8826495465,
1519.4843246643168,
1212.2628352951108,
1735707600,
"1h",
"0x4200000000000000000000000000000000000006"
],
[
8453,
3338.902099609375,
3344.451904296875,
3326.92626953125,
3336.0771484375,
5410414.438194079,
6205576.359512242,
1621.5214982189252,
1861.1007649527567,
1735711200,
"1h",
"0x4200000000000000000000000000000000000006"
],
[
8453,
3336.07666015625,
3345.383544921875,
3328.646240234375,
3339.3974609375,
4472285.575046726,
4182876.031031919,
1340.1214673358313,
1254.3106417491688,
1735714800,
"1h",
"0x4200000000000000000000000000000000000006"
],
[
8453,
3339.83447265625,
3347.17724609375,
3323.121337890625,
3331.64501953125,
6016235.769028442,
7807414.169115474,
1804.5203262579714,
2342.917232980187,
1735718400,
"1h",
"0x4200000000000000000000000000000000000006"
],
[
8453,
3328.861083984375,
3338.7724609375,
3305.47998046875,
3327.57763671875,
9600376.976409936,
10962750.725147905,
2890.67762941904,
3302.515419442688,
1735722000,
"1h",
"0x4200000000000000000000000000000000000006"
]
],
"rows": 10
}
]
400
Bad Request: Invalid request parameters or malformed request.
401
Unauthorized: Missing or invalid API key. Include X-API-Key header with your request.
403
Forbidden: Invalid API key or insufficient permissions to access this resource.
404
Not Found: Endpoint or resource does not exist.
408
Request Timeout: Request took too long to process. Try again.
500
Internal Server Error: An unexpected error occurred while processing your request.
503
Service Unavailable: The server is temporarily unable to handle the request. Please try again later.
Examples
1. Retrieve hourly OHLCV candles for WETH on Base
This fetches 1-hour OHLCV candles for the WETH token on Base (chain ID 8453) between two Unix timestamps, using the consensus filter.
curl
curl -X GET "https://api.cambrian.org/evm/ohlcv/token?token_address=0x4200000000000000000000000000000000000006&after_time=1735689600&before_time=1735776000&interval=1h&use_filter=true&limit=10" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json"
Response:
JSON
1[
2 {
3 "columns": [
4 {
5 "name": "chainId",
6 "type": "UInt16"
7 },
8 {
9 "name": "openPriceUsd",
10 "type": "Float32"
11 },
12 {
13 "name": "highPriceUsd",
14 "type": "Float32"
15 },
16 {
17 "name": "lowPriceUsd",
18 "type": "Float32"
19 },
20 {
21 "name": "closePriceUsd",
22 "type": "Float32"
23 },
24 {
25 "name": "volumeBoughtUsd",
26 "type": "Float64"
27 },
28 {
29 "name": "volumeSoldUsd",
30 "type": "Float64"
31 },
32 {
33 "name": "volumeBoughtToken",
34 "type": "Float64"
35 },
36 {
37 "name": "volumeSoldToken",
38 "type": "Float64"
39 },
40 {
41 "name": "unixTime",
42 "type": "UInt32"
43 },
44 {
45 "name": "interval",
46 "type": "String"
47 },
48 {
49 "name": "tokenAddress",
50 "type": "FixedString(42)"
51 }
52 ],
53 "data": [
54 [
55 8453,
56 3330.990478515625,
57 3364.1650390625,
58 3329.244873046875,
59 3355.182373046875,
60 11671535.248008711,
61 5507519.430472437,
62 3488.2146569223637,
63 1646.954404558065,
64 1735689600,
65 "1h",
66 "0x4200000000000000000000000000000000000006"
67 ],
68 [
69 8453,
70 3357.3486328125,
71 3365.47119140625,
72 3335.1826171875,
73 3339.875,
74 6751136.450000179,
75 10180055.82014424,
76 2015.1833968635947,
77 3041.051452456663,
78 1735693200,
79 "1h",
80 "0x4200000000000000000000000000000000000006"
81 ],
82 [
83 8453,
84 3338.6494140625,
85 3363.337158203125,
86 3337.80517578125,
87 3354.95263671875,
88 9739772.744918142,
89 7228014.350250291,
90 2908.0411885952317,
91 2159.3021282572067,
92 1735696800,
93 "1h",
94 "0x4200000000000000000000000000000000000006"
95 ],
96 [
97 8453,
98 3354.678466796875,
99 3360.015380859375,
100 3339.6748046875,
101 3348.86181640625,
102 6269153.96153974,
103 7260200.927784716,
104 1870.8947318233345,
105 2167.935624969013,
106 1735700400,
107 "1h",
108 "0x4200000000000000000000000000000000000006"
109 ],
110 [
111 8453,
112 3348.94580078125,
113 3353.947021484375,
114 3331.03076171875,
115 3334.624267578125,
116 5133926.383942099,
117 8521547.333653519,
118 1536.0399937461798,
119 2551.3398254204767,
120 1735704000,
121 "1h",
122 "0x4200000000000000000000000000000000000006"
123 ],
124 [
125 8453,
126 3333.260009765625,
127 3349.83251953125,
128 3331.072509765625,
129 3338.666259765625,
130 5074005.124108528,
131 4045804.8826495465,
132 1519.4843246643168,
133 1212.2628352951108,
134 1735707600,
135 "1h",
136 "0x4200000000000000000000000000000000000006"
137 ],
138 [
139 8453,
140 3338.902099609375,
141 3344.451904296875,
142 3326.92626953125,
143 3336.0771484375,
144 5410414.438194079,
145 6205576.359512242,
146 1621.5214982189252,
147 1861.1007649527567,
148 1735711200,
149 "1h",
150 "0x4200000000000000000000000000000000000006"
151 ],
152 [
153 8453,
154 3336.07666015625,
155 3345.383544921875,
156 3328.646240234375,
157 3339.3974609375,
158 4472285.575046726,
159 4182876.031031919,
160 1340.1214673358313,
161 1254.3106417491688,
162 1735714800,
163 "1h",
164 "0x4200000000000000000000000000000000000006"
165 ],
166 [
167 8453,
168 3339.83447265625,
169 3347.17724609375,
170 3323.121337890625,
171 3331.64501953125,
172 6016235.769028442,
173 7807414.169115474,
174 1804.5203262579714,
175 2342.917232980187,
176 1735718400,
177 "1h",
178 "0x4200000000000000000000000000000000000006"
179 ],
180 [
181 8453,
182 3328.861083984375,
183 3338.7724609375,
184 3305.47998046875,
185 3327.57763671875,
186 9600376.976409936,
187 10962750.725147905,
188 2890.67762941904,
189 3302.515419442688,
190 1735722000,
191 "1h",
192 "0x4200000000000000000000000000000000000006"
193 ]
194 ],
195 "rows": 10
196 }
197]
2 {
3 "columns": [
4 {
5 "name": "chainId",
6 "type": "UInt16"
7 },
8 {
9 "name": "openPriceUsd",
10 "type": "Float32"
11 },
12 {
13 "name": "highPriceUsd",
14 "type": "Float32"
15 },
16 {
17 "name": "lowPriceUsd",
18 "type": "Float32"
19 },
20 {
21 "name": "closePriceUsd",
22 "type": "Float32"
23 },
24 {
25 "name": "volumeBoughtUsd",
26 "type": "Float64"
27 },
28 {
29 "name": "volumeSoldUsd",
30 "type": "Float64"
31 },
32 {
33 "name": "volumeBoughtToken",
34 "type": "Float64"
35 },
36 {
37 "name": "volumeSoldToken",
38 "type": "Float64"
39 },
40 {
41 "name": "unixTime",
42 "type": "UInt32"
43 },
44 {
45 "name": "interval",
46 "type": "String"
47 },
48 {
49 "name": "tokenAddress",
50 "type": "FixedString(42)"
51 }
52 ],
53 "data": [
54 [
55 8453,
56 3330.990478515625,
57 3364.1650390625,
58 3329.244873046875,
59 3355.182373046875,
60 11671535.248008711,
61 5507519.430472437,
62 3488.2146569223637,
63 1646.954404558065,
64 1735689600,
65 "1h",
66 "0x4200000000000000000000000000000000000006"
67 ],
68 [
69 8453,
70 3357.3486328125,
71 3365.47119140625,
72 3335.1826171875,
73 3339.875,
74 6751136.450000179,
75 10180055.82014424,
76 2015.1833968635947,
77 3041.051452456663,
78 1735693200,
79 "1h",
80 "0x4200000000000000000000000000000000000006"
81 ],
82 [
83 8453,
84 3338.6494140625,
85 3363.337158203125,
86 3337.80517578125,
87 3354.95263671875,
88 9739772.744918142,
89 7228014.350250291,
90 2908.0411885952317,
91 2159.3021282572067,
92 1735696800,
93 "1h",
94 "0x4200000000000000000000000000000000000006"
95 ],
96 [
97 8453,
98 3354.678466796875,
99 3360.015380859375,
100 3339.6748046875,
101 3348.86181640625,
102 6269153.96153974,
103 7260200.927784716,
104 1870.8947318233345,
105 2167.935624969013,
106 1735700400,
107 "1h",
108 "0x4200000000000000000000000000000000000006"
109 ],
110 [
111 8453,
112 3348.94580078125,
113 3353.947021484375,
114 3331.03076171875,
115 3334.624267578125,
116 5133926.383942099,
117 8521547.333653519,
118 1536.0399937461798,
119 2551.3398254204767,
120 1735704000,
121 "1h",
122 "0x4200000000000000000000000000000000000006"
123 ],
124 [
125 8453,
126 3333.260009765625,
127 3349.83251953125,
128 3331.072509765625,
129 3338.666259765625,
130 5074005.124108528,
131 4045804.8826495465,
132 1519.4843246643168,
133 1212.2628352951108,
134 1735707600,
135 "1h",
136 "0x4200000000000000000000000000000000000006"
137 ],
138 [
139 8453,
140 3338.902099609375,
141 3344.451904296875,
142 3326.92626953125,
143 3336.0771484375,
144 5410414.438194079,
145 6205576.359512242,
146 1621.5214982189252,
147 1861.1007649527567,
148 1735711200,
149 "1h",
150 "0x4200000000000000000000000000000000000006"
151 ],
152 [
153 8453,
154 3336.07666015625,
155 3345.383544921875,
156 3328.646240234375,
157 3339.3974609375,
158 4472285.575046726,
159 4182876.031031919,
160 1340.1214673358313,
161 1254.3106417491688,
162 1735714800,
163 "1h",
164 "0x4200000000000000000000000000000000000006"
165 ],
166 [
167 8453,
168 3339.83447265625,
169 3347.17724609375,
170 3323.121337890625,
171 3331.64501953125,
172 6016235.769028442,
173 7807414.169115474,
174 1804.5203262579714,
175 2342.917232980187,
176 1735718400,
177 "1h",
178 "0x4200000000000000000000000000000000000006"
179 ],
180 [
181 8453,
182 3328.861083984375,
183 3338.7724609375,
184 3305.47998046875,
185 3327.57763671875,
186 9600376.976409936,
187 10962750.725147905,
188 2890.67762941904,
189 3302.515419442688,
190 1735722000,
191 "1h",
192 "0x4200000000000000000000000000000000000006"
193 ]
194 ],
195 "rows": 10
196 }
197]
x402 Payment Option
This endpoint supports pay-per-use access via the x402 payment protocol (v2): pay $0.05 USDC per request using blockchain micropayments. No API key required.
Quickstart (Typescript)
bash
npm install @x402/fetch @x402/evm viem
TypeScript
1import { x402Client } from "@x402/core/client";
2import { ExactEvmScheme } from "@x402/evm/exact/client";
3import { wrapFetchWithPayment } from "@x402/fetch";
4import { privateKeyToAccount } from "viem/accounts";
5const signer = privateKeyToAccount(process.env.EVM_PRIVATE_KEY as `0x${string}`);
6const client = new x402Client();
7client.register("eip155:*", new ExactEvmScheme(signer));
8const fetchWithPayment = wrapFetchWithPayment(fetch, client);
9const response = await fetchWithPayment(
10 "https://x402.cambrian.org/evm/ohlcv/token"
11);
12const data = await response.json();
2import { ExactEvmScheme } from "@x402/evm/exact/client";
3import { wrapFetchWithPayment } from "@x402/fetch";
4import { privateKeyToAccount } from "viem/accounts";
5const signer = privateKeyToAccount(process.env.EVM_PRIVATE_KEY as `0x${string}`);
6const client = new x402Client();
7client.register("eip155:*", new ExactEvmScheme(signer));
8const fetchWithPayment = wrapFetchWithPayment(fetch, client);
9const response = await fetchWithPayment(
10 "https://x402.cambrian.org/evm/ohlcv/token"
11);
12const data = await response.json();
Quickstart (Python)
bash
pip install "x402[httpx]"
Python
1import asyncio, os
2from eth_account import Account
3from x402 import x402Client
4from x402.http.clients import x402HttpxClient
5from x402.mechanisms.evm import EthAccountSigner
6from x402.mechanisms.evm.exact.register import register_exact_evm_client
7async def main():
8 client = x402Client()
9 account = Account.from_key(os.getenv("EVM_PRIVATE_KEY"))
10 register_exact_evm_client(client, EthAccountSigner(account))
11 async with x402HttpxClient(client) as http:
12 response = await http.get("https://x402.cambrian.org/evm/ohlcv/token")
13 print(response.json())
14asyncio.run(main())
2from eth_account import Account
3from x402 import x402Client
4from x402.http.clients import x402HttpxClient
5from x402.mechanisms.evm import EthAccountSigner
6from x402.mechanisms.evm.exact.register import register_exact_evm_client
7async def main():
8 client = x402Client()
9 account = Account.from_key(os.getenv("EVM_PRIVATE_KEY"))
10 register_exact_evm_client(client, EthAccountSigner(account))
11 async with x402HttpxClient(client) as http:
12 response = await http.get("https://x402.cambrian.org/evm/ohlcv/token")
13 print(response.json())
14asyncio.run(main())
Payment Flow
- Send a normal request to the endpoint (no API key needed)
- Server returns 402 Payment Required with payment details
- The x402 SDK automatically signs a payment authorization with your wallet
- The SDK resubmits the request with the signed payment
- Server verifies payment and returns the API response
The x402 SDK handles steps 2 through 5 automatically.
Network: Base (chain ID 8453) | Currency: USDC | Price: $0.05 per request