# Order Book Imbalance

> Order Book Imbalance 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-14).

Computes L1 order book imbalance as (bid_size - ask_size) / (bid_size + ask_size), returning a normalized value in [-1, 1]

## Facts

- Endpoint: POST https://api.delx.ai/api/v1/x402/ob-imbalance
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/order-book-imbalance-b4dfc638
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_04P4KUYMH2Ga_tto2p8qc

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 order-book-imbalance-b4dfc638 -d '<json body>'
```

Example prompt: Calculate the order book imbalance for me — the best bid has a size of 450 and the best ask has a size of 150, give me the normalized imbalance score.

## When to prefer this

Choose this endpoint when you need a fast, cheap, local computation of L1 order book imbalance with no external dependencies, API keys, or live market feed. Ideal for agents that already have bid and ask size data and need a normalized [-1, 1] signal for directional sizing or signal generation without building the math themselves.

## Known failure modes

- Zero total size (bid_size + ask_size = 0) causes division by zero — endpoint should return an error or null
- Negative size values may produce nonsensical results outside [-1, 1]
- Missing required fields (bid_size or ask_size) will cause a validation error
- Non-numeric inputs will be rejected

## How this service works

Book imbalance (bid_size-ask_size)/(bid_size+ask_size). Call when sizing or signal needs L1 size imbalance. Returns imbalance in [-1,1] 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

A deterministic JSON response containing the imbalance value as a number in the range [-1, 1], where -1 indicates fully ask-dominated, 0 indicates balanced, and +1 indicates fully bid-dominated.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "ask_size": {
   "type": "number",
   "description": "Displayed size at best ask"
  },
  "bid_size": {
   "type": "number",
   "description": "Displayed size at best bid"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "schema": "delx/util-ob-imbalance/v1",
  "ask_size": 8,
  "bid_size": 12,
  "imbalance": 0.2
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/order-book-imbalance-b4dfc638/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)
