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

# Get portfolio position

> Returns one asset's position, PnL breakdown, and trade statistics.
Requires the `ACCOUNT_READ` scope.




## OpenAPI

````yaml /openapi.yaml get /portfolio/positions/{asset}
openapi: 3.1.0
info:
  title: PaperDrill REST API
  version: 1.0.0
  description: >
    Trade PaperDrill credit markets and read live market data.


    Prices, quantities, balances, and other decimal values are encoded as
    strings so clients do not lose precision.
servers:
  - url: https://api.paperdrill.dev/v1
    description: Production
security: []
tags:
  - name: Market data
    description: Public markets, tickers, candles, trades, and order-book snapshots.
  - name: Trading
    description: Create, inspect, and cancel orders with a scoped API key.
  - name: Account
    description: Read balances, portfolio performance, and private trade history.
  - name: Leaderboard
    description: Live public standings and your personal ranking.
  - name: Rewards
    description: >-
      Starter and daily simulated-fund credit status and claims for signed-in
      users.
paths:
  /portfolio/positions/{asset}:
    get:
      tags:
        - Account
      summary: Get portfolio position
      description: |
        Returns one asset's position, PnL breakdown, and trade statistics.
        Requires the `ACCOUNT_READ` scope.
      operationId: getPortfolioPosition
      parameters:
        - $ref: '#/components/parameters/AssetPath'
      responses:
        '200':
          description: Position returned successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PortfolioPositionDetail'
        '404':
          $ref: '#/components/responses/PositionNotFound'
        '503':
          $ref: '#/components/responses/PortfolioUnavailable'
        default:
          $ref: '#/components/responses/RequestError'
      security:
        - ApiKeyAuth: []
components:
  parameters:
    AssetPath:
      name: asset
      in: path
      required: true
      description: Asset code. Matching is case-insensitive.
      schema:
        type: string
      example: BTC
  schemas:
    PortfolioPositionDetail:
      type: object
      required:
        - asset
        - symbol
        - quoteAsset
        - asOf
        - source
        - partial
        - position
        - portfolio
        - trading
      properties:
        asset:
          type: string
        symbol:
          oneOf:
            - type: string
            - type: 'null'
        quoteAsset:
          type: string
        asOf:
          type: string
          format: date-time
        source:
          type: string
          enum:
            - live
            - projection
            - engine
        partial:
          type: boolean
        position:
          $ref: '#/components/schemas/PortfolioPosition'
        portfolio:
          type: object
          required:
            - cash
            - positionsValue
            - equity
          properties:
            cash:
              $ref: '#/components/schemas/DecimalString'
            positionsValue:
              $ref: '#/components/schemas/DecimalString'
            equity:
              $ref: '#/components/schemas/DecimalString'
        trading:
          type: object
          required:
            - fills
            - buys
            - sells
            - realizedPnl
            - firstTradeAt
            - lastTradeAt
          properties:
            fills:
              type: integer
            buys:
              type: integer
            sells:
              type: integer
            realizedPnl:
              $ref: '#/components/schemas/NullableSignedDecimalString'
            firstTradeAt:
              oneOf:
                - type: string
                  format: date-time
                - type: 'null'
            lastTradeAt:
              oneOf:
                - type: string
                  format: date-time
                - type: 'null'
    PortfolioPosition:
      type: object
      required:
        - asset
        - symbol
        - qty
        - available
        - locked
        - total
        - costBasis
        - averageCost
        - markPrice
        - value
        - realizedPnl
        - unrealizedPnl
        - unrealizedPnlPercent
        - allocationPercent
        - lastBuyPrice
        - lastBuyQty
        - lastBuyAt
        - lastSellPrice
        - lastSellQty
        - lastSellAt
        - tradeCount
        - partial
      properties:
        asset:
          type: string
          description: Base asset code.
        symbol:
          oneOf:
            - type: string
            - type: 'null'
          description: Market used to mark the position, when one exists.
        qty:
          $ref: '#/components/schemas/DecimalString'
        available:
          $ref: '#/components/schemas/DecimalString'
        locked:
          $ref: '#/components/schemas/DecimalString'
        total:
          $ref: '#/components/schemas/DecimalString'
        costBasis:
          $ref: '#/components/schemas/NullableDecimalString'
          description: Remaining cost of the open quantity at weighted-average cost.
        averageCost:
          $ref: '#/components/schemas/NullableDecimalString'
          description: Weighted-average cost per unit of the open quantity.
        markPrice:
          $ref: '#/components/schemas/NullableDecimalString'
        value:
          $ref: '#/components/schemas/DecimalString'
          description: Current market value of the open quantity.
        realizedPnl:
          $ref: '#/components/schemas/NullableSignedDecimalString'
        unrealizedPnl:
          $ref: '#/components/schemas/NullableSignedDecimalString'
        unrealizedPnlPercent:
          $ref: '#/components/schemas/NullableSignedDecimalString'
        allocationPercent:
          $ref: '#/components/schemas/NullableDecimalString'
          description: Share of total equity, fixed to two decimal places.
        lastBuyPrice:
          $ref: '#/components/schemas/NullableDecimalString'
        lastBuyQty:
          $ref: '#/components/schemas/NullableDecimalString'
        lastBuyAt:
          oneOf:
            - type: string
              format: date-time
            - type: 'null'
        lastSellPrice:
          $ref: '#/components/schemas/NullableDecimalString'
        lastSellQty:
          $ref: '#/components/schemas/NullableDecimalString'
        lastSellAt:
          oneOf:
            - type: string
              format: date-time
            - type: 'null'
        tradeCount:
          oneOf:
            - type: integer
            - type: 'null'
        partial:
          type: boolean
          description: True when the quantity is known but its cost basis is not.
    DecimalString:
      type: string
      pattern: ^\d+(\.\d+)?$
      description: A non-negative decimal encoded as a string.
      example: '125.50'
    NullableSignedDecimalString:
      oneOf:
        - $ref: '#/components/schemas/SignedDecimalString'
        - type: 'null'
    ApiError:
      type: object
      required:
        - error
        - requestId
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
            message:
              type: string
            details:
              type: array
              items:
                $ref: '#/components/schemas/ApiErrorDetail'
        requestId:
          type: string
          format: uuid
      example:
        error:
          code: VALIDATION_ERROR
          message: Request validation failed
          details:
            - field: qty
              message: invalid decimal format
        requestId: f4c0baf4-b8d2-4c9a-a17b-c8656c4a7b0e
    NullableDecimalString:
      oneOf:
        - $ref: '#/components/schemas/DecimalString'
        - type: 'null'
    SignedDecimalString:
      type: string
      pattern: ^[+-]?\d+(\.\d+)?$
      description: A signed decimal encoded as a string.
      example: '+3.40'
    ApiErrorDetail:
      type: object
      required:
        - message
      properties:
        field:
          type: string
        message:
          type: string
  responses:
    PositionNotFound:
      description: The account has no recorded position or trades for this asset.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    PortfolioUnavailable:
      description: Portfolio valuation is temporarily unavailable.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    RequestError:
      description: The request failed. See Errors and rate limits for recovery guidance.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: A scoped API key created in the PaperDrill dashboard.

````

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