> ## Documentation Index
> Fetch the complete documentation index at: https://docs.solanatracker.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Canonical wallet overview (Polymarket)

> Returns lifecycle-aware positions and counts, authoritative marks and settlement values, FIFO PnL, portfolio value, and recent trades enriched with the same canonical market metadata as /v1/markets/batch.



## OpenAPI

````yaml /prediction-markets/openapi.json get /v1/accounts/{address}/overview
openapi: 3.1.0
info:
  title: Prediction Market API (Beta)
  description: >-
    Unified **beta** prediction market API for Kalshi and Polymarket — markets,
    events, full historical trades and candlesticks, orderbooks, crypto up/down
    windows, and Polymarket wallet analytics. Read/market-data only.


    **Auth:** pass your Data API key in the `x-api-key` header.


    **Conventions:** response bodies use camelCase. Query params are snake_case
    (camelCase aliases accepted where noted).


    **Caching:** SWR endpoints may set `X-Cache` (`HIT` | `HIT-STALE` | `MISS`).
    Busy backends may return `503` with `SERVICE_BUSY`.


    **Realtime:** join `pm:*` rooms on
    `wss://datastream.solanatracker.io/{apiKey}` (same Datastream hub as other
    products — see Datastream → Prediction Markets).
  license:
    name: ''
  version: 0.1.0
servers:
  - url: https://prediction-market-api.solanatracker.io
    description: Public beta
security:
  - apiKey: []
tags:
  - name: Exchange
    description: Exchange status
  - name: Events
    description: >-
      Cross-exchange event groupings (Kalshi event_ticker, Polymarket Gamma
      grouped/negRisk events). Includes metadata: image, icon, description,
      tags, and nested markets with groupItemTitle.
  - name: Crypto
    description: >-
      Polymarket crypto up/down (Chainlink) Price to Beat, final price, chart
      history, and series windows.
  - name: Meta
    description: Categories, series, sports, live data
  - name: Markets
    description: Market data, orderbooks, candles
  - name: Trades
    description: Trade feeds
  - name: Accounts
    description: Polymarket wallet analytics (FIFO PnL)
  - name: Leaderboard
    description: Top wallet PnL rankings (Polymarket; Kalshi has no public wallets)
  - name: Stats
    description: Platform statistics
paths:
  /v1/accounts/{address}/overview:
    get:
      tags:
        - Accounts
      summary: Canonical wallet overview (Polymarket)
      description: >-
        Returns lifecycle-aware positions and counts, authoritative marks and
        settlement values, FIFO PnL, portfolio value, and recent trades enriched
        with the same canonical market metadata as /v1/markets/batch.
      operationId: get_account_overview_path
      parameters:
        - name: address
          in: path
          description: Ethereum wallet address (0x…)
          required: true
          schema:
            type: string
        - name: fresh
          in: query
          description: Bypass Redis and exercise the exact ClickHouse serving path
          required: false
          schema:
            type: boolean
      responses:
        '200':
          description: Wallet overview
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WalletOverviewResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorBody'
        '408':
          description: Request timeout
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorBody'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorBody'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorBody'
components:
  schemas:
    WalletOverviewResponse:
      type: object
      description: Wallet overview bundle response.
      required:
        - address
        - value
        - pnl
        - positions
        - recentTrades
      properties:
        address:
          type: string
        pnl:
          $ref: '#/components/schemas/WalletPnlSummary'
        positions:
          $ref: '#/components/schemas/PaginatedWalletPositions'
        recentTrades:
          $ref: '#/components/schemas/TradesEnrichedResponse'
        value:
          $ref: '#/components/schemas/PortfolioValueResponse'
    ApiErrorBody:
      type: object
      description: Standard API error response envelope.
      required:
        - error
        - code
      properties:
        code:
          type: integer
          format: int32
          description: HTTP status code (duplicated for convenience).
          minimum: 0
        error:
          type: string
        errorCode:
          type:
            - string
            - 'null'
          description: >-
            Stable machine-readable code: RATE_LIMITED, SERVICE_BUSY,
            BAD_REQUEST, NOT_FOUND, INTERNAL.
    WalletPnlSummary:
      type: object
      description: Wallet-level PnL summary across all positions.
      required:
        - address
        - exchange
        - costMethod
        - totalInvestedUsd
        - totalProceedsUsd
        - realizedPnlUsd
        - unrealizedPnlUsd
        - totalPnlUsd
        - marketsTraded
        - openPositions
        - activePositionCount
        - heldTokenPositionCount
        - redeemablePositionCount
        - resolvedPositionCount
        - positions
      properties:
        activePositionCount:
          type: integer
          minimum: 0
        address:
          type: string
          description: The wallet address.
        costMethod:
          type: string
          description: Cost basis method (`fifo`).
        exchange:
          $ref: '#/components/schemas/Exchange'
          description: >-
            Exchange (Polymarket on-chain; Kalshi has no public wallet
            addresses).
        heldTokenPositionCount:
          type: integer
          minimum: 0
        marketsTraded:
          type: integer
          description: Number of distinct markets traded.
          minimum: 0
        openPositions:
          type: integer
          description: Number of positions currently open (net_tokens > 0).
          minimum: 0
        positions:
          type: array
          items:
            $ref: '#/components/schemas/WalletPosition'
          description: Individual position details.
        realizedPnlUsd:
          type: number
          format: double
          description: Sum of realized PnL across all closed/partially-closed positions.
        redeemablePositionCount:
          type: integer
          minimum: 0
        resolvedPositionCount:
          type: integer
          minimum: 0
        totalInvestedUsd:
          type: number
          format: double
          description: Total USDC spent across all positions.
        totalPnlUsd:
          type: number
          format: double
          description: Net PnL (realized + unrealized).
        totalProceedsUsd:
          type: number
          format: double
          description: Total USDC received from sells.
        unrealizedPnlUsd:
          type: number
          format: double
          description: >-
            Sum of unrealized PnL for open positions (where current price is
            known).
    PaginatedWalletPositions:
      type: object
      required:
        - data
        - count
        - hasMore
      properties:
        count:
          type: integer
          minimum: 0
        cursor:
          type:
            - string
            - 'null'
        data:
          type: array
          items:
            $ref: '#/components/schemas/WalletPosition'
        hasMore:
          type: boolean
    TradesEnrichedResponse:
      type: object
      description: Trade feed with optional embedded market/event context.
      required:
        - data
        - count
        - hasMore
      properties:
        count:
          type: integer
          minimum: 0
        cursor:
          type:
            - string
            - 'null'
        data:
          type: array
          items:
            $ref: '#/components/schemas/UnifiedTrade'
        events:
          type:
            - object
            - 'null'
          additionalProperties:
            $ref: '#/components/schemas/EventSummary'
          propertyNames:
            type: string
        hasMore:
          type: boolean
        markets:
          type:
            - object
            - 'null'
          additionalProperties:
            $ref: '#/components/schemas/UnifiedMarket'
          propertyNames:
            type: string
    PortfolioValueResponse:
      type: object
      description: Total portfolio value for a wallet.
      required:
        - address
        - exchange
        - totalValueUsd
        - openPositionCount
        - timestamp
      properties:
        address:
          type: string
        cashBalanceUsd:
          type: number
          format: double
          description: >-
            Spendable Polymarket collateral balance (pUSD + USDC.e) in the
            wallet.
        exchange:
          $ref: '#/components/schemas/Exchange'
        openPositionCount:
          type: integer
          description: >-
            Backward-compatible name for the authoritative active-position
            count.
          minimum: 0
        positionsValueUsd:
          type: number
          format: double
          description: Mark-to-market value of open / redeemable outcome tokens only.
        timestamp:
          type: string
          description: ISO-8601 timestamp.
        totalValueUsd:
          type: number
          format: double
          description: Positions mark value + spendable collateral (pUSD / USDC.e).
    Exchange:
      type: string
      enum:
        - polymarket
        - kalshi
    WalletPosition:
      type: object
      description: A single position (holding) in a prediction market outcome token.
      required:
        - assetId
        - exchange
        - positionStatus
        - marketStatus
        - isActive
        - isResolved
        - isRedeemable
        - isRedeemed
        - netTokens
        - avgCostBasis
        - totalCostUsd
        - totalProceedsUsd
        - realizedPnlUsd
        - buyCount
        - sellCount
        - resolved
        - firstTradeAt
        - lastTradeAt
      properties:
        assetId:
          type: string
          description: The outcome token's asset ID.
        avgCostBasis:
          type: number
          format: double
          description: Average cost basis per token (0.0–1.0 probability scale).
        buyCount:
          type: integer
          format: int64
          description: Number of buy fills.
          minimum: 0
        costMethod:
          type:
            - string
            - 'null'
          description: Cost basis method used (`fifo`).
        currentPrice:
          type:
            - number
            - 'null'
          format: double
          description: Current market price for this outcome (0.0–1.0).
        eventId:
          type:
            - string
            - 'null'
          description: Parent Gamma event id when known.
        eventSlug:
          type:
            - string
            - 'null'
          description: Parent Gamma event slug when known.
        eventTitle:
          type:
            - string
            - 'null'
          description: Parent event title when known.
        exchange:
          $ref: '#/components/schemas/Exchange'
          description: Exchange this position is on.
        firstTradeAt:
          type: string
          description: ISO-8601 first trade time.
        groupItemTitle:
          type:
            - string
            - 'null'
        isActive:
          type: boolean
        isRedeemable:
          type: boolean
        isRedeemed:
          type: boolean
        isResolved:
          type: boolean
        lastTradeAt:
          type: string
          description: ISO-8601 last trade time.
        markPrice:
          type:
            - number
            - 'null'
          format: double
          description: Authoritative current or final settlement mark.
        marketId:
          type:
            - string
            - 'null'
          description: Polymarket condition id when resolved.
        marketStatus:
          $ref: '#/components/schemas/MarketStatus'
        marketTitle:
          type:
            - string
            - 'null'
          description: Human-readable market title/question (if we can resolve it).
        netTokens:
          type: number
          format: double
          description: Net tokens held (positive = long, negative = short / oversold).
        outcomeIndex:
          type:
            - integer
            - 'null'
          format: int32
          minimum: 0
        outcomeLabel:
          type:
            - string
            - 'null'
        positionStatus:
          $ref: '#/components/schemas/PositionStatus'
        positionValueUsd:
          type:
            - number
            - 'null'
          format: double
          description: Value of remaining tokens at the authoritative mark.
        realizedPnlUsd:
          type: number
          format: double
          description: Realized FIFO PnL, including final settlement PnL once resolved.
        remainingCostBasisUsd:
          type:
            - number
            - 'null'
          format: double
          description: Unsettled cost basis; zero after authoritative market settlement.
        resolved:
          type: boolean
          description: True once the outcome has an authoritative settlement value.
        returnPct:
          type:
            - number
            - 'null'
          format: double
          description: Return on remaining FIFO cost basis.
        sellCount:
          type: integer
          format: int64
          description: Number of sell fills.
          minimum: 0
        settledTokens:
          type:
            - number
            - 'null'
          format: double
          description: >-
            Shares economically settled at the final payout (resolved positions
            only).
        settlementValueUsd:
          type:
            - number
            - 'null'
          format: double
          description: Final payout value of the remaining shares when resolved.
        totalCostUsd:
          type: number
          format: double
          description: Total USDC spent acquiring this position.
        totalProceedsUsd:
          type: number
          format: double
          description: Total USDC received from partial sells.
        unrealizedPnlUsd:
          type:
            - number
            - 'null'
          format: double
          description: >-
            Unrealized PnL for unresolved positions; zero after authoritative
            settlement.
    UnifiedTrade:
      type: object
      description: A single trade in normalized form.
      required:
        - id
        - exchange
        - marketId
        - price
        - quantity
        - side
        - timestampMs
      properties:
        countFp:
          type:
            - string
            - 'null'
          description: Official Kalshi count_fp string (lossless contract quantity).
        eventId:
          type:
            - string
            - 'null'
          description: Parent event id (Polymarket Gamma id / Kalshi event_ticker).
        eventSlug:
          type:
            - string
            - 'null'
          description: Parent event slug when available.
        eventTitle:
          type:
            - string
            - 'null'
          description: Canonical parent event title.
        exchange:
          $ref: '#/components/schemas/Exchange'
        groupItemTitle:
          type:
            - string
            - 'null'
          description: Label within a grouped event (for example, "Spain").
        id:
          type: string
          description: 'Trade ID (Kalshi: trade_id, Polymarket: tx_hash:log_index).'
        image:
          type:
            - string
            - 'null'
          description: Market or event image URL for feed cards.
        isCombo:
          type:
            - boolean
            - 'null'
          description: True for Polymarket combinatorial (combo) outcomes.
        marketId:
          type: string
          description: Market identifier (Kalshi ticker or Polymarket asset_id).
        noPrice:
          type:
            - number
            - 'null'
          format: double
          description: Kalshi no-leg reference price (same as `price` when side is no).
        noPriceDollars:
          type:
            - string
            - 'null'
          description: Official Kalshi no_price_dollars string (lossless).
        outcomeIndex:
          type:
            - integer
            - 'null'
          format: int32
          description: Direct outcome index for this traded outcome token.
          minimum: 0
        outcomeLabel:
          type:
            - string
            - 'null'
          description: Direct outcome label for this traded outcome token.
        price:
          type: number
          format: double
          description: Execution price for the taker outcome (0.0–1.0).
        quantity:
          type: number
          format: double
          description: Number of contracts / quantity.
        quantityE2:
          type:
            - integer
            - 'null'
          format: int64
          description: Quantity in hundredths of a contract (Kalshi v2).
        side:
          type: string
          description: >-
            Taker outcome: "yes" or "no" (Kalshi and Polymarket per-market),
            "buy"/"sell" (Polymarket global without enrichment).
        timestampMs:
          type: integer
          format: int64
          description: Unix timestamp in milliseconds.
        traderAddress:
          type:
            - string
            - 'null'
          description: >-
            Wallet that initiated the trade (Polymarket taker; Kalshi is
            anonymous).
        traderUsername:
          type:
            - string
            - 'null'
          description: >-
            Public Polymarket username for `traderAddress`; null for
            anonymous/private profiles.
        txHash:
          type:
            - string
            - 'null'
          description: Transaction hash (Polymarket only).
        yesPrice:
          type:
            - number
            - 'null'
          format: double
          description: Kalshi yes-leg reference price (same as `price` when side is yes).
        yesPriceDollars:
          type:
            - string
            - 'null'
          description: Official Kalshi yes_price_dollars string (lossless).
        yesPriceE6:
          type:
            - integer
            - 'null'
          format: int64
          description: Price in millionths of a dollar (Kalshi v2).
    EventSummary:
      type: object
      description: Lightweight event summary embedded on trade feeds.
      required:
        - id
        - title
      properties:
        category:
          type:
            - string
            - 'null'
        id:
          type: string
        image:
          type:
            - string
            - 'null'
        slug:
          type:
            - string
            - 'null'
        title:
          type: string
    UnifiedMarket:
      type: object
      description: >-
        A single market in normalized form.


        Polymarket markets in grouped events include `eventId`, `eventSlug`,
        `groupItemTitle`,

        `description`, `image`, and `icon`. Kalshi markets include `eventTicker`
        and optional `kalshi` metadata.
      required:
        - id
        - exchange
        - marketKind
        - title
        - slug
        - status
        - outcomes
        - volume
        - pricingMode
        - isTradable
        - hasDepth
      properties:
        category:
          type:
            - string
            - 'null'
          description: Category/tag for this market.
        clobTokenIds:
          type: array
          items:
            type: string
          description: |-
            Polymarket CLOB outcome token IDs, ordered to match `outcomes`.
            Use these IDs for `pm:market:polymarket:{tokenId}:*` realtime rooms.
        closeDate:
          type:
            - string
            - 'null'
          description: ISO-8601 market close / expiry time.
        collectionId:
          type:
            - string
            - 'null'
          description: Official multivariate/collection id when present.
        comboEligible:
          type: boolean
          description: Whether this market can be selected as one leg in a combo builder.
        comboGroup:
          type:
            - string
            - 'null'
          description: UI grouping key for combo builders.
        createdAt:
          type:
            - string
            - 'null'
          description: ISO-8601 creation time.
        description:
          type:
            - string
            - 'null'
          description: Long-form market description (Polymarket Gamma).
        eventId:
          type:
            - string
            - 'null'
          description: Polymarket Gamma event id (numeric string, e.g. "30615").
        eventSlug:
          type:
            - string
            - 'null'
          description: Polymarket event slug (e.g. "world-cup-winner").
        eventTicker:
          type:
            - string
            - 'null'
          description: Kalshi event_ticker for grouping related markets.
        eventTitle:
          type:
            - string
            - 'null'
          description: >-
            Canonical parent event title (distinct from the child market/group
            title).
        exchange:
          $ref: '#/components/schemas/Exchange'
          description: Source exchange.
        gammaMarketId:
          type:
            - string
            - 'null'
          description: Polymarket Gamma numeric market id (distinct from condition_id).
        groupItemTitle:
          type:
            - string
            - 'null'
          description: Label within a grouped Polymarket event (e.g. "France").
        hasDepth:
          type: boolean
          description: Whether the indexed orderbook currently has executable depth.
        icon:
          type:
            - string
            - 'null'
          description: Market icon URL (Polymarket Gamma).
        id:
          type: string
          description: >-
            Unique identifier within its exchange (ticker for Kalshi,
            condition_id for Polymarket).
        image:
          type:
            - string
            - 'null'
          description: Market image URL (Polymarket Gamma).
        isTradable:
          type: boolean
          description: Whether the market can currently accept orders or RFQs.
        legCount:
          type: integer
          description: Number of component markets in a combo.
          minimum: 0
        legs:
          type: array
          items:
            $ref: '#/components/schemas/MarketLeg'
          description: Structured combo legs. Empty for ordinary markets.
        line:
          type:
            - number
            - 'null'
          format: double
          description: Numeric spread/total threshold where applicable.
        liquidity:
          type:
            - number
            - 'null'
          format: double
          description: Available liquidity (Polymarket only).
        marketKind:
          $ref: '#/components/schemas/MarketKind'
          description: Product shape. Kalshi multivariate/parlay products are `combo`.
        materializationState:
          type:
            - string
            - 'null'
          description: Materialization state for prebuilt/multivariate contracts.
        openInterest:
          type:
            - integer
            - 'null'
          format: int64
          description: Open interest in contracts (Kalshi only).
          minimum: 0
        outcomeIndex:
          type:
            - integer
            - 'null'
          format: int32
          description: >-
            Selected outcome index when this market was resolved by
            outcome-token asset ID.
          minimum: 0
        outcomeLabel:
          type:
            - string
            - 'null'
          description: >-
            Selected outcome label when this market was resolved by
            outcome-token asset ID.
        outcomes:
          type: array
          items:
            $ref: '#/components/schemas/UnifiedOutcome'
          description: Possible outcomes with current prices (0.0–1.0 probability).
        parentEventUrl:
          type:
            - string
            - 'null'
          description: Parent multivariate event URL for combo products.
        pricingMode:
          $ref: '#/components/schemas/PricingMode'
          description: Price discovery mechanism.
        rawTitle:
          type:
            - string
            - 'null'
          description: >-
            Original exchange title when the API supplies a normalized display
            title.
        seriesTicker:
          type:
            - string
            - 'null'
          description: Machine series ticker supplied by Kalshi.
        seriesTitle:
          type:
            - string
            - 'null'
          description: Canonical series title when supplied by the exchange.
        settlementRule:
          type:
            - string
            - 'null'
          description: Settlement semantics for combo products.
        slug:
          type: string
          description: 'URL-safe slug (Kalshi: lowercase ticker, Polymarket: slug field).'
        sportsMarketType:
          type:
            - string
            - 'null'
          description: >-
            Exchange-native sports market type (moneyline, totals, spread,
            etc.).
        status:
          type: string
          description: 'Market status: "active", "closed", "settled".'
        tags:
          type: array
          items:
            type: string
          description: Normalized discovery tags.
        ticker:
          type:
            - string
            - 'null'
          description: Raw Kalshi ticker. `id` remains the cross-exchange identifier.
        title:
          type: string
          description: Human-readable title/question.
        tradeCount24h:
          type:
            - integer
            - 'null'
          format: int64
          description: Rolling 24-hour trade count from the indexed tape (when available).
          minimum: 0
        url:
          type:
            - string
            - 'null'
          description: Direct link to the market on its native platform.
        volume:
          type: number
          format: double
          description: Total all-time volume (USD).
        volume24h:
          type:
            - number
            - 'null'
          format: double
          description: Rolling 24-hour volume (USD, if available).
    MarketStatus:
      type: string
      enum:
        - active
        - closed_pending_resolution
        - resolved
        - inactive
    PositionStatus:
      type: string
      enum:
        - active
        - closed
        - closed_pending_resolution
        - resolved_won
        - resolved_lost
        - resolved
        - redeemed
    MarketLeg:
      type: object
      required:
        - label
        - side
      properties:
        eventDate:
          type:
            - string
            - 'null'
        exclusionGroup:
          type:
            - string
            - 'null'
          description: Exclusion/conflict group for mutually exclusive legs.
        label:
          type: string
        lifecycleStatus:
          type:
            - string
            - 'null'
          description: 'Per-leg lifecycle: open, suspended, settled, void.'
        officialLegId:
          type:
            - string
            - 'null'
          description: Official exchange leg/position identifier when available.
        positionId:
          type:
            - string
            - 'null'
          description: Exchange-native position/outcome id for this leg.
        side:
          $ref: '#/components/schemas/MarketLegSide'
        sport:
          type:
            - string
            - 'null'
        underlyingMarketId:
          type:
            - string
            - 'null'
        underlyingTitle:
          type:
            - string
            - 'null'
    MarketKind:
      type: string
      enum:
        - binary
        - categorical
        - combo
    UnifiedOutcome:
      type: object
      description: A single binary or multi-category outcome with a price.
      required:
        - label
        - price
      properties:
        label:
          type: string
          description: >-
            Outcome label (Yes/No, or custom e.g. country name in grouped
            markets).
        price:
          type: number
          format: double
          description: Current probability (0.0–1.0).
    PricingMode:
      type: string
      enum:
        - orderbook
        - rfq
    MarketLegSide:
      type: string
      enum:
        - 'yes'
        - 'no'
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: Solana Tracker Data API key

````