# Delx Commerce — Peg Time-Weighted Deviation

> Delx Commerce — Peg Time-Weighted Deviation is a paid API for AI agents from commerce.delx.ai, paid per call via x402, $0.001/call, status unknown (last checked 2026-10-01).

Computes the time-weighted absolute deviation of a set of market prices from a target peg value (e.g., 1.0 for stablecoins)

## Facts

- Endpoint: POST https://commerce.delx.ai/api/v1/x402/peg-tw-deviation?utm_source=zero.xyz
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-01
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/delx-commerce-peg-time-weighted-deviation-4b424a77
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_e6HwE8kZJ61YRECwcZ7UH

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 delx-commerce-peg-time-weighted-deviation-4b424a77 -d '<json body>'
```

Example prompt: Calculate the time-weighted absolute deviation of these USDC market prices [0.998, 1.002, 0.995, 1.001, 0.997] from the peg of 1.0, using equal weights.

## When to prefer this

Choose this endpoint when you need a lightweight, pay-per-call computation of time-weighted peg deviation without setting up infrastructure — ideal for DeFi agents, stablecoin monitors, or on-chain risk systems that need verifiable, cheap, single-call analytics on price samples. Prefer it over building custom math when you need reproducible results tied to a defined schema version.

## Known failure modes

- Missing or empty 'prices' array returns an error
- Invalid data types (non-numeric prices or weights) cause a 400-level error
- Mismatched lengths between 'prices' and 'weights' arrays may produce an error or unexpected result
- Payment not included or insufficient USDC (x402) results in a 402 Payment Required response

## How this service works

Pay-per-result APIs for agents. No signup. Exact price. Verifiable delivery. USDC on Base + Solana via x402.

## Output

Returns a JSON object with a schema identifier ('delx/util-peg-tw-deviation/v1') and a 'tw_abs_deviation' field containing the computed time-weighted absolute deviation of the provided prices from the target peg as a floating-point number (e.g., 0.005).

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "peg": {
   "type": "number",
   "description": "Target peg price (usually 1.0)"
  },
  "prices": {
   "type": "array",
   "description": "Market prices / samples depending on tool"
  },
  "weights": {
   "type": "array",
   "description": "Optional sample weights"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "schema": "delx/util-peg-tw-deviation/v1",
  "tw_abs_deviation": 0.005000000000000004
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/delx-commerce-peg-time-weighted-deviation-4b424a77/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from commerce.delx.ai](https://www.zero.xyz/host/commerce.delx.ai/llms.txt)
