# Delx Commerce — Realized PnL FIFO Calculator

> Delx Commerce — Realized PnL FIFO Calculator 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 realized profit and loss for a trade position using FIFO (first-in, first-out) accounting given entry price, exit price, and close size.

## Facts

- Endpoint: POST https://commerce.delx.ai/api/v1/x402/realized-pnl-fifo?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-realized-pnl-fifo-calculator-06ec333b
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_VAbzAd5dXvQQjkiHcBLuF

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-realized-pnl-fifo-calculator-06ec333b -d '<json body>'
```

Example prompt: Calculate the realized PnL using FIFO for a trade where I entered at 100, exited at 110, and closed 2 contracts.

## When to prefer this

Choose this endpoint when you need a fast, pay-per-use, no-signup computation of realized PnL using FIFO accounting, especially in agentic or automated trading workflows where USDC micropayment settlement via x402 on Base or Solana is acceptable. Prefer this over building custom PnL logic when you need verifiable, deterministic results at $0.001 per call.

## Known failure modes

- Missing required fields (entry, exit, or close_size) returns an error
- Non-integer values for price or size fields may cause validation failure
- Payment failure via x402 protocol results in 402 response and no computation
- Negative or zero close_size may produce unexpected results

## 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 containing the schema identifier ('delx/util-realized-pnl-fifo/v1'), the close_size used in the calculation, and the computed realized_pnl value representing the profit or loss realized on the closed portion of the position.

## Request schema (JSON Schema)

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

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "schema": "delx/util-realized-pnl-fifo/v1",
  "close_size": 2,
  "realized_pnl": 10
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/delx-commerce-realized-pnl-fifo-calculator-06ec333b/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)
