# Simple TWAP (Time-Weighted Average Price)

> Simple TWAP (Time-Weighted Average Price) 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-15).

Computes a simple (equal-weight) average of an array of price samples as a lightweight TWAP mark for benchmarking trade fills.

## Facts

- Endpoint: POST https://api.delx.ai/api/v1/x402/twap-simple
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/simple-twap-time-weighted-average-price-e97e6891
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_byLO9I7g-70VGNqFbUS98

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 simple-twap-time-weighted-average-price-e97e6891 -d '<json body>'
```

Example prompt: Calculate a simple equal-weight TWAP for me using these price samples: [100.5, 101.2, 99.8, 100.9, 101.0] — I want to benchmark my fills against it.

## When to prefer this

Choose this endpoint when you need a fast, deterministic, equal-weight average of price samples with no external dependencies — no RPC calls, no live market feeds, and no API keys required. Ideal for benchmarking trade fills against a simple TWAP mark where you already hold the price path. Prefer this over volume-weighted alternatives (like VWAP) when fill sizes are equal or irrelevant to the benchmark. Use when you need a $0.001 micropayment-gated, advisory-only price computation with full local math transparency.

## Known failure modes

- Empty or missing prices array returns an error or undefined result
- Non-numeric values in the prices array cause computation failure
- Payment failure via x402 protocol blocks the request
- Malformed JSON input body returns a 400-level error
- Very large arrays may cause latency spikes though still deterministic

## How this service works

Simple average of price samples for a light TWAP mark. Call when benchmarking fills against an equal-weight path you already hold. Returns twap and sample count 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 deterministic JSON object containing the computed TWAP value (simple arithmetic mean of the input price array) and the number of samples used in the calculation.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "prices": {
   "type": "array",
   "description": "Input field: prices."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "n": 4,
  "twap": 11,
  "schema": "delx/util-twap-simple/v1"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/simple-twap-time-weighted-average-price-e97e6891/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)
