GET/api/v1/prices/ohlc/{asset}
Get Price Ohlc
Get historical OHLC candles for a price asset. Supported assets: btc, eth, eth_btc, btc_d, total2, sp500, gold, oil, commodities, japan, europe, us_dollar, china, emerging. S&P 500 includes Shiller deep history (1871-present, ~155 years). Crypto assets use CoinGecko (primary) + CoinLore (fallback). Uses stale-while-revalidate caching: serves stale data instantly while refreshing in background. Users never wait for upstream fetches.
Authentication
This endpoint requires the X-API-Key header or a valid Clerk JWT. Accepted schemes: HTTPBearer.
See Authentication for details.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
asset | string | ✓ | - |
Responses
| Status | Description | Schema |
|---|---|---|
200 | Successful Response | PriceOHLCOut |
422 | Validation Error | HTTPValidationError |
See the standard error codes documented in the Error codes.
Code samples
Three ready-to-paste implementations. Replace $TRINITY_API_KEY with your API key (generated from the dashboard under Profile → API keys).
cURL
curl -X GET \
'https://api.trinityinsights.io/api/v1/prices/ohlc/value' \
-H 'X-API-Key: $TRINITY_API_KEY'Python
import os
import requests
BASE = "https://api.trinityinsights.io"
headers = {
"X-API-Key": os.environ["TRINITY_API_KEY"],
}
response = requests.get(f"{BASE}/api/v1/prices/ohlc/value", headers=headers, timeout=10)
response.raise_for_status()
data = response.json()JavaScript
const apiKey = process.env.TRINITY_API_KEY;
const response = await fetch(
"https://api.trinityinsights.io/api/v1/prices/ohlc/value",
{
method: "GET",
headers: {
"X-API-Key": apiKey,
},
},
);
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const data = await response.json();Institutional disclaimer
Trinity Insights is an educational and analytical tool. Values returned by this endpoint do not constitute investment advice. Trinity Insights is not a Crypto-Asset Service Provider (CASP) registered under MiCA Regulation (EU) 2023/1114. See the full disclaimer.