# finmath Kelly Criterion Calculator

> finmath Kelly Criterion Calculator is a paid API for AI agents from finmath.qzqh5rrbkz.workers.dev, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-15).

Computes the optimal Kelly Criterion fraction — the theoretically ideal bet size as a fraction of bankroll — given a win probability and win/loss ratio.

## Facts

- Endpoint: POST https://finmath.qzqh5rrbkz.workers.dev/v1/kelly_criterion
- 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/finmath-kelly-criterion-calculator-a18df9fa
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_QtkFdz1rfze4nt6LO5Xei

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 finmath-kelly-criterion-calculator-a18df9fa -d '<json body>'
```

Example prompt: What's the optimal Kelly Criterion bet fraction if I have a 55% win probability and my average win is 2x my average loss?

## When to prefer this

Use this endpoint when you need exact, deterministic Kelly Criterion math rather than relying on an LLM's approximation, which is known to make arithmetic errors. Ideal for algorithmic trading agents, portfolio optimizers, or gambling strategy bots that require provably correct position sizing without floating-point ambiguity.

## Known failure modes

- win_prob outside [0,1] range returns validation error
- win_loss_ratio of zero or negative may cause division error or undefined result
- missing required fields (win_prob or win_loss_ratio) returns 400 bad request
- win_prob of exactly 0 or 1 returns degenerate Kelly fractions (0 or undefined)
- payment failure (402) if USDC balance insufficient for $0.001 per call fee

## How this service works

Deterministic finance and crypto math for AI agents: TradFi (NPV, IRR, XIRR, Black-Scholes + Greeks, bonds, VaR, Sharpe) and DeFi (impermanent loss, perp liquidation, funding, Uniswap v3, health factor, cost basis). Exact, model-free arithmetic that LLMs get wrong — priced per call in USDC.

## Output

Returns a result object containing the computed Kelly fraction (a number between 0 and 1 representing the optimal bankroll percentage to wager), plus a meta object with call metadata such as cost and request details.

## Example request

```json
{
 "win_prob": 0.55,
 "win_loss_ratio": 2
}
```

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "win_prob",
  "win_loss_ratio"
 ],
 "properties": {
  "win_prob": {
   "type": "number",
   "description": "win_prob"
  },
  "win_loss_ratio": {
   "type": "number",
   "description": "win_loss_ratio"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "result",
  "meta"
 ],
 "properties": {
  "meta": {
   "type": "object"
  },
  "result": {}
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/finmath-kelly-criterion-calculator-a18df9fa/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from finmath.qzqh5rrbkz.workers.dev](https://www.zero.xyz/host/finmath.qzqh5rrbkz.workers.dev/llms.txt)
