# x402stock Forex Historical OHLCV Aggregates

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

Returns historical OHLCV candlestick bars for a foreign-exchange currency pair at a configurable timespan and multiplier, paid per call in USDC via x402.

## Facts

- Endpoint: GET https://agents.x402stock.xyz/api/v1/forex/{pair}/aggregates
- Price: $0.02/call
- Payment: MPP
- Status: unknown
- Last checked: 2026-09-13
- Activations on Zero: 0
- Provider: agents.x402stock.xyz
- Website: https://agents.x402stock.xyz
- Canonical page: https://www.zero.xyz/c/agents-x402stock-xyz-x402stock-forex-historical-ohlcv-aggregates-96d367de
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_5G_txC0aSAJQ8kY9pFUs0

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 agents-x402stock-xyz-x402stock-forex-historical-ohlcv-aggregates-96d367de
```

Example prompt: Pull daily OHLCV bars for EUR-USD from January 1, 2024 to December 31, 2024, sorted ascending, so I can backtest a moving-average strategy on the euro-dollar pair.

## When to prefer this

Choose this endpoint when you need historical candlestick (OHLCV) data for forex currency pairs for charting, backtesting, or macro/rate analysis. It supports flexible timespans from minute to year and does not require an API key — agents pay $0.02 per call in USDC via x402, making it suitable for autonomous agentic workflows. Prefer over stock or crypto OHLCV endpoints when the subject is a fiat currency pair.

## Known failure modes

- Invalid or unsupported currency pair format returns an error (pair must be BASE-QUOTE, e.g. EUR-USD)
- Date range with no available data returns an empty bars array with count 0
- Exceeding the limit maximum of 50,000 returns a validation error
- Payment failure or insufficient USDC balance blocks the request via x402 protocol
- Unsupported timespan value outside the enum causes a 400-level error

## 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 bar objects each containing open, high, low, close, volume, VWAP, trade count, and timestamp, plus total bar count, the ticker symbol, adjusted flag, data source ('x402stock'), and an as-of timestamp. Up to 50,000 bars per call.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "pair"
 ],
 "properties": {
  "to": {
   "type": "string",
   "default": "2026-07-31",
   "minLength": 1
  },
  "from": {
   "type": "string",
   "default": "2025-07-31",
   "minLength": 1
  },
  "pair": {
   "type": "string",
   "description": "Currency or crypto spot pair as BASE-QUOTE, e.g. EUR-USD or BTC-USD."
  },
  "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
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "ticker",
  "data",
  "source",
  "as_of"
 ],
 "properties": {
  "data": {
   "type": "object",
   "required": [
    "bars",
    "count"
   ],
   "properties": {
    "bars": {
     "type": "array",
     "items": {
      "type": "object",
      "required": [
       "open",
       "high",
       "low",
       "close",
       "volume",
       "vwap",
       "trade_count",
       "timestamp"
      ],
      "properties": {
       "low": {
        "type": "number"
       },
       "high": {
        "type": "number"
       },
       "open": {
        "type": "number"
       },
       "vwap": {
        "anyOf": [
         {
          "type": "number"
         },
         {
          "type": "null"
         }
        ]
       },
       "close": {
        "type": "number"
       },
       "volume": {
        "type": "number"
       },
       "timestamp": {
        "anyOf": [
         {
          "type": "string"
         },
         {
          "type": "null"
         }
        ]
       },
       "trade_count": {
        "anyOf": [
         {
          "type": "number"
         },
         {
          "type": "null"
         }
        ]
       }
      },
      "additionalProperties": false
     }
    },
    "count": {
     "type": "number"
    },
    "adjusted": {
     "type": "boolean"
    }
   },
   "additionalProperties": false
  },
  "as_of": {
   "type": "string"
  },
  "source": {
   "type": "string",
   "const": "x402stock"
  },
  "ticker": {
   "type": "string"
  },
  "feedback": {
   "type": "object",
   "required": [
    "endpoint",
    "method",
    "free",
    "note"
   ],
   "properties": {
    "free": {
     "type": "boolean"
    },
    "note": {
     "type": "string"
    },
    "method": {
     "type": "string",
     "const": "POST"
    },
    "endpoint": {
     "type": "string"
    }
   },
   "additionalProperties": false
  }
 },
 "additionalProperties": false
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agents-x402stock-xyz-x402stock-forex-historical-ohlcv-aggregates-96d367de/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)
