# Layer Prediction Market Position Sizer

> Layer Prediction Market Position Sizer is a paid API for AI agents from uselayer.sh, paid per call via x402, $0.02/call, status unknown (last checked 2026-11-17).

Calculates the optimal contract size to trade across Kalshi and Polymarket order books, returning profitability, edge, and limiting venue given ask arrays and a minimum edge threshold.

## Facts

- Endpoint: POST https://uselayer.sh/v0/size?utm_source=zero.xyz
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-17
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/layer-prediction-market-position-sizer-e3d51555
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_jrkXca-jGS-dVE_j5Dtwd

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 layer-prediction-market-position-sizer-e3d51555 -d '<json body>'
```

Example prompt: I want to trade the 'Fed rate cut by December' market — here are the ask arrays from Kalshi and Polymarket, can you calculate the optimal number of contracts to buy given a minimum edge of 1.5% and tell me if the trade is profitable?

## When to prefer this

Use this endpoint when you need to compute an optimal trade size across Kalshi and/or Polymarket before placing an order, especially when you want to enforce a minimum edge threshold and understand which venue's liquidity is the binding constraint. Prefer this over manual calculation or generic math tools because it understands prediction market order book structure and returns venue-aware sizing natively. Best suited for algorithmic trading workflows where position sizing must be computed programmatically in real time.

## Known failure modes

- Empty or malformed ask arrays return an error or zero contracts
- No profitable size found when min_edge is too high returns profitable: false with contracts: 0
- Missing required kalshi.asks field causes a 400 validation error
- Stale order book data may cause calculated edge to differ from live market
- Payment failure (x402) causes the call to be rejected before computation

## How this service works

One API for prediction markets. Find markets, stream normalized data, place orders, and track positions across Kalshi and Polymarket.

## Output

Returns a JSON object with: 'contracts' (integer number of contracts to trade), 'net_profit' (expected profit in dollars), 'profitable' (boolean), 'edge_at_best' (fractional edge at the best price level), and 'limited_by' (string identifying which venue's order book is the binding constraint, e.g. 'kalshi_book').

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "kalshi": {
   "type": "object",
   "required": [
    "asks"
   ],
   "properties": {
    "asks": {
     "type": "array"
    }
   }
  },
  "min_edge": {
   "type": "number"
  },
  "polymarket": {
   "type": "object",
   "properties": {
    "asks": {
     "type": "array"
    }
   }
  },
  "polymarket_us": {
   "type": "object",
   "properties": {
    "asks": {
     "type": "array"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "contracts": 100,
  "limited_by": "kalshi_book",
  "net_profit": 1.2,
  "profitable": true,
  "edge_at_best": 0.012
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/layer-prediction-market-position-sizer-e3d51555/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from uselayer.sh](https://www.zero.xyz/host/uselayer.sh/llms.txt)
