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

# Get Market Holdings

> Returns the authenticated account's open positions in this market, with quantity, average buy price, and current value.



## OpenAPI

````yaml GET /v1/markets/{market_id}/holdings
openapi: 3.0.3
info:
  title: Predicta Markets API
  description: >-
    The Predicta Markets REST API lets you build on top of a continuous
    double-auction prediction market platform. Users buy and sell shares in
    YES/NO outcomes of real-world events. When a market resolves, holders of the
    winning side receive payouts; holders of the losing side lose their stake.


    Data model hierarchy: Market → MarketAsset → MarketAssetOption (prediction
    key) → Order. A Market is a question about a real-world event (e.g. 'Will
    Arsenal win the Premier League?'). Each Market contains one or more
    MarketAssets — the tradeable outcomes. Simple binary markets have a single
    asset; multi-player markets (e.g. Player of the Match) have one asset per
    candidate. Each MarketAsset exposes two options, YES and NO, each carrying a
    prediction_key — the unique hash you pass when placing an order to identify
    exactly which outcome you are trading.


    Trading flow: (1) call GET /v1/markets to find a market; (2) inspect
    market_assets and their options to get the prediction_key for the outcome
    you want; (3) call POST /v1/markets/{market_id}/orders with that
    prediction_key, your price, and quantity. Orders match immediately when a
    counterparty exists, otherwise they rest as open limit orders in the order
    book.


    Price system: all prices are integers in the range 1–99, representing cents.
    Price equals implied probability in percent — a YES price of 65 means the
    market implies a 65% chance the event will occur. YES and NO prices for the
    same asset always sum to approximately 100.


    Currency: the platform's internal unit is PT (Predicta Token). Balances,
    prices, and payout amounts are expressed in PT unless the market was created
    with a real-currency denomination.


    QID system: many resources expose a human-readable qualified ID (qid)
    alongside the numeric id. QIDs are computed, not stored as database columns.
    Prefix conventions — MA: market, MAA: market asset, AP: account payout. Most
    path parameters accept either the numeric id or the qid interchangeably.


    Authentication: include your API key in the X-Api-Key request header. All
    account-scoped endpoints require authentication. Market listing and detail
    endpoints are public.
  version: 1.0.0
  contact:
    email: api-support@predictamarkets.com
servers:
  - url: https://api.predictamarkets.com
    description: Production
security: []
paths:
  /v1/markets/{market_id}/holdings:
    get:
      tags:
        - Market
      summary: Get Market Holdings
      description: >-
        Returns the authenticated account's open positions in this market, with
        quantity, average buy price, and current value.
      operationId: get_market_holdings
      parameters:
        - name: market_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/TQID'
        - name: status
          in: query
          required: false
          schema:
            type: string
            description: Filter by portfolio status (OPEN, CLOSED, LOSS)
            title: Status
          description: Filter by portfolio status (OPEN, CLOSED, LOSS)
      responses:
        '200':
          description: Current holdings
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/AccountMarketAssetPortFolioSchema'
                title: Response Get Market Holdings
              example:
                - market_asset_id: 34
                  prediction_key: mkt-12-yes
                  side: 'YES'
                  quantity: '10.00'
                  avg_buy_price: '65.00'
                  current_price: '68.00'
                  current_value: '680.00'
                  unrealised_pnl: '30.00'
        '401':
          description: Not authenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                detail: Not authenticated
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                detail: Market not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          $ref: '#/components/responses/InternalServerError'
      security:
        - apiKey: []
components:
  schemas:
    TQID:
      anyOf:
        - type: string
        - type: integer
      description: >-
        Flexible identifier type that accepts either a numeric integer ID or a
        human-readable qualified ID string (QID). QIDs follow a prefix
        convention: MA for markets, MAA for market assets, AP for account
        payouts. Most path parameters that accept an ID use this type so callers
        can use whichever form is more convenient.
    AccountMarketAssetPortFolioSchema:
      properties:
        id:
          type: integer
          title: Id
          description: Portfolio record ID
        account_id:
          type: integer
          title: Account Id
          description: Account ID
        market_asset_id:
          type: integer
          title: Market Asset Id
          description: Market asset ID
        opinion_side:
          $ref: '#/components/schemas/MarketSides'
          description: Position side (YES/NO)
        shares_in_market:
          type: string
          pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Shares In Market
          description: Number of shares held
        price:
          title: Price
          description: Purchase price
          type: string
          pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          nullable: true
        status:
          $ref: '#/components/schemas/AccountPortfolioStatus'
          description: Portfolio status
        prediction_key:
          title: Prediction Key
          description: >-
            The prediction key of the option this position was opened on.
            Corresponds to `market_asset.options[n].key` for the option that was
            purchased.
          type: string
          nullable: true
        created_at:
          title: Created At
          description: Position creation timestamp
          type: string
          nullable: true
        updated_at:
          title: Updated At
          description: Last update timestamp
          type: string
          nullable: true
        market_asset:
          $ref: '#/components/schemas/PortfolioMarketAssetSchema'
          description: Market asset details
          nullable: true
        market:
          $ref: '#/components/schemas/PortfolioMarketSchema'
          description: Market details
          nullable: true
      type: object
      required:
        - id
        - account_id
        - market_asset_id
        - opinion_side
        - shares_in_market
        - status
      title: AccountMarketAssetPortFolioSchema
      description: Schema for account portfolio holdings in a specific market asset
    ErrorResponse:
      type: object
      properties:
        detail:
          type: string
          description: Human-readable error message
      required:
        - detail
      title: ErrorResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
      description: >-
        Returned by FastAPI when request validation fails (HTTP 422). Contains
        one or more ValidationError entries describing each invalid field.
    MarketSides:
      type: string
      enum:
        - 'YES'
        - 'NO'
      title: MarketSides
      description: 'The two tradeable sides of a market asset: YES or NO.'
    AccountPortfolioStatus:
      type: string
      enum:
        - OPEN
        - CLOSED
        - LOSS
      title: AccountPortfolioStatus
      description: >-
        Status of an account's position in a market asset. OPEN: live position.
        CLOSED: position resolved with payout. LOSS: position resolved as a
        loss.
    PortfolioMarketAssetSchema:
      properties:
        id:
          type: integer
          title: Id
          description: Market asset ID
        title:
          title: Title
          description: Market asset title
          type: string
          nullable: true
        asset_identifier:
          type: string
          title: Asset Identifier
          description: Asset identifier
        current_price:
          title: Current Price
          description: Current asset price
          type: string
          pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          nullable: true
        yes_price:
          title: Yes Price
          description: YES side price
          type: string
          pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          nullable: true
        no_price:
          title: No Price
          description: NO side price
          type: string
          pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          nullable: true
      type: object
      required:
        - id
        - asset_identifier
      title: PortfolioMarketAssetSchema
    PortfolioMarketSchema:
      properties:
        id:
          type: integer
          title: Id
          description: Market ID
        title:
          type: string
          title: Title
          description: Market title
      type: object
      required:
        - id
        - title
      title: PortfolioMarketSchema
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
          description: >-
            Path to the invalid field as a list of keys and/or array indices.
            For example, ['body', 'price'] indicates the price field in the
            request body failed validation.
        msg:
          type: string
          title: Message
          description: Human-readable explanation of what validation rule was violated.
        type:
          type: string
          title: Error Type
          description: >-
            Machine-readable Pydantic error type (e.g. 'value_error.missing',
            'type_error.integer').
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
      description: >-
        A single field validation failure within an HTTP 422 response. The loc
        array traces the path to the invalid field (e.g. ['body', 'price']).
  responses:
    InternalServerError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            detail: An unexpected error occurred. Please try again later.
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: X-Api-Key
      x-default: your-api-key-here

````