# QuantOracle Cointegration Test

> QuantOracle Cointegration Test is a paid API for AI agents from api.quantoracle.dev, paid per call via x402, $0.008/call, status unknown (last checked 2026-09-14).

Tests whether two time series are cointegrated using the Engle-Granger/ADF method, returning hedge ratio, spread statistics, z-score, half-life, and critical values

## Facts

- Endpoint: POST https://api.quantoracle.dev/v1/stats/cointegration
- Price: $0.008/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/api-quantoracle-dev-9a12768e
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_qO5grEQwfHLVAucI5mhEM

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 api-quantoracle-dev-9a12768e -d '<json body>'
```

Example prompt: Check if SPY and IVV are cointegrated using my last 30 daily closing prices — SPY: [100.1, 100.5, 101.2, ...] and IVV: [50.05, 50.25, 50.6, ...] — at the 0.05 significance level, and tell me the hedge ratio and current z-score.

## When to prefer this

Use this endpoint when you need a statistically rigorous Engle-Granger cointegration test with full spread diagnostics including hedge ratio, z-score, and mean-reversion half-life — ideal for pairs trading signal generation and stat-arb strategy construction. Prefer over generic regression endpoints when you specifically need cointegration verdict, ADF statistic, and spread mean-reversion metrics in a single call.

## Known failure modes

- Series length mismatch — series_x and series_y must have equal length
- Too few observations — ADF test requires sufficient data points (typically 20+)
- Invalid significance level — must be a recognized threshold like 0.01, 0.05, or 0.10
- Non-numeric values in series arrays cause parsing errors
- Server timeout for very long series

## How this service works

QuantOracle: stats/cointegration

## Output

Returns a boolean cointegration result, ADF test statistic, critical value at the chosen significance level, hedge ratio, spread mean and standard deviation, current z-score of the spread, mean-reversion half-life in bars, and intercept. Also includes response latency in milliseconds.

## Example request

```json
{
 "degree": 2,
 "series_x": [
  100.1,
  100.5,
  101.2,
  100.8,
  101.5,
  102,
  101.7,
  102.3,
  101.9,
  102.5,
  103.1,
  102.8,
  103.4,
  103.9,
  103.6,
  104.2,
  104.8,
  104.5,
  105.1,
  105.6,
  105.3,
  105.9,
  106.4,
  106.1,
  106.7,
  107.2,
  106.9,
  107.5,
  108,
  107.7
 ],
 "series_y": [
  50.05,
  50.25,
  50.6,
  50.4,
  50.75,
  51,
  50.85,
  51.15,
  50.95,
  51.25,
  51.55,
  51.4,
  51.7,
  51.95,
  51.8,
  52.1,
  52.4,
  52.25,
  52.55,
  52.8,
  52.65,
  52.95,
  53.2,
  53.05,
  53.35,
  53.6,
  53.45,
  53.75,
  54,
  53.85
 ]
}
```

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "series_x": {
   "type": "array",
   "items": {
    "type": "number"
   },
   "title": "Series X",
   "description": "First time series"
  },
  "series_y": {
   "type": "array",
   "items": {
    "type": "number"
   },
   "title": "Series Y",
   "description": "Second time series"
  },
  "significance": {
   "enum": [
    "0.01",
    "0.05",
    "0.10"
   ],
   "type": "string",
   "title": "Significance",
   "default": "0.05",
   "description": "Significance level for the test"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/api-quantoracle-dev-9a12768e/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.quantoracle.dev](https://www.zero.xyz/host/api.quantoracle.dev/llms.txt)
