idstringrequerido
Coin ID. *refers to [`/coins/list`](/reference/coins-list).
Valor predeterminado: "bitcoin"
https://api.sandbase.ai/v1/api/coingecko/coins-ohlcGet the OHLC chart (Open, High, Low, Close) of a coin based on particular coin ID
Su salida aparecerá aquí
Complete las entradas y luego haga clic en Ejecutar.
Returns OHLC (open, high, low, close) candle data for one coin as a list of arrays. Each array starts with a timestamp and is followed by numeric values in the currency you choose. It needs a CoinGecko coin id, a days range and a vs_currency.
interval to daily.curl -X POST "https://api.sandbase.ai/v1/api/coingecko/coins-ohlc" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"id": "bitcoin", "days": "1", "vs_currency": "usd"}'
The result is returned in outputs[0].data.
| Name | Type | Required | Description |
|---|---|---|---|
days | string | Yes | Data up to number of days ago. |
id | string | Yes | Coin ID. *refers to /coins/list. |
vs_currency | string | Yes | Target currency of price data. *refers to /simple/supported_vs_currencies. |
interval | string | No | Data interval, leave empty for auto granularity. |
precision | string | No | Decimal place for currency price value. |
Real response for the request above, trimmed: lists keep their first item and long strings are cut.
[
[
1793604600000
]
]
| Field | Meaning |
|---|---|
[] | One candle. The response is a top-level list of these arrays, ordered from oldest to newest. |
[][0] | Candle timestamp as a Unix time in milliseconds, for example 1793604600000. |
[][1] / [][2] | Numeric values in the vs_currency you requested. The description says each candle holds open, high, low and close, but this sample shows only two values after the timestamp. Check the array length in your own response before you map positions to open, high, low and close. |
id value (for example bitcoin) from CoinGecko Coins List (ID Map).vs_currency values (for example usd) from CoinGecko Supported Currencies List.days accepts 1, 7, 14, 30, 90, 180, 365 or max. In the sample call with days set to 1, the candles are 30 minutes apart (1,800,000 ms).$0.008 per successful call. Failed calls are not charged. It is included in the daily free quota of each organization.
Empiece a construir
Endpoint de la API de la plataforma con autenticación unificada y seguimiento de uso.
curl -X POST "https://api.sandbase.ai/v1/api/coingecko/coins-ohlc" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"id": "bitcoin",
"days": "1",
"vs_currency": "usd"
}'Configure su clave de API de SandBase en el entorno de su servidor. Las solicitudes usan autenticación Bearer.
export SANDBASE_API_KEY="YOUR_API_KEY"Conserve su clave en el servidor. No la exponga en código del navegador.
idstringrequeridoCoin ID. *refers to [`/coins/list`](/reference/coins-list).
Valor predeterminado: "bitcoin"
daysstringrequeridoData up to number of days ago.
Valor predeterminado: "1"
Valores posibles: 1, 7, 14, 30, 90, 180, 365, max
vs_currencystringrequeridoTarget currency of price data. *refers to [`/simple/supported_vs_currencies`](/reference/simple-supported-currencies).
Valor predeterminado: "usd"
intervalstringData interval, leave empty for auto granularity.
Valores posibles: daily, hourly
precisionstringDecimal place for currency price value.
Valores posibles: full, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18
Respuesta de ejemplo guardada para esta API; no se realiza ninguna solicitud en vivo al verla.
No se ha publicado ninguna respuesta guardada. Ejecute la API en Playground para inspeccionar su respuesta.
Explorar más
| API | Precio | Respuesta |
|---|---|---|
CoinGecko Coin OHLC Chart by IDEsta API CoinGecko | $0.008 por llamada | JSON |
CoinGecko | $0.008 por llamada | JSON |
CoinGecko | $0.008 por llamada | JSON |
CoinGecko | $0.008 por llamada | JSON |
CoinGecko | $0.008 por llamada | JSON |
CoinGecko | $0.008 por llamada | JSON |
Preguntas
Envía una solicitud POST a https://api.sandbase.ai/v1/api/coingecko/coins-ohlc con tu clave API de SandBase en el encabezado Authorization (Bearer) y los parámetros como un cuerpo JSON. También puedes probarlo en el Playground de esta página sin escribir código.
$0.008 por llamada, facturado desde tu saldo de SandBase. Solo se te cobra por las llamadas que haces; no hay suscripción.
Requeridos: id (string), days (una de 1, 7, 14, 30, 90, 180, 365, max) y vs_currency (string). Opcionales: interval (una de daily, hourly) y precision (una de full, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18). La tabla de Parámetros y el Playground de esta página enumeran todos los campos.
Una respuesta JSON devuelta en la misma solicitud HTTP (sincrónica). El README de esta página incluye una respuesta de ejemplo.
No. CoinGecko Coin OHLC Chart by ID funciona a través de SandBase, así que una sola clave API de SandBase cubre este endpoint y todas las demás APIs y modelos del catálogo. No necesitas solicitar acceso a la API de CoinGecko por separado.