# Unrealized PnL Calculator

> Unrealized PnL Calculator 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 unrealized profit and loss for an open position given entry price, mark price, and position size using local deterministic math.

## Facts

- Endpoint: POST https://api.delx.ai/api/v1/x402/unrealized-pnl
- 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/unrealized-pnl-calculator-ab5c43b0
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_QYVsXe-PvI_6CKbysA1hz

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 unrealized-pnl-calculator-ab5c43b0 -d '<json body>'
```

Example prompt: What's my unrealized PnL on a position where I entered at 42000 with a size of 10 and the current mark price is 43500?

## When to prefer this

Choose this endpoint when you need a fast, cheap, deterministic, first-party PnL calculation with no API keys or live data feeds — ideal for open position dashboards, liquidation preflights, or any scenario where you need pure local math on entry price, mark price, and size without relying on external market data providers.

## Known failure modes

- Missing required fields (mark, size, or entry) returns a validation error
- Non-integer values for mark, size, or entry may cause a type error
- Extremely large integers may cause overflow or precision issues
- Payment failure via x402 protocol blocks the request
- Malformed request body returns a 400-level error

## How this service works

Unrealized PnL versus mark from entry and size. Call when open position dashboards and liquidation preflight. Returns unrealized pnl at mark 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 unrealized PnL value calculated as the difference between mark price and entry price scaled by position size, with no external data sources or live feeds involved.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "mark": {
   "type": "integer",
   "description": "Input field: mark."
  },
  "size": {
   "type": "integer",
   "description": "Input field: size."
  },
  "entry": {
   "type": "integer",
   "description": "Input field: entry."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "mark": 95,
  "size": 3,
  "entry": 100,
  "schema": "delx/util-unrealized-pnl/v1",
  "unrealized_pnl": -15
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/unrealized-pnl-calculator-ab5c43b0/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)
