# x402stock Forex OHLCV Aggregates

> x402stock Forex OHLCV Aggregates is a paid API for AI agents from agents.x402stock.xyz, paid per call via x402, $0.02/call, status unknown (last checked 2026-09-30).

Returns historical OHLCV (open, high, low, close, volume) candlestick bars for a foreign-exchange currency pair over a specified date range and timespan granularity.

## Facts

- Endpoint: GET https://agents.x402stock.xyz/api/v1/forex/:pair/aggregates?utm_source=zero.xyz
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-30
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/x402stock-forex-ohlcv-aggregates-3a9e7b4c
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_PFNlJezordNNDsWDcmADO

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 x402stock-forex-ohlcv-aggregates-3a9e7b4c
```

Example prompt: Pull daily OHLCV bars for EUR-USD from January 1 2025 to June 30 2025, sorted ascending, so I can backtest my momentum strategy.

## When to prefer this

Choose this endpoint when you need historical OHLCV candlestick data for a foreign-exchange pair across flexible granularities (minute through month) without managing API keys — ideal for FX backtesting, charting, or macro analysis where pay-per-call USDC pricing is preferred over a subscription. Prefer over generic data providers when running AI agent workflows that require lightweight, on-demand access without account setup.

## Known failure modes

- Invalid currency pair format (e.g. missing hyphen or unsupported pair) returns 400 or empty result
- Date range too large for the selected timespan/limit combination may truncate results — use limit and pagination
- Invalid timespan enum value returns validation error
- from date after to date returns empty or error
- Payment failure via x402 (insufficient USDC balance) blocks the call entirely
- Unsupported or illiquid currency pair may return empty bars array

## How this service works

Historical OHLCV bars for a foreign-exchange pair at the requested multiplier and timespan (minute, hour, day, week, month) between `from` and `to`. Pass the pair in the path as BASE-QUOTE, e.g. EUR-USD or USD-JPY. Use for FX charting, backtesting, and macro/rate analysis. From x402stock, a pay-per-call market & economic data API for AI agents. No API key or account; pay in USDC via x402.

## Output

An array of OHLCV candlestick bars for the requested currency pair and time window. Each bar contains timestamp, open, high, low, close, and volume values at the requested granularity (minute, hour, day, week, or month), sorted as requested (ascending or descending).

## 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",
      "HEAD",
      "DELETE"
     ],
     "type": "string"
    },
    "pathParams": {
     "pair": {
      "type": "string"
     },
     "type": "object"
    },
    "queryParams": {
     "type": "object",
     "properties": {
      "to": {
       "type": "string",
       "default": "2026-07-31",
       "minLength": 1
      },
      "from": {
       "type": "string",
       "default": "2025-07-31",
       "minLength": 1
      },
      "sort": {
       "enum": [
        "asc",
        "desc"
       ],
       "type": "string",
       "default": "asc"
      },
      "limit": {
       "type": "integer",
       "default": 5000,
       "maximum": 50000,
       "exclusiveMinimum": 0
      },
      "adjusted": {
       "type": "boolean",
       "default": true
      },
      "timespan": {
       "enum": [
        "minute",
        "hour",
        "day",
        "week",
        "month",
        "quarter",
        "year"
       ],
       "type": "string",
       "default": "day"
      },
      "multiplier": {
       "type": "integer",
       "default": 1,
       "maximum": 50000,
       "exclusiveMinimum": 0
      }
     }
    }
   },
   "additionalProperties": false
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/x402stock-forex-ohlcv-aggregates-3a9e7b4c/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agents.x402stock.xyz](https://www.zero.xyz/host/agents.x402stock.xyz/llms.txt)
