> ## 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 /jp/api-reference/openapi-data-jp.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

````