Get OHLC history
https://pyth.dourolabs.app/v1/{channel}/historyAn API key or short-lived access token, in an Authorization: Bearer <token> header.
Returns open, high, low, and close (OHLC) price bars for a symbol in TradingView's Universal Data Feed (UDF) format. Specify the time range using Unix timestamps in seconds. If the range contains no data, the response arrays are empty.
v1/{channel}/historycurl "https://pyth.dourolabs.app/v1/real_time/history?symbol=Crypto.BTC%2FUSD&from=1758826800&to=1758830400&resolution=60" \
-H "Authorization: Bearer $PYTH_API_KEY"{
"s": "ok",
"c": [100, 101],
"h": [101, 102],
"l": [99, 100],
"o": [99, 100],
"t": [1684137600, 1684137660],
"v": [0, 0]
}Replace the placeholders in the URL path with these values.
channelRequiredThe channel that determines the update frequency.
Add these parameters to the URL query string.
symbolstringRequiredSymbol name or ticker. Matching is case-insensitive.
fromstringRequiredStart of the requested range, in Unix seconds. This boundary is inclusive.
tostringRequiredEnd of the requested range, in Unix seconds. This boundary is inclusive. Future timestamps return data through the latest available bar.
resolutionstringRequiredBar length: a whole number of minutes, such as 1, 60 or 240. Also D/1D for a day, W/1W for a week and M/1M for a month. Letters are case-sensitive.
split_adjustedbooleanOptionalScale prices published before a stock split into post-split terms. Defaults to false.
Response
200 · application/jsonReturns a JSON object with the following fields.
sstringResponse status: ok or error.
- ok
- error
cnumber[] | nullClosing price of each bar.
errmsgstring | nullError description, when present.
hnumber[] | nullHighest price of each bar.
lnumber[] | nullLowest price of each bar.
onumber[] | nullOpening price of each bar.
tinteger[] | nullBar timestamps, in Unix seconds. Values at the same array index describe the same bar.
vinteger[] | nullVolume for each bar. This endpoint returns zero for each bar.
Status codes returned when a request fails.
- 400
- The requested channel is invalid.
- 401
- Authentication is missing. The body is the plain text "Unauthorized", so TradingView's UDF adapter reports a JSON parse error.
- 403
- The credentials do not grant access to the requested symbol.
- 404
- The symbol does not exist, is not on this channel, or is not visible to these credentials.
- 429
- The request rate limit for this API key was exceeded.