Candles
See Charts for resolutions and how candles are built.
candles.get
Section titled “candles.get”HTTP: /candles.
| Param | Description |
|---|---|
tokens |
Required. 1 to 200 tokens |
resolution |
Required. 1S, 1, 5, 15, 60, 240, D or W, see Resolutions |
quote |
usd (default), near, or both as a list |
series |
Which of open, high, low, close and volume. All of them by default |
count_back |
How many candles of each token, at most 5,000, or 1,000 for 1S. Default 300 |
to_millis |
The latest candle start to include. Now by default |
Result:
{ "height": 219969900, "timestamp_millis": 1792003880982, "tokens": { "wrap.near": { "time": [1791997200000, 1792000800000], "usd": { "close": [4.8274, 4.8295] }, "near": { "close": [1.0, 1.0] } } }, "missing": []}- Each token’s candles are columns, oldest first.
timeis when each candle opens, in milliseconds. - Prices are per whole token, and
volumeis in the same currency. - In
near, values arenullfrom before wrap.near had a price. missing: tokens that don’t exist.
candles.subscribe
Section titled “candles.subscribe”Takes the params of candles.get except to_millis, with count_back defaulting to 0. The result is shaped like candles.get’s.
Each push is { "sub", "height", "timestamp_millis", "tokens" } with the candles that changed in that block: the latest one, and a new one once it opens. It can also carry the candle before the latest one. A candle replaces the one with the same time.
See Charts for a TradingView datafeed built on both.