Skip to main content
GET
/
v2
/
clob
/
positions
curl "https://api.pmx.trade/v2/clob/positions?pubkey=7xKXabc123..."
{
  "positions": [
    {
      "id": "d4e5f6a7-...",
      "marketId": "550e8400-...",
      "ownerPubkey": "7xKXabc123...",
      "outcome": "yes",
      "netQuantity": "50000000",
      "avgEntryPrice": 5500,
      "totalCost": "27500000",
      "totalProceeds": "0",
      "totalFees": "550000",
      "realizedPnl": "0",
      "unrealizedPnl": "2500000",
      "currentPrice": 6000,
      "marketSlug": "btc-100k-2025",
      "marketTitle": "Will BTC hit $100K?",
      "marketStatus": "active",
      "updatedAt": "2025-01-15T12:05:00.000Z"
    }
  ]
}
Returns all positions for the specified wallet with cost basis, realized P&L, and on-the-fly unrealized P&L computed from current orderbook prices. Only positions with non-zero holdings or realized P&L are returned.

Query parameters

pubkey
string
required
The Solana wallet public key (base58-encoded).
marketId
string
Filter by market UUID. If omitted, returns positions across all markets.

Response

positions
array
curl "https://api.pmx.trade/v2/clob/positions?pubkey=7xKXabc123..."
{
  "positions": [
    {
      "id": "d4e5f6a7-...",
      "marketId": "550e8400-...",
      "ownerPubkey": "7xKXabc123...",
      "outcome": "yes",
      "netQuantity": "50000000",
      "avgEntryPrice": 5500,
      "totalCost": "27500000",
      "totalProceeds": "0",
      "totalFees": "550000",
      "realizedPnl": "0",
      "unrealizedPnl": "2500000",
      "currentPrice": 6000,
      "marketSlug": "btc-100k-2025",
      "marketTitle": "Will BTC hit $100K?",
      "marketStatus": "active",
      "updatedAt": "2025-01-15T12:05:00.000Z"
    }
  ]
}
Unrealized P&L is computed as (netQuantity × currentPrice / 10000) - totalCost. It uses the orderbook mid-price (average of best bid and best ask). If only one side has liquidity, that price is used. Returns null if no orders exist.Realized P&L accumulates each time you sell tokens. On each sell, the engine computes proceeds - proportionalCostBasis - fees using weighted average cost.