List positions for a user or market
A keyset page of positions in the standard
{ data, pagination } envelope. One route serves a user’s open book, their
closed book (status=CLOSED), and a market’s holders (market anchor).
At least one of user/condition is required. Supplying both anchors on the
user and applies condition as a narrowing filter.
status defaults to OPEN, which is the superset: a
settled-but-unredeemed winner still holds its tokens, so it is an open
position whose condition resolved. REDEEMABLE narrows to that subset, and
each row echoes its own status.
When user is the active wallet of a Polymarket account that owns other
wallets, status=CLOSED returns every wallet’s closed positions; each
row’s proxy_wallet names the wallet it belongs to. OPEN and
REDEEMABLE read the requested wallet.
Resume contract: a next_cursor binds the status/sortBy/sortDirection
the walk started with. To follow it, send cursor together with the same
user or condition anchor used on the first page; a bare ?cursor= request
returns 400. The token is the authority on the spine and the total order,
and the handler adopts all three from it. Restating them is allowed and
must agree;
explicitly contradicting one is a 400, because replaying an anchor under
a different spine or order would silently walk a different result set.
Omitting them is not a contradiction; a defaulted status is the absence of
a choice, not a request for OPEN.
User CLOSED residual sorts bind their realized-PnL ranking in the signed
cursor kind. Earlier cursors for those sorts return 400 and require restarting
pagination without cursor, because their numeric anchor has ambiguous units.
A malformed condition id is a 400 naming the value; a
well-formed one that matches nothing serves an empty data array, which
is the meaningful zero-state; absence means the market is not servable,
and only that.
Query Parameters
One of OPEN, REDEEMABLE, REDEEMABLE_LOST, MERGEABLE, or CLOSED;
defaults to OPEN. REDEEMABLE_LOST requires user, supports every
sort but AVG_PRICE, and defaults to CURRENT_VALUE; it preserves row status
REDEEMABLE. MERGEABLE is OPEN narrowed to live complementary pairs
(conditions where the wallet holds >= 2 servable-live tokens) and defaults
to TOKENS; it is user-scoped, so a market-anchored request renders as
OPEN.
OPEN is the superset; it includes settled-but-unredeemed winners,
which REDEEMABLE narrows to. CLOSED is exited positions.
Case-insensitive market-title substring filter, honoured on every
anchor and status. SQL LIKE wildcards (%, _) keep their usual
meaning; empty or whitespace-only is treated as absent; at most 200
characters. NOT carried by the cursor: re-send it on every page of a
walk (like condition and the start/end window), or the cohort
silently widens.
The filter floor. TOKENS: minimum CURRENT holding in shares
(defaults to the 0.1 dust floor; applies to OPEN/REDEEMABLE; a
user's CLOSED set is not narrowed by it, and on a market anchor it
moves the OPEN/CLOSED boundary). CASH: minimum mark-to-market
current_value in USDC, on top of the token dust floor. Invalid
values fall back to the default.
One of CURRENT_VALUE, PRICE, AVG_PRICE, TOKENS, UNREALIZED_PNL,
REALIZED_PNL, TOTAL_PNL, or TIMESTAMP (the row's last_event_at).
PRICE ranks by the response's effective current_price on every
supported anchor and status. AVG_PRICE ranks by the response's
avg_price (the entry price); a user's CLOSED and REDEEMABLE_LOST
positions reject it until they have an indexed path for it. On REDEEMABLE, the existing winners-first
partition remains ahead of the requested price order. The default
follows the status: CURRENT_VALUE for OPEN/REDEEMABLE,
REALIZED_PNL for CLOSED. On a user's CLOSED positions, TOKENS,
CURRENT_VALUE, PRICE and UNREALIZED_PNL describe a holding that no
longer exists, so those pages are served in REALIZED_PNL order.
Inclusive upper bound on last_event_at, epoch seconds; omit or 0 for
unbounded.
A position with no native economics carries no last_event_at and is
therefore excluded by any bound, in either direction; a window asks
which positions moved inside it, and a row with no clock has no answer.
Unbounded requests still serve those rows.