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

# Positions

> Two forms on one route.

**With `status=open`**: what the wallet holds now (unresolved positions and resolved ones not yet redeemed), valued at each token’s last fill price, biggest value first. Rows are WalletRows with `mark`, `markTs`, `value`, `unrealizedPnl` and `market`.

**With `status=closed`**: the same as Closed Positions.

**Without `status`**: the raw positions in the markets you name with `conditions` (both outcomes each, closed ones included), as `positions`. Name at least one market: without one it returns every position the wallet has.



## OpenAPI

````yaml /openapi.json get /v1/wallets/{wallet}/positions
openapi: 3.1.0
info:
  title: Codex API
  version: 1.0.0
  description: >-
    Nomos's Polymarket index, rebuilt from Polygon: holders, positions, PnL,
    trades, leaderboards and live fills.
servers:
  - url: https://codex-api.nomos.trade
security:
  - bearerAuth: []
tags:
  - name: Markets
  - name: Wallets
  - name: Leaderboard
  - name: Events
  - name: Fills
  - name: Crypto Strikes
  - name: Health
paths:
  /v1/wallets/{wallet}/positions:
    get:
      tags:
        - Wallets
      summary: Positions
      description: >-
        Two forms on one route.


        **With `status=open`**: what the wallet holds now (unresolved positions
        and resolved ones not yet redeemed), valued at each token’s last fill
        price, biggest value first. Rows are WalletRows with `mark`, `markTs`,
        `value`, `unrealizedPnl` and `market`.


        **With `status=closed`**: the same as Closed Positions.


        **Without `status`**: the raw positions in the markets you name with
        `conditions` (both outcomes each, closed ones included), as `positions`.
        Name at least one market: without one it returns every position the
        wallet has.
      operationId: wallet-positions
      parameters:
        - name: wallet
          in: path
          required: true
          description: 'The wallet: 0x and 40 hex.'
          schema:
            type: string
            pattern: ^0x[0-9a-fA-F]{40}$
          example: '0x885783760858e1bd5dd09a3c3f916cfa251ac270'
        - name: status
          in: query
          required: false
          description: open or closed. Leave it out for the raw form.
          schema:
            type: string
            enum:
              - open
              - closed
          example: open
        - name: limit
          in: query
          required: false
          description: Rows, 1 to 2,500. Out of range is clamped.
          schema:
            type: integer
            minimum: 1
            maximum: 2500
            default: 100
          example: 5
        - name: offset
          in: query
          required: false
          description: Rows to skip.
          schema:
            type: integer
            minimum: 0
            default: 0
        - name: category
          in: query
          required: false
          description: Only this category's markets; `other` for markets in none of them.
          schema:
            type: string
        - name: q
          in: query
          required: false
          description: >-
            Only markets whose question, or the row's outcome name, contains
            this text.
          schema:
            type: string
        - name: conditions
          in: query
          required: false
          description: 'Raw form: condition ids, comma separated, no spaces.'
          schema:
            type: string
      responses:
        '200':
          description: OK
          headers:
            x-ratelimit-limit:
              description: Your rate, requests a minute.
              schema:
                type: integer
            x-ratelimit-remaining:
              description: Requests left in your bucket.
              schema:
                type: integer
          content:
            application/json:
              schema:
                type: object
                properties:
                  wallet:
                    type: string
                    description: ''
                  block:
                    type: integer
                    description: The finalized block the answer reflects.
                  tooLarge:
                    type: boolean
                    description: >-
                      Past maxPositions positions the wallet answers with no
                      rows.
                  maxPositions:
                    type: integer
                    description: 50,000.
                  total:
                    type: integer
                    description: Rows after filters.
                  offset:
                    type: integer
                    description: ''
                  rows:
                    type: array
                    items:
                      allOf:
                        - $ref: '#/components/schemas/WalletRow'
                        - type: object
                          properties:
                            market:
                              $ref: '#/components/schemas/Market'
                              type:
                                - null
                                - 'null'
                            mark:
                              type:
                                - number
                                - 'null'
                              description: Last fill price, or the payout once resolved.
                            markTs:
                              type:
                                - integer
                                - 'null'
                              description: When that fill was. Unix seconds.
                            value:
                              type:
                                - number
                                - 'null'
                              description: USD.
                            unrealizedPnl:
                              type:
                                - number
                                - 'null'
                              description: USD; null once resolved.
                  next:
                    type:
                      - integer
                      - 'null'
                    description: The next offset.
                  positions:
                    type: array
                    items:
                      allOf:
                        - type: object
                          properties:
                            conditionId:
                              type: string
                              description: ''
                        - $ref: '#/components/schemas/Position'
                    description: Raw form only.
              example:
                wallet: '0x885783760858e1bd5dd09a3c3f916cfa251ac270'
                block: 94812402
                tooLarge: false
                maxPositions: 50000
                total: 4
                offset: 0
                rows:
                  - wallet: '0x885783760858e1bd5dd09a3c3f916cfa251ac270'
                    outcomeIndex: 0
                    shares: 1200
                    costBasis: 312
                    avgPrice: 0.26
                    avgBuyPrice: 0.26
                    realizedPnl: 0
                    boughtShares: 1200
                    boughtUsd: 312
                    soldShares: 0
                    soldUsd: 0
                    avgSellPrice: 0
                    splitShares: 0
                    mergedShares: 0
                    mergeUsd: 0
                    redeemedShares: 0
                    redeemUsd: 0
                    fees: 1.25
                    fills: 3
                    firstTradeAt: 1783987320
                    lastTradeAt: 1790862117
                    partialHistory: false
                    basisApprox: false
                    converted: false
                    amm: false
                    tokenId: >-
                      85254962656314962064648492774584063365849461315753521676016468731069088672
                    conditionId: >-
                      0x8db33416a2d1ebde7438c80129e898f89a5deb3852ca64b37c4bf46513204409
                    resolved: false
                    settle: null
                    resolvedAt: null
                    settledPnl: 0
                    invested: 312
                    sharesIn: 1200
                    entryPrice: 0.26
                    pnlPct: 0
                    avgExitPrice: null
                    open: true
                    redeemable: false
                    exitAt: null
                    market:
                      question: US announces end of Iranian blockade by March 31, 2027?
                      slug: us-announces-end-of-iranian-blockade-by-march-31-2027
                      eventSlug: us-announces-end-of-iranian-blockade
                      image: >-
                        https://polymarket-upload.s3.us-east-2.amazonaws.com/example.png
                      category: Politics
                      outcomes:
                        - 'Yes'
                        - 'No'
                      negRisk: false
                    mark: 0.24
                    markTs: 1790862117
                    value: 288
                    unrealizedPnl: -24
                next: 1
        '400':
          description: A parameter is malformed or out of range
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                e0:
                  summary: status must be open or closed
                  value:
                    error: status must be open or closed
                e1:
                  summary: unknown category
                  value:
                    error: unknown category
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  schemas:
    WalletRow:
      allOf:
        - $ref: '#/components/schemas/Position'
        - type: object
          properties:
            tokenId:
              type: string
              description: The outcome token, decimal.
            conditionId:
              type:
                - string
                - 'null'
              description: Its market; null when the token is unknown.
            resolved:
              type: boolean
              description: Its market resolved.
            settle:
              type:
                - number
                - 'null'
              description: The payout a share once resolved (0 to 1).
            resolvedAt:
              type:
                - integer
                - 'null'
              description: When it resolved. Unix seconds.
            settledPnl:
              type: number
              description: >-
                Realized PnL plus, once resolved, the payout of shares still
                held minus their cost, in USD.
            invested:
              type: number
              description: Bought plus split shares at $0.50, in USD.
            sharesIn:
              type: number
              description: 'Shares taken in: bought, split, received.'
            entryPrice:
              type: number
              description: Average price of the shares taken in, USD a share.
            pnlPct:
              type:
                - number
                - 'null'
              description: settledPnl / invested, in percent (25 is 25%).
            avgExitPrice:
              type:
                - number
                - 'null'
              description: >-
                Average price received on the way out: sells, merges,
                redemptions.
            open:
              type: boolean
              description: Unresolved and holding at least 0.1 share.
            redeemable:
              type: boolean
              description: Resolved, still holding, and paying out.
            exitAt:
              type:
                - integer
                - 'null'
              description: >-
                When it closed: the resolution if held into it, else its last
                event. Null while open. Unix seconds.
      description: >-
        A position on the wallet routes, settled against its market’s
        resolution. Combos and v2 legs also carry the ComboExtras fields.
    Market:
      type: object
      properties:
        question:
          type:
            - string
            - 'null'
          description: The market's question.
        slug:
          type:
            - string
            - 'null'
          description: The market's slug on Polymarket.
        eventSlug:
          type:
            - string
            - 'null'
          description: Its event's slug.
        image:
          type:
            - string
            - 'null'
          description: An https image URL.
        category:
          type:
            - string
            - 'null'
          description: >-
            Politics, Sports, Crypto, Finance, Culture, Mentions, Weather,
            Economics or Tech; null for none of them.
        outcomes:
          type:
            - array
            - 'null'
          items:
            type: string
          description: Outcome names by outcomeIndex.
        negRisk:
          type: boolean
          description: Part of a neg-risk (multi-outcome) event.
      description: Polymarket's metadata for a market.
    Position:
      type: object
      properties:
        wallet:
          type: string
          description: The wallet, lowercase.
        outcomeIndex:
          type: integer
          description: >-
            0 for the first outcome (Yes, Up), 1 for the second. -1 when the
            token is unknown.
        shares:
          type: number
          description: >-
            Balance now, in shares. Negative when the wallet held shares before
            history Codex saw.
        costBasis:
          type: number
          description: >-
            Fee-inclusive average cost of the shares held (Polymarket’s own
            method), in USD.
        avgPrice:
          type: number
          description: costBasis / shares, USD a share; 0 when none are held.
        avgBuyPrice:
          type: number
          description: Average buy price, fees aside; 0 when it never bought.
        realizedPnl:
          type: number
          description: Realized PnL, net of fees, in USD.
        boughtShares:
          type: number
          description: Shares bought on the order book.
        boughtUsd:
          type: number
          description: Paid for them, before fees, in USD.
        soldShares:
          type: number
          description: Shares sold on the order book.
        soldUsd:
          type: number
          description: Received for them, before fees, in USD.
        avgSellPrice:
          type: number
          description: Average sell price; 0 when it never sold.
        splitShares:
          type: number
          description: Shares minted by splits.
        mergedShares:
          type: number
          description: Shares burned by merges.
        mergeUsd:
          type: number
          description: Collateral merges returned, in USD.
        redeemedShares:
          type: number
          description: Shares redeemed after resolution.
        redeemUsd:
          type: number
          description: Their payout, in USD.
        fees:
          type: number
          description: Fees paid, in USD.
        fills:
          type: integer
          description: Order-book fills.
        firstTradeAt:
          type: integer
          description: >-
            First event of any kind on the position (trades, transfers, splits).
            Unix seconds.
        lastTradeAt:
          type: integer
          description: Latest event of any kind on the position. Unix seconds.
        partialHistory:
          type: boolean
          description: It sold, merged or redeemed more than Codex saw it acquire.
        basisApprox:
          type: boolean
          description: >-
            Transfers, conversions or neg-risk splits moved its basis by an
            approximating rule.
        converted:
          type: boolean
          description: A neg-risk conversion touched it.
        amm:
          type: boolean
          description: It traded with a 2020-22 AMM pool.
      description: One wallet's position in one outcome token.
    Error:
      type: object
      properties:
        error:
          type: string
          description: What went wrong, for a person to read.
      description: Every error answer.
  responses:
    Unauthorized:
      description: No key, or an unknown or revoked one.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: unknown or revoked API key
    RateLimited:
      description: >-
        Over your rate, or more than 4 requests (2 streams) at once. Wait
        `Retry-After` seconds.
      headers:
        retry-after:
          description: Seconds to wait.
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: 'rate limit: 600 requests a minute; retry in 1 s'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Your API key: `codex_` and 48 hex characters.'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.