# Agent402 Coin OHLC Price Bars

> Agent402 Coin OHLC Price Bars is a paid API for AI agents from agent402.tools, paid per call via x402, $0.008/call, status unknown (last checked 2026-09-13).

Returns historical OHLC (open/high/low/close) candlestick price bars for a cryptocurrency over a specified time period and granularity.

## Facts

- Endpoint: GET https://agent402.tools/api/coin-ohlc
- Price: $0.008/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/agent402-coin-ohlc-price-bars-98ca7da7
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_JjnnpNA3hwKoH-lXj6B7X

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability agent402-coin-ohlc-price-bars-98ca7da7
```

Example prompt: Can you get me the OHLC candlestick price bars for bitcoin over the last 30 days in USD — I need the open, high, low, close values and the overall price change percentage?

## When to prefer this

Choose this endpoint when you need structured OHLC candlestick price history for a specific cryptocurrency over a defined lookback window, especially when you want a built-in price summary (first, last, high, low, changePct) alongside the raw bars. Ideal for charting, backtesting signals, or reporting on price movement without building your own aggregation. Prefer over raw tick data sources when 4h or daily granularity suffices and pay-per-call USDC pricing with no API key is acceptable.

## Known failure modes

- Unknown coin id returns error or empty response
- Unsupported days value outside allowed set (1,7,14,30,90,180,365) may return error
- Unsupported currency code returns error
- Rate limiting or upstream CoinGecko unavailability causes failure
- Payment of 0.008 USDC required per call; unpaid requests are rejected with 402

## How this service works

OHLC candles for a coin: days 1 (30-min candles), 7 or 14 (4-hour), 30 / 90 / 180 / 365 (daily), in any vs currency. Returns aligned {time, open, high, low, close} bars plus the window's high/low/first/last and % change. The candle sibling of crypto-history, which returns close-only points: use OHLC for technical indicators, range/volatility work and charting. Cached in-process for 60 seconds.

## Output

Returns an array of OHLC bars each with open, high, low, close prices and a UTC timestamp, plus a summary object with overall high, low, first, last prices and percentage change. Also includes metadata: coin id, number of days, count of bars, currency, granularity (e.g. 4h), data source (CoinGecko), fetchedAt timestamp, and a cached flag.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "coin"
     ],
     "properties": {
      "coin": {
       "type": "string",
       "description": "Coin id (bitcoin, ethereum, ...)."
      },
      "days": {
       "type": "number",
       "description": "1, 7, 14, 30, 90, 180 or 365 (default 7)."
      },
      "currency": {
       "type": "string",
       "description": "vs currency (default usd)."
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "required": [
      "source",
      "fetchedAt",
      "cached",
      "coin",
      "currency",
      "days",
      "count",
      "granularity",
      "summary",
      "bars"
     ],
     "properties": {
      "bars": {
       "type": "array"
      },
      "coin": {
       "type": "string"
      },
      "days": {
       "type": "integer"
      },
      "count": {
       "type": "integer"
      },
      "cached": {
       "type": "boolean"
      },
      "source": {
       "type": "string"
      },
      "summary": {
       "type": "object"
      },
      "currency": {
       "type": "string"
      },
      "fetchedAt": {
       "type": "string"
      },
      "granularity": {
       "type": "string"
      }
     }
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "bars": [
   {
    "low": 65900,
    "high": 66500.1,
    "open": 66120.4,
    "time": "2026-08-15T16:00:00.000Z",
    "close": 66210.3
   }
  ],
  "coin": "bitcoin",
  "days": 7,
  "count": 42,
  "cached": false,
  "source": "coingecko",
  "summary": {
   "low": 64995.9,
   "high": 69850,
   "last": 68210,
   "first": 66120.4,
   "changePct": 3.16
  },
  "currency": "usd",
  "fetchedAt": "2026-08-22T13:20:00.000Z",
  "granularity": "4h"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agent402-coin-ohlc-price-bars-98ca7da7/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agent402.tools](https://www.zero.xyz/host/agent402.tools/llms.txt)
