prediction.polymarket_fee_estimate
Estimate Polymarket taker fees for a hypothetical fill using live fee rates and order-book quotes; excludes gas, slippage, and service charges.
Instructions
Polymarket's own taker fee (NOT gas, slippage, or AlphaPipeline's own
charge for this call) for a hypothetical fill of `shares` at `price`,
using the official bell-curve formula shares * fee_rate * price *
(1 - price). fee_rate is read live from Polymarket's own GET /fee-rate
for the exact token_id - never a hardcoded category table, since
per-category rates have changed before (see architecture-roadmap.md
Engineering Precision Backlog item 3). Makers pay 0 across every
category - this is the taker fee only. Omit price to use the live best
book quote for side (reuses the same order-book fetch as
prediction.exit_capacity_audit/order_split_guide - no new upstream call
in that case).
Args:
shares: Hypothetical fill size, in shares. Must be > 0.
token_id: The outcome's CLOB token_id / asset_id, if already known.
Provide either this OR market_slug.
market_slug: Exact Polymarket market slug, used to resolve token_id
automatically when not already known.
outcome: "yes" (default) or "no" - which side to resolve when using
market_slug. Ignored if token_id is given directly.
side: "sell" (default) or "buy" - which side of the book to read
price from when price is omitted.
price: Hypothetical fill price (0-1 exclusive). Omit to use the
live best book quote for side.
Returns:
On success: {"success": true, "fee_rate", "fee_usd", "price",
"base_fee_bp", ...}
On failure: {"success": false, "error": {"type", "message"}}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| side | No | sell | |
| price | No | ||
| shares | Yes | ||
| outcome | No | yes | |
| token_id | No | ||
| market_slug | No |