# finmath Correlation

> finmath Correlation is a paid API for AI agents from finmath.qzqh5rrbkz.workers.dev, paid per call via x402, $0.002/call, status unknown (last checked 2026-09-15).

Computes the Pearson correlation coefficient between two numerical arrays using exact arithmetic

## Facts

- Endpoint: POST https://finmath.qzqh5rrbkz.workers.dev/v1/correlation
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/finmath-correlation-23be74f8
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_9qigUhgeyFldCHzVmzVWz

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 finmath-correlation-23be74f8 -d '<json body>'
```

Example prompt: What's the correlation between these two return series? X: [0.02, -0.01, 0.03, 0.05, -0.02, 0.01] and Y: [0.015, -0.005, 0.025, 0.04, -0.01, 0.008] — I need an exact number, not an LLM estimate.

## When to prefer this

Use this endpoint when you need a deterministic, exact correlation computation rather than relying on an LLM's approximate arithmetic. Ideal for financial return series, portfolio analytics, risk factor correlation, or any quantitative workflow where numeric precision matters. Prefer this over general-purpose LLM math when the arrays have many elements or precision is critical.

## Known failure modes

- Arrays x and y have different lengths — mismatched array sizes will cause an error
- Empty arrays passed as input — no data to correlate
- Non-numeric values in arrays — arrays must contain numbers only
- Single-element arrays — correlation is undefined with fewer than 2 data points
- Payment failure — endpoint requires $0.002 USDC per call via x402 protocol

## How this service works

Deterministic finance and crypto math for AI agents: TradFi (NPV, IRR, XIRR, Black-Scholes + Greeks, bonds, VaR, Sharpe) and DeFi (impermanent loss, perp liquidation, funding, Uniswap v3, health factor, cost basis). Exact, model-free arithmetic that LLMs get wrong — priced per call in USDC.

## Output

Returns a result object containing the computed Pearson correlation coefficient between the two input arrays, along with a meta object with call metadata. The correlation value is a deterministic, exact arithmetic result between -1 and 1.

## Example request

```json
{
 "x": [
  0.02,
  -0.01,
  0.03,
  0.05,
  -0.02,
  0.01
 ],
 "y": [
  0.015,
  -0.005,
  0.025,
  0.04,
  -0.01,
  0.008
 ]
}
```

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "x",
  "y"
 ],
 "properties": {
  "x": {
   "type": "array",
   "description": "x"
  },
  "y": {
   "type": "array",
   "description": "y"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "result",
  "meta"
 ],
 "properties": {
  "meta": {
   "type": "object"
  },
  "result": {}
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/finmath-correlation-23be74f8/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from finmath.qzqh5rrbkz.workers.dev](https://www.zero.xyz/host/finmath.qzqh5rrbkz.workers.dev/llms.txt)
