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

# Get position trades

> Handles `GET /v1/users/{user_pubkey}/positions/{position_id}/trades` via `get.v1.users.by_user_pubkey.positions.by_position_id.trades`.



## OpenAPI

````yaml /openapi/phoenix-public-api.json get /v1/users/{user_pubkey}/positions/{position_id}/trades
openapi: 3.1.0
info:
  title: Phoenix Eternal API
  description: >-
    RESTful API for accessing Phoenix Eternal perpetual trading data. Provides
    real-time orderbook levels, asset information, and market metadata.
  termsOfService: https://www.phoenix.trade/terms-of-service
  contact:
    name: Phoenix Development Team
    url: https://github.com/Ellipsis-Labs/phoenix
  license:
    name: Proprietary
  version: 1.0.0
servers:
  - url: https://perp-api.phoenix.trade
    description: Phoenix Eternal Perp API
security: []
tags:
  - name: Auth
    description: Wallet and session authentication.
  - name: Exchange
    description: Exchange, market, candle, and no-referral register-instruction workflows.
  - name: Invite
    description: Invite validation, referral activation, and wallet allowlist checks.
  - name: Notifications
    description: Trader notification reads and acknowledgement helpers.
  - name: Trader
    description: Trader state, account history, and transaction builders.
externalDocs:
  url: https://docs.phoenix.trade
  description: Phoenix developer documentation
paths:
  /v1/users/{user_pubkey}/positions/{position_id}/trades:
    get:
      tags:
        - Trader
      summary: Get position trades
      description: >-
        Handles `GET /v1/users/{user_pubkey}/positions/{position_id}/trades` via
        `get.v1.users.by_user_pubkey.positions.by_position_id.trades`.
      operationId: get.v1.users.by_user_pubkey.positions.by_position_id.trades
      parameters:
        - name: user_pubkey
          in: path
          description: User pubkey (base58 encoded)
          required: true
          schema:
            type: string
        - name: position_id
          in: path
          description: Position id
          required: true
          schema:
            type: string
        - name: traderPdaIndex
          in: query
          description: PDA index of the user's trader holding the position.
          required: true
          schema:
            type: integer
            format: int32
        - name: limit
          in: query
          description: Number of trades to return (max 1000)
          required: false
          schema:
            type: integer
            format: int32
            minimum: 0
        - name: cursor
          in: query
          description: '`nextCursor` of a previous page'
          required: false
          schema:
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedResponse_Vec_PositionTrade'
          description: Successful response
components:
  schemas:
    PaginatedResponse_Vec_PositionTrade:
      type: object
      description: >-
        Generic paginated response wrapper with bidirectional cursor support.


        The cursor system supports both forward (newer) and backward (older)

        pagination:

        - `prev_cursor`: Use this cursor to poll for new items (items newer than
        the
          current result set)
        - `next_cursor`: Use this cursor to load more items (items older than
        the
          current result set)

        The direction is embedded in the cursor itself, so clients just need to
        pass

        the appropriate cursor to the `cursor` parameter.
      required:
        - data
        - hasMore
      properties:
        data:
          type: array
          items:
            type: object
            description: >-
              One trade of a position: the `trades_v2` row at the same key,
              limited to

              the part that belongs to this position. A reversing trade closes
              one

              position down to zero and opens the next from zero, and each side
              takes the

              share of the trade's fee that its quote is of the trade's quote.


              Size amounts are in base units and money amounts in USD, as
              decimal

              strings. `fees` is what the trader paid, negative for net rebates.
            required:
              - slot
              - slotIndex
              - eventIndex
              - timestamp
              - instructionType
              - action
              - tradeType
              - liquidity
              - size
              - price
              - value
              - realizedPnl
              - fees
              - sizeAfter
              - funding
            properties:
              action:
                $ref: '#/components/schemas/PositionTradeAction'
              eventIndex:
                type: integer
                format: int32
              fees:
                type: string
              funding:
                type: string
                description: >-
                  Funding paid while the position held `sizeAfter`: from this
                  trade to

                  the next one, or zero for the closing trade. The position's
                  trades sum

                  to its `fundingPayment`.
              instructionType:
                type: string
              liquidity:
                $ref: '#/components/schemas/LiquidityRole'
              price:
                type: string
              realizedPnl:
                type: string
              size:
                type: string
                description: Unsigned size traded for this position.
              sizeAfter:
                type: string
                description: Signed size held after the trade, negative for short.
              slot:
                type: integer
                format: int64
              slotIndex:
                type: integer
                format: int32
              timestamp:
                type: string
                format: date-time
              tpsl:
                oneOf:
                  - $ref: '#/components/schemas/PositionTpslKind'
                    description: >-
                      The take-profit or stop-loss trigger whose order this
                      trade was.
                  - type: 'null'
              tradeType:
                $ref: '#/components/schemas/TradeType'
              value:
                type: string
                description: Notional traded for this position.
        hasMore:
          type: boolean
          description: Whether there are more results available after this page
        nextCursor:
          type:
            - string
            - 'null'
          description: >-
            Opaque cursor for fetching the next page of older results.

            Pass this value as the `cursor` parameter in the next request to
            load

            more.
        prevCursor:
          type:
            - string
            - 'null'
          description: >-
            Opaque cursor for fetching newer items (for polling).

            Pass this value as the `cursor` parameter to get items newer than
            the

            first item in data.
    PositionTradeAction:
      type: string
      enum:
        - open
        - increase
        - reduce
        - close
    LiquidityRole:
      type: string
      description: Liquidity role for the tracked account's fill.
      enum:
        - maker
        - taker
    PositionTpslKind:
      type: string
      enum:
        - takeProfit
        - stopLoss
    TradeType:
      type: string
      description: |-
        How the trader's side of a fill originated: their own limit or market
        order, a liquidation, or an auto-deleveraging. Independent of the
        liquidity role: a limit order that crosses the book fills as a taker.
      enum:
        - limit
        - market
        - liquidation
        - adl

````

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