/v1/ohlc/{id}
OHLC candlestick data
Request
https://api.xrpl.to/v1/ohlc/0dd550278b74cb6690fdae351e8e0df3| Path parameter | Value | Description |
|---|---|---|
| id | A token id: its md5, slug or issuer_currency |
| Query parameter | Value | Description |
|---|---|---|
| range | 1D|5D|7D|1M|3M|1Y|5Y|ALL | |
| interval | 1m|5m|15m|30m|1h|2h|4h|1d|1w | |
| vs_currency | XRP|USD|EUR|JPY|CNH (default: XRP). EUR, JPY and CNH candles are converted at the ECB reference rate of their own day (the last business day before a weekend or holiday; CNH uses the ECB's CNY); a candle with no rate in the week before it is left out. In USD a candle closes at the XRP/USD rate of its end, and its high and low go only as far as a trade certainly reached (each 5-minute high at the lowest XRP/USD rate of those 5 minutes, each low at the highest), so XRP moving inside a candle draws no wick. In every currency a wick more than 5% past a 5-minute candle's body reaches only as far as real volume traded (2% of the candle's XRP, at least 10 and at most 1000), so a lone off-market trade draws no spike and a real one still shows | |
| resolution | int (minutes), or D|W|M (also 1D|1W|1M; a week starts Monday 00:00 UTC, a month on the 1st; 1m is a minute) | |
| cb | int (candle bar count, max 5000) | |
| to | unix ms (with resolution): a page of history, the cb candles that open before it. Page back by passing the first candle's time; an empty ohlc means the history ends there. Absent, or inside the current candle: the live window ending now | |
| invert | bool | |
| ind | indicators instead of candles (with resolution, not to): up to 10 studies, comma-separated, each its id from /ohlc/indicators (id@md5: read off that token's candles instead of this one's, at the same bars) then its inputs after colons in that order, empty = the default (relative-strength-index:14,macd,bollinger-bands:20:2). Computed on these candles with TradingView's formulas, each warmed up on the bars before the first one returned | |
| from | unix ms (with ind): the first bar wanted; default the last cb | |
| tail | int (with ind): only the last N bars (a chart's live update) | |
| ha | bool (with resolution): Heikin Ashi candles (TradingView's), warmed up on the bars before the window; with ind the studies are computed on them | |
| chg | bool: each row also carries the bar's change against the bar before's close and the change in % (format "ohlc_change") |
curl 'https://api.xrpl.to/v1/ohlc/0dd550278b74cb6690fdae351e8e0df3'
Response
https://api.xrpl.to/v1/ohlc/0dd550278b74cb6690fdae351e8e0df3{ "success": true, "took": 2, "length": 97, "format": "ohlc", "metric": "price", "resolution": 15, "interval": "15m", "interval_seconds": 900, "vs_currency": "XRP", "inverted": false, "base_interval": 300, "ohlc": [ [ 1793430000000, 0.8020275, 0.802793082, 0.801603206, 0.801603844 ], [ 1793430900000, 0.801603844, 0.802658407, 0.800654758, 0.801500253 ], [ 1793431800000, 0.801500253, 0.806451613, 0.801493708, 0.803987018 ], [ 1793432700000, 0.803987018, 0.803987018, 0.802451858, 0.802451858 ], [ 1793433600000, 0.802451858, 0.804235, 0.802241721, 0.802826 ] ] }
Long arrays and strings are shortened in the example; Send request for the full answer.
{ success, took, length, format, heikin_ashi? (with ha), resolution, interval, interval_seconds, vs_currency, fx_basis? (EUR/JPY/CNH), inverted, base_interval, to? (the page end, with to), ohlc: [ [ time, open, high, low, close, volume, change? and change %? (with chg) ] ] }; with ind: { success, took, metric, interval, interval_seconds, vs_currency, t: [time], indicators: [ { id, inputs, offsets (bars a plot is drawn shifted by), plots: [[value or null per bar]], graphics? (pivots, 52-week lines, volume profile: their objects, times in ms) } ] }
What it does
OHLC candlestick data