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

# Get unified portfolio

> Returns the full unified portfolio for the authenticated wallet: balances, positions, and open orders in one payload. For lowest latency, parse the on-chain portfolio account buffer directly via RPC.



## OpenAPI

````yaml /openapi.json get /api/v2/portfolio
openapi: 3.1.0
info:
  title: QuantDesk API
  version: 2.0.0
  description: >-
    Public HTTP API for the QuantDesk perpetual DEX gateway. Endpoints are
    grouped by market data, unified portfolio state, oracle pricing, social
    surfaces, backtesting, and reference data. Field-level truth for on-chain
    accounts lives in the SDK; this reference documents the REST gateway
    surface.


    Authenticated routes accept a Bearer JWT obtained from the wallet session
    flow described in the Authentication guide.
  contact:
    name: QuantDesk Support
    url: https://docs.quantdesk.app
    email: support@quantdesk.app
  license:
    name: MIT
servers:
  - url: https://api.quantdesk.app
    description: Production gateway
security: []
tags:
  - name: Markets
    description: Market registry, metadata, and crankless orderbook depth.
  - name: Oracle
    description: Price feeds sourced from the Pyth oracle network.
  - name: Portfolio
    description: Unified portfolio state aggregated from on-chain accounts.
  - name: Data
    description: Authoritative market statistics and historical OHLCV candles.
  - name: Social
    description: Leaderboard and verified proof (flex) cards.
  - name: Backtesting
    description: Strategy simulation lifecycle and dataset catalog.
  - name: Referrals
    description: Referral validation before on-chain assignment.
paths:
  /api/v2/portfolio:
    get:
      tags:
        - Portfolio
      summary: Get unified portfolio
      description: >-
        Returns the full unified portfolio for the authenticated wallet:
        balances, positions, and open orders in one payload. For lowest latency,
        parse the on-chain portfolio account buffer directly via RPC.
      operationId: getPortfolio
      responses:
        '200':
          description: Unified portfolio
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: '#/components/schemas/Portfolio'
        '401':
          description: Missing or expired auth
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Wallet has not initialized a portfolio yet (`PORTFOLIO_NOT_FOUND`)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - BearerAuth: []
components:
  schemas:
    Portfolio:
      type: object
      properties:
        balances:
          type: array
          items:
            type: object
            properties:
              asset:
                type: string
                example: USDC
              amount:
                type: number
                example: 5000
        positions:
          type: array
          items:
            $ref: '#/components/schemas/Position'
        orders:
          type: array
          items:
            $ref: '#/components/schemas/Order'
    Error:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: string
          example: PORTFOLIO_NOT_FOUND
        code:
          type: string
          example: PORTFOLIO_NOT_FOUND
        message:
          type: string
          example: Wallet has not initialized a V2 portfolio yet.
        timestamp:
          type: string
          format: date-time
        request_id:
          type: string
          example: req_8f2a1c
    Position:
      type: object
      properties:
        market:
          type: string
          example: SOL-PERP
        side:
          type: string
          enum:
            - long
            - short
          example: long
        size:
          type: number
          example: 12.5
        entry_price:
          type: number
          example: 160.1
        current_price:
          type: number
          example: 168.42
        unrealized_pnl:
          type: number
          example: 104
        leverage:
          type: number
          example: 5
    Order:
      type: object
      properties:
        id:
          type: string
          example: ord_1a2b3c
        market:
          type: string
          example: SOL-PERP
        side:
          type: string
          enum:
            - buy
            - sell
          example: buy
        type:
          type: string
          enum:
            - limit
            - market
          example: limit
        price:
          type: number
          example: 165
        size:
          type: number
          example: 10
        status:
          type: string
          example: open
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Bearer JWT obtained from the wallet session flow. See the Authentication
        guide.

````