> ## Documentation Index
> Fetch the complete documentation index at: https://docs.b3os.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Get OHLC by Date Range

Retrieves OHLC candlestick data for a coin within a specific date range (Pro plan exclusive). Returns [timestamp, open, high, low, close] arrays; daily (180 days max) or hourly (31 days max) intervals. Ideal for: candlestick charts, technical analysis, historical price studies for specific periods.

![Get OHLC by Date Range logo](https://ai-icon.b3.fun/logo/coingecko)
Catalog action Blockchain Data

Retrieves OHLC candlestick data for a coin within a specific date range (Pro plan exclusive). Returns [timestamp, open, high, low, close] arrays; daily (180 days max) or hourly (31 days max) intervals. Ideal for: candlestick charts, technical analysis, historical price studies for specific periods.


## At a Glance

| Field | Value |
| --- | --- |
| Action ID | `coingecko-get-ohlc-range` |
| Category | Blockchain Data |
| Connector | Not required |
| Requires gas | No |
| Funds movement | None declared |
| Tags | `coingecko`, `ohlc`, `candlestick`, `historical`, `price`, `chart`, `cryptocurrency`, `read` |

## Payload Schema

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `coinId` | `string` | Yes | CoinGecko coin ID \(e.g., 'bitcoin', 'ethereum'\). Use the search action to find coin IDs. |
| `vsCurrency` | `string` | Yes | Target currency for prices \(e.g., 'usd', 'eur', 'btc'\). |
| `from` | `number \| string` | Yes | Start date as Unix timestamp \(seconds\) or ISO date string \(YYYY-MM-DD\). |
| `to` | `number \| string` | Yes | End date as Unix timestamp \(seconds\) or ISO date string \(YYYY-MM-DD\). |
| `interval` | `string` | Yes | Data interval. Daily interval: up to 180 days. Hourly interval: up to 31 days. |

## Result Schema

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `coinId` | `string` | Yes | Coin ID that was queried |
| `vsCurrency` | `string` | Yes | Target currency |
| `candles` | `array` | Yes | Array of OHLC candles |

## Examples

**Workflow node**

```json
{
  "type": "coingecko-get-ohlc-range",
  "payload": {
    "coinId": "example-coinId",
    "vsCurrency": "example-vsCurrency",
    "from": 1,
    "to": 1,
    "interval": "daily"
  },
  "children": []
}
```
  **Test with API**

```bash
curl -X POST "https://api.b3os.org/v1/actions/coingecko-get-ohlc-range/test" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "inputs": {
    "coinId": "example-coinId",
    "vsCurrency": "example-vsCurrency",
    "from": 1,
    "to": 1,
    "interval": "daily"
  }
}'
```

**Use expressions for dynamic values**

Payload fields can use workflow expressions such as `{{$trigger.body.amount}}`, `{{$nodes.fetch.result.price}}`, and `{{$props.asset}}` when the value should come from a trigger, prior node, or reusable workflow prop.