# Stablecoin Time-Weighted Peg Deviation

> Stablecoin Time-Weighted Peg Deviation is a paid API for AI agents from api.delx.ai, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-13).

Computes the time-weighted absolute peg deviation across a window of price samples to summarize depeg severity.

## Facts

- Endpoint: POST https://api.delx.ai/api/v1/x402/peg-tw-deviation
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/stablecoin-time-weighted-peg-deviation-014b929f
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_5tEXijycuAg7GEDPZshJ5

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 stablecoin-time-weighted-peg-deviation-014b929f -d '<json body>'
```

Example prompt: Can you compute the time-weighted absolute peg deviation for a stablecoin targeting $1.00 given these price samples [0.998, 1.002, 0.995, 1.001, 0.997] with equal weights? I want a single tw_abs_deviation summary of how bad the depeg was across that window.

## When to prefer this

Choose this endpoint when you need a single deterministic, time-weighted summary statistic of peg deviation across a batch of price samples — for example in post-mortem reports, risk dashboards, or compliance summaries. It is ideal when you already have price samples in hand and need pure local computation with no live market feed dependency. Prefer alternatives if you need live price fetching, real-time monitoring, or continuous alerting rather than a one-shot aggregation.

## Known failure modes

- Missing or empty prices array returns a validation error
- Mismatched lengths between prices and weights arrays causes an error
- Non-numeric values in prices or weights cause a parsing/validation error
- Peg value not supplied defaults or errors depending on server behavior
- Malformed JSON body returns a 400 error

## How this service works

Time-weighted absolute peg deviation over samples. Call when summarizing depeg severity over a sample window. Returns tw_abs_deviation as deterministic JSON for $0.001 USDC via x402 on Base. First-party local math only—no RPC, live market feed, API keys, storage, or mediagen. Advisory only; the caller owns capital, risk, and production controls.

## Output

Returns a JSON object containing tw_abs_deviation, a single deterministic float representing the time-weighted mean absolute deviation of the supplied price samples from the target peg price. Computation is performed locally with pure math — no external data sources are consulted.

## 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/stablecoin-time-weighted-peg-deviation-014b929f/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.delx.ai](https://www.zero.xyz/host/api.delx.ai/llms.txt)
