quantity
mirrors the outcome tokens your vault holds on-chain (trades, splits,
merges, neg-risk converts and redemptions all move it); cost basis and
P&L are computed from your trade, split, merge and
convert history.
Reading positions
Query parameters
There are no separate sub-endpoints such as
/stats or /history (e.g. GET /api/me/positions/stats or GET /api/me/positions/history). Aggregated statistics are returned directly in the top-level stats block, and history is fetched by filtering status=won, lost, voided, redeemed, or all. Pagination uses keyset cursors (cursor / limit), not offset page parameters.On wallets with multiple vaults, each position row also carries
vaultAddress, vaultGeneration, and vaultHoldings[].positions — the response is an object, not a bare
array. Every stats metric carries { value, status }; status is
unavailable when a metric could not be computed exactly, so branch on it
rather than trusting a 0. nextCursor / hasMore page it; omit limit and cursor to get the
full list in one call.
Field semantics
Quantity & Inventory
quantity— total outcome shares your vault holds on-chain for this outcome (decimal string, up to 6 decimals, trailing zeros trimmed:"250","250.5"). Moved by trades, splits, merges, neg-risk converts and redemptions. On resolved markets, retains the quantity held at resolution.availableQuantity— post-encumbrance shares available to sell or burn. Floored at0and accounts for open SELL orders as well as pending unsettled debits. Read this field directly rather than computingquantity − encumberedQuantity.encumberedQuantity— shares locked by open SELL orders and pending co-signed vault operations (e.g. merge or convert)."0"when nothing is reserved;nullonly for a never-locked token whenbalanceSourceisprojection, on resolved positions, and whereverquantityisnull.pendingQuantity— net shares from fills thatquantitydoes not carry yet: matched fills awaiting on-chain settlement, or fills that just settled on-chain while the balance shown still predates them (positive = shares still to be credited by a BUY, negative = shares still to be debited by a SELL).nullwhen zero, on resolved positions and whereverquantityisnull.
Valuation & P&L
avgCost— weighted average cost per share held (decimal USDC): the cash paid divided by shares acquired.null, withaccountingStatus: "unavailable", when cost basis cannot be reconstructed.costBasis— total USDC invested in currently held shares (quantity × avgCost).currentPrice— current outcome-token price (decimal string).null, withpricingStatus: "unavailable", when no price is available.markValue— mark-to-market valuation (quantity × currentPrice).realizedPnl— profit/loss already locked in: proceeds minus sell fees and cost basis on SELLs, plus winnings minus cost on redeemed positions. A merge of shares that a split minted adds nothing here, see Splits and merges; a neg-risk convert adds nothing either, see Neg-risk converts.unrealizedPnl—markValue − costBasisatcurrentPrice, plus the convert gain held on the shares (zero except on YES shares minted by a neg-risk convert, see Neg-risk converts);nullwhen currentPrice or costBasis is unavailable.payoutIfCorrect— maximum payout if this outcome wins (1 USDC per share, matchingquantity).
Trading Fees
feesPaidUsdc— lifetime trading fees paid on this (market, outcome) in USDC (decimal string,"0"when none). BUY fees are taken in shares and converted to USDC face value; SELL fees are USDC. Already reflected inavgCostandrealizedPnl, surfaced here for reporting.feesPaidShares— lifetime outcome-token fees taken on BUY legs (decimal string,"0"when none; same scale asquantity). Represents the in-kind haircut.feesPaidSharesPrice— price at which the BUY-leg token fee was valued, allowing decomposition:nullwhen no in-kind token fee was ever paid.
On MINT fills (both sides buying, settled via
splitPosition)
these fee fields are computed from the backend fee ledger at the
matched price, which can differ slightly from the amount taken on
chain. Treat them as indicative rather than chain-exact for those
fills; /api/me/fees carries the per-fill rows.Neg-risk converts
A convert ofa shares
over k NO legs burns a NO shares on each of those k questions, mints
a YES shares on each other question of the group and pays
(k − 1) × a USDC. For cost basis and P&L it is an exchange of
positions, not a sale: it realizes nothing. The burned NO shares leave
their positions with their whole cost, and the NO shares left keep
their average cost. With C the cost of the burned NO shares (all k legs
together) and P the payout:
- C ≥ P — C − P becomes the cost basis of the minted YES shares, split evenly over the minted questions.
- C < P — the minted YES shares come at cost
0and hold the gain P − C, split evenly over the minted questions (YES shares you already held on such a question keep the cost you paid for them). That gain counts inunrealizedPnland moves intorealizedPnlin proportion to the shares as they are sold or merged, or redeemed after the market resolves; until then it stays inunrealizedPnl, also on a resolved market. There is no field for it on its own: it isunrealizedPnl − (markValue − costBasis).
indexSet: "3").
P = (2 − 1) × 2 = 2 USDC and C = 4 × 0.60 = 2.40, so each NO position
keeps 1 share at avgCost 0.60 (costBasis 0.60), nothing is
realized, and the 2 YES shares minted on question 2 carry costBasis
0.40 (avgCost 0.20).
When the cost of a burned leg cannot be reconstructed (a burned NO
token that is not listed, an incomplete history, or one that does not
cover the burned amount), the convert
moves no cost and the positions it touches report
accountingStatus: "unavailable". On public profiles
(GET /api/users/{address}), stats.unrealizedPnl includes the
carried gain but stats.unrealizedPnlPercent does not: it is
Σ(markValue − costBasis) / Σ costBasis × 100 over the open positions.
Splits and merges
A split ofa USDC in a market with N outcomes mints a shares of
every outcome; for cost basis each share comes at 1/N (0.50 in a YES/NO
market). A merge pays 1/N per share it burns. How to split and merge is
under Split / Merge below.
- A merge first closes the split-minted shares you still hold on each outcome, at the 1/N they came at, so they realize nothing. Only the shares a merge burns beyond those (shares bought on the book, or minted by a neg-risk convert) close at the average cost of the remaining shares and realize 1/N minus that cost, plus their part of any convert gain.
- A sale closes shares at the average cost, so it reduces the split-minted count on that outcome in the same proportion; so do the NO shares a neg-risk convert burns.
quantity, avgCost and realizedPnl. Example (no
trading fees): you hold 1 YES bought at 0.40, then split 2 USDC and
merge 2 sets. You still hold 1 YES at avgCost 0.40 and nothing is
realized on YES or NO. Before release v2.26.2 a merge closed shares at
the average cost, so the same steps left YES at avgCost about 0.47
and booked about +0.07 on YES. Public profile stats and the leaderboard
use the same merge rule, except on positions a neg-risk convert
touched: the leaderboard does not model converts.
Redeeming a resolved position
With auto-redeem on (the default), the platform redeems voided-market refunds and winnings of at least 1 USDC per market into your vault within a few minutes, and those positions turnredeemed without a call from you. Whatever is still
redeemable — smaller winnings, or anything while auto-redeem is off —
you claim yourself. Auto-redeem also waits while
negRiskLinkagePending is true. The default open view lists
neither kind: pass status=redeemable to list what is still to claim
and status=redeemed for what has been claimed.
Once a market resolves, six fields drive the claim flow — plus the
negRiskLinkagePending fail-safe flag below. They are all on the
/api/me/positions response; redeemable is the gate.
Pick the redeem call from the data, not from the market’s name — but check
negRiskLinkagePending first, because it is the one case where negRisk
being null does not mean “binary”:
negRiskLinkagePending == true→ no redeem call is correct yet. See the warning below.- else
negRisk == null→ the binary path (conditionId). - else → the neg-risk path (
negRisk.marketId,negRisk.questionIndex).
Split / Merge
Availability: split / merge endpoints are available via partner
onboarding. The flow requires dual-signature calls to the user’s
vault.
Split — USDC → full outcome set
amount is human-readable USDC: an unsigned decimal above 0 and below
1e15 with at most 6 decimal places, at most 64 characters (marketId
is 1 to 128 printable ASCII characters without spaces); anything else
is 400 invalid_request. On a neg-risk market also send
outcomeIndex (the outcome whose YES + NO pair to mint). The response
carries signedOpId, the backend co-signature backendSig, and the
exact payload the vault verifies: kind, collateralToken,
conditionId, partition, amount (6-decimal units), salt and
deadline. Sign that SplitPosition typed data with the vault owner’s
key, then before deadline either post { signedOpId, ownerSig, backendSig }
to POST /api/me/positions/op-submit (the platform broadcasts it and
pays the gas) or call vault.splitPosition(kind, collateralToken, conditionId, partition, amount, salt, deadline, ownerSig, backendSig)
yourself. Typed-data layout and domain:
Vault contract reference.
Result: 100 USDC → 100 YES + 100 NO (binary).
A split counts toward the user’s own exposure limit like a BUY
(RND-3840); see
Own exposure limit on splits.
Merge — full outcome set → USDC
Symmetric:POST /api/vault/merge-signature with the same body, sign
MergePositions, then submit the same way (or call
vault.mergePositions(...)). Burns 1 YES + 1 NO, returns 1 USDC.
Both operations are dual-sig, state-machine-driven, and audited.