# P&L Stats Calculator

> P&L Stats Calculator is a paid API for AI agents from api.edifiedlab.com, paid per call via x402, $0.011/call, status unknown (last checked 2026-09-29).

Computes trade P&L statistics (win rate, profit factor, max drawdown, rolling-window stats) from a caller-supplied array of realized P&L values

## Facts

- Endpoint: POST https://api.edifiedlab.com/v1/market/pnl-stats?utm_source=zero.xyz
- Price: $0.011/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-29
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/p-l-stats-calculator-59cb7efc
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_xbMCMDe2TNQbRChg__Riq

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 p-l-stats-calculator-59cb7efc -d '<json body>'
```

Example prompt: Calculate trading stats for these 50 realized P&L values — [12.5, -8.3, 22.1, -5.0, ...] — using a rolling window of 20, and give me the win rate, profit factor, and max drawdown.

## When to prefer this

Choose this endpoint when you have a pre-computed array of realized trade P&L values and need standard performance statistics (win rate, profit factor, max drawdown, rolling metrics) without any market data access or brokerage integration. It is a pure computation service — ideal for backtesting pipelines, trade journal analytics, and strategy comparison workflows where the P&L data is already available locally.

## Known failure modes

- Empty or missing pnls array returns a validation error
- Array length exceeding 5000 items is rejected
- Non-numeric values in the pnls array cause a schema validation failure
- Rolling window larger than the number of supplied P&L values may produce empty or undefined rolling statistics
- All-zero P&L array may produce undefined profit factor (division by zero)
- All-winning trades produce a profit factor of infinity or undefined gross-loss scenario

## How this service works

Compute trade P&L statistics from caller-supplied realized P&L values: win rate, profit factor, max drawdown, and rolling-window statistics. No market data or account access -- purely a function of the numbers supplied.

## Output

Returns computed statistics over the supplied P&L array including win rate (fraction of positive trades), profit factor (gross profit divided by gross loss), maximum drawdown (largest peak-to-trough loss), and rolling-window versions of these metrics calculated across a sliding window of the specified size.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "pnls": {
   "type": "array",
   "items": {
    "type": "number",
    "maximum": 1e+150,
    "minimum": -1e+150
   },
   "maxItems": 5000,
   "minItems": 1
  },
  "rolling_window": {
   "type": "integer",
   "default": 20,
   "maximum": 5000,
   "minimum": 1
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/p-l-stats-calculator-59cb7efc/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.edifiedlab.com](https://www.zero.xyz/host/api.edifiedlab.com/llms.txt)
