All positions (open and closed) with accurate realized P&L from onchain settlement data.
realized_pnl, avg_price, and total_bought from onchain data.
The standard /v1/wallets/{addr}/positions endpoint only returns open positions. Once a position is fully exited or a market resolves, it disappears. This endpoint fills that gap.
| Parameter | Type | Description |
|---|---|---|
address | path | Wallet address (0x-prefixed, 40 hex chars) |
| Field | Type | Description |
|---|---|---|
wallet | string | Queried wallet address (lowercased) |
source | string | Always "onchain" |
count | number | Total positions returned |
open_count | number | Positions with size > 0 |
closed_count | number | Positions with size = 0 and nonzero realized_pnl |
total_realized_pnl | number | Sum of realized_pnl across all positions |
positions_with_pnl | number | Positions where realized_pnl != 0 |
positions[].token_id | string | CTF token ID (called asset on the closed-positions endpoint) |
positions[].size | number | Current token balance (0 = fully exited) |
positions[].avg_price | number | Volume-weighted average entry price |
positions[].realized_pnl | number | Realized profit/loss in USDC |
positions[].total_bought | number | Total tokens acquired for this position |
positions[].market | string | Market question |
positions[].slug | string | Market slug |
positions[].outcome | string | Outcome label (e.g. “Yes”, “No”, “Up”) |
positions[].image | string | Market image URL |
positions[].condition_id | string | Market condition ID |
realized_pnl Worksrealized_pnl reflects the profit or loss after the position is closed (sold or redeemed). For a winning binary position bought at 1.00:
avg_price = 0.40total_bought = 10,000 (tokens acquired)realized_pnl = 4,000 = $6,000realized_pnl = total_bought × (1 - avg_price) for positions that resolve at $1.
Per-position values (realized_pnl, avg_price, total_bought) come from the same onchain settlement data that Polymarket uses. Individual position P&L matches what Polymarket shows on its portfolio page.
total_realized_pnl vs Polymarket Profile PnLtotal_realized_pnl is the sum of all individual position realized_pnl values. This number will be higher than the PnL shown on a Polymarket profile page because they measure different things.
What total_realized_pnl measures: Total profit taken off the table from closed and resolved positions. This is money the wallet has already extracted.
What Polymarket’s profile PnL measures: Net portfolio performance, which accounts for capital still deployed in open positions.
A wallet with 14M in cost basis locked in open positions shows ~$3M on Polymarket’s profile. Both numbers are correct:
| Metric | Value | Source |
|---|---|---|
| Realized gains from closed positions | $17,183,579 | total_realized_pnl from this endpoint |
| Cost basis deployed in open positions | -$14,398,655 | sum(size × avg_price) for positions where size > 0 |
| Unrealized gains on open positions | +$51,653 | Current market prices vs entry prices |
| Net portfolio PnL | $2,834,935 | Trader profile totalPnl |
totalPnl directly.
total_realized_pnl when you want to know how much profit a wallet has actually extracted. Use the trader profile totalPnl when you want the number that matches a Polymarket profile page.| Positions | First request | Cached |
|---|---|---|
| < 500 | ~1s | < 50ms |
| 500-1,000 | ~1.5s | < 50ms |
| 1,000-5,000 | ~3s | < 50ms |