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

# 지갑 - 손익 명세

> 지갑의 토큰별 PnL 내역 조회



## OpenAPI

````yaml /ko/api-reference/openapi-data-ko.yaml GET /v2/wallet/{chain}/{walletAddress}/pnl-details
openapi: 3.1.0
info:
  title: Services API
  description: Services API
  contact:
    name: AI
    email: ai@sx.ai
  license:
    name: MIT
  version: '1.0'
servers:
  - url: https://api.chainstream.io
    description: Production
security:
  - bearer_auth: []
  - api_key_auth: []
tags:
  - name: Blockchain
    description: 블록체인 관련 작업
  - name: Token
    description: 토큰 관련 작업
  - name: Trade
    description: 거래 관련 작업
  - name: Wallet
    description: 지갑 관련 작업
  - name: Dex
    description: DEX 관련 작업
  - name: Ranking
    description: 랭킹 관련 작업
  - name: DexPool
    description: DEX 풀 관련 작업
  - name: Watchlist
    description: 워치리스트 관련 작업
  - name: KYT
    description: KYT 관련 작업
  - name: Webhook
    description: Webhook 관련 작업
  - name: RedPacket
    description: 레드패킷 관련 작업
  - name: IPFS
    description: IPFS 관련 작업
  - name: DexScreener
    description: DexScreener 관련 작업
paths:
  /v2/wallet/{chain}/{walletAddress}/pnl-details:
    get:
      tags:
        - Wallet
      summary: 지갑 - PnL 상세
      description: 지갑의 토큰별 PnL 내역 조회
      operationId: get.pnl.details
      parameters:
        - name: chain
          in: path
          description: 지원되는 네트워크에 나열된 체인 이름
          required: true
          schema:
            $ref: '#/components/schemas/ChainSymbol'
          example: sol
        - name: walletAddress
          in: path
          description: 지갑 주소
          required: true
          schema:
            type: string
          example: DfMxre4cKmvogbLrPigxmibVTTQDuzjdXojWzjCXXhzj
        - name: cursor
          in: query
          description: 페이지네이션 커서
          required: false
          schema:
            type: string
          example: eyJpZCI6IjEyMyJ9
        - name: limit
          in: query
          description: 페이지당 결과 수
          required: false
          schema:
            type: integer
            format: int64
            default: 20
          example: 20
        - name: direction
          in: query
          description: 페이지네이션 방향 (next 또는 prev)
          required: false
          schema:
            oneOf:
              - $ref: '#/components/schemas/PageDirection'
            default: next
          example: next
        - name: resolution
          in: query
          description: 손익 집계 시간 해상도
          required: true
          schema:
            $ref: '#/components/schemas/PnlResolution'
          example: 1d
        - name: positionState
          in: query
          description: 포지션 상태로 필터링(오픈 또는 클로즈)
          required: false
          schema:
            $ref: '#/components/schemas/PositionState'
        - name: sortBy
          in: query
          description: 손익 상세 결과 정렬 필드
          required: false
          schema:
            $ref: '#/components/schemas/PnlSortBy'
      responses:
        '200':
          description: 성공 응답
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PnlDetailsResult'
components:
  schemas:
    ChainSymbol:
      type: string
      description: Supported blockchain chains
      enum:
        - sol
        - eth
        - bsc
    PageDirection:
      type: string
      description: Pagination direction
      enum:
        - next
        - prev
    PnlResolution:
      type: string
      description: PnL resolution period
      enum:
        - 1d
        - 7d
        - 30d
        - all
    PositionState:
      type: string
      description: Filter for PnL position state
      enum:
        - open
        - all
        - closed
    PnlSortBy:
      type: string
      description: Sort field for PnL details query
      enum:
        - totalPnl
        - realizedPnl
        - unrealizedPnl
    PnlDetailsResult:
      type: object
      description: Full PnL details result with cursor pagination.
      required:
        - summary
        - data
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/PnlDetailItem'
          description: 토큰별 PnL 상세 목록
        endCursor:
          type:
            - string
            - 'null'
          description: 현재 페이지 종료 커서
          example: eyJpZCI6ImVuZCJ9
        hasNext:
          type: boolean
          description: 다음 페이지 존재 여부
          example: false
        hasPrev:
          type: boolean
          description: 이전 페이지 존재 여부
          example: false
        startCursor:
          type:
            - string
            - 'null'
          description: 현재 페이지 시작 커서
          example: eyJpZCI6InN0YXJ0In0=
        summary:
          $ref: '#/components/schemas/PnlDetailSummary'
          description: 집계된 PnL 요약
    PnlDetailItem:
      type: object
      description: PnL detail for a single wallet-token pair (mirrors TS PnlDetailItemDTO).
      required:
        - tokenAddress
        - walletAddress
        - balance
        - priceInUsd
        - currentValue
        - buys
        - sells
        - totalTrades
        - buyAmount
        - sellAmount
        - buyAmountInUsd
        - sellAmountInUsd
        - avgBuyPriceInUsd
        - avgSellPriceInUsd
        - realizedProfitInUsd
        - realizedProfitRatio
        - unrealizedProfitInUsd
        - unrealizedProfitRatio
        - totalProfitInUsd
        - totalProfitRatio
        - avgProfitPerTradeInUsd
        - isClosed
      properties:
        avgBuyPriceInUsd:
          type: string
          description: USD 기준 평균 매수 가격
          example: '0.00003324391014165111'
        avgProfitPerTradeInUsd:
          type: string
          description: USD 기준 거래당 평균 수익
          example: '3206068.5728287027967835484926836364'
        avgSellPriceInUsd:
          type: string
          description: USD 기준 평균 매도 가격
          example: '0.00003185807445122603'
        balance:
          type: string
          description: 현재 토큰 잔액
          example: '1254982158.7106050000000000'
        buyAmount:
          type: string
          description: 토큰 단위 총 매수 수량
          example: '1457986404.2130240000000000'
        buyAmountInUsd:
          type: string
          description: USD 기준 총 매수 금액
          example: '48469.1690094067802589'
        buys:
          type: string
          description: 매수 거래 건수
          example: '275'
        currentValue:
          type: string
          description: USD 기준 현재 보유 가치
          example: '1062513957.429816153652557077014'
        decimals:
          type: integer
          format: int32
          description: 토큰 소수점 자릿수
          example: 6
        firstBuyAt:
          type:
            - integer
            - 'null'
          format: int64
          description: Timestamp of first buy (ms since epoch)
        isClosed:
          type: boolean
          description: Whether the position is fully closed (balance == 0)
        lastSellAt:
          type:
            - integer
            - 'null'
          format: int64
          description: Timestamp of last sell (ms since epoch)
        logoUri:
          type:
            - string
            - 'null'
          description: 토큰 로고 URI
          example: https://s1.chainstream.io/tokens/images/example.webp
        losses:
          type:
            - string
            - 'null'
          description: 손실 거래 횟수
          example: '5'
        name:
          type: string
          description: 토큰 표시 이름
          example: The Real World
        priceInUsd:
          type: string
          description: USD 기준 현재 토큰 가격
          example: '0.8466367032033868'
        realizedProfitInUsd:
          type: string
          description: USD 기준 실현 수익
          example: '67.1297848453256596'
        realizedProfitRatio:
          type: string
          description: 실현 수익률
          example: '0.00138499970635554473'
        sellAmount:
          type: string
          description: 토큰 단위 총 매도 수량
          example: '203004245.5024190000000000'
        sellAmountInUsd:
          type: string
          description: USD 기준 총 매도 금액
          example: '6467.3243671310312402'
        sells:
          type: string
          description: 매도 거래 건수
          example: '110'
        symbol:
          type: string
          description: 토큰 티커 심볼
          example: TRW
        tokenAddress:
          type: string
          description: 토큰 컨트랙트 주소
          example: 4MbgMQGvXBWyxKsTfrvkcRgh5FNLg1VxLnzWqbsdPh7p
        totalCostInUsd:
          type:
            - string
            - 'null'
          description: 총 비용(USD)
          example: '48469.17'
        totalProfitInUsd:
          type: string
          description: USD 기준 총 수익 (실현 + 미실현)
          example: '1234336400.539050576761666169683200000000'
        totalProfitRatio:
          type: string
          description: 총 수익률
          example: '25466.423827061972608618047859693225'
        totalTrades:
          type: string
          description: 총 거래 건수
          example: '385'
        transferInAmountInUsd:
          type:
            - string
            - 'null'
          description: 입금 총액(USD)
          example: '150.00'
        transferInCount:
          type:
            - string
            - 'null'
          description: 입금 횟수
          example: '3'
        transferOutAmountInUsd:
          type:
            - string
            - 'null'
          description: 출금 총액(USD)
          example: '29.40'
        transferOutCount:
          type:
            - string
            - 'null'
          description: 출금 횟수
          example: '1'
        unrealizedProfitInUsd:
          type: string
          description: USD 기준 미실현 수익
          example: '1234336333.409265731436006569683200000000'
        unrealizedProfitRatio:
          type: string
          description: 미실현 수익률
          example: '25466.422442062266253073315832775971'
        walletAddress:
          type: string
          description: 지갑 주소
          example: 54Pz1e35z9uoFdnxtzjp7xZQoFiofqhdayQWBMN7dsuy
        wins:
          type:
            - string
            - 'null'
          description: 수익 거래 횟수
          example: '12'
    PnlDetailSummary:
      type: object
      description: >-
        Aggregated PnL summary across all items (mirrors TS
        PnlDetailSummaryDTO).
      required:
        - tokens
        - buys
        - sells
        - totalTrades
        - wins
        - losses
        - winRate
        - buyAmountInUsd
        - sellAmountInUsd
        - totalCostInUsd
        - currentValue
        - realizedProfitInUsd
        - realizedProfitRatio
        - unrealizedProfitInUsd
        - totalProfitInUsd
        - avgProfitPerTradeInUsd
      properties:
        avgProfitPerTradeInUsd:
          type: string
          description: USD 기준 거래당 평균 수익
          example: '3206068.5728287027967835484926836364'
        buyAmountInUsd:
          type: string
          description: USD 기준 총 매수 금액
          example: '48469.1690094067802589'
        buys:
          type: string
          description: 총 매수 거래
          example: '275'
        currentValue:
          type: string
          description: USD 기준 현재 총 보유 가치
          example: '1062513957.429816153652557077014'
        losses:
          type: string
          description: 손실 거래 건수
          example: '69'
        realizedProfitInUsd:
          type: string
          description: USD 기준 총 실현 수익
          example: '67.1297848453256596'
        realizedProfitRatio:
          type: string
          description: 총 실현 수익률
          example: '0.0013849997063555447320269173'
        sellAmountInUsd:
          type: string
          description: USD 기준 총 매도 금액
          example: '6467.3243671310312402'
        sells:
          type: string
          description: 총 매도 거래
          example: '110'
        tokens:
          type: string
          description: 총 거래 토큰 수
          example: '1'
        totalCostInUsd:
          type: string
          description: USD 기준 총 비용 기반
          example: '48469.1690094067802589'
        totalProfitInUsd:
          type: string
          description: USD 기준 총 수익
          example: '1234336400.5390505767616661696832'
        totalTrades:
          type: string
          description: 총 거래 건수
          example: '385'
        transferInAmountInUsd:
          type: string
          description: 입금 총액(USD)
          example: '350.00'
        transferInCount:
          type: string
          description: 입금 횟수
          example: '5'
        transferOutAmountInUsd:
          type: string
          description: 출금 총액(USD)
          example: '29.40'
        transferOutCount:
          type: string
          description: 출금 횟수
          example: '2'
        unrealizedProfitInUsd:
          type: string
          description: USD 기준 총 미실현 수익
          example: '1234336333.4092657314360065696832'
        winRate:
          type: string
          description: 승률
          example: '0.5688'
        wins:
          type: string
          description: 수익 거래 건수
          example: '91'
  securitySchemes:
    bearer_auth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    api_key_auth:
      type: apiKey
      in: header
      name: X-API-KEY

````