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

# Get Wallet Positions

> 分页返回钱包下各代币仓位；支持排序及按持仓状态、盈亏、ROI、投入资金、市场、流动性、市值、代币列表等筛选。

## SDK Example

<CodeGroup>
  ```typescript SDK
  import { Client } from '@solana-tracker/data-api';

  const client = new Client({ apiKey: 'YOUR_API_KEY' });

  const data = await client.getPnlV2WalletPositions('FbMxP3GVq8TQ36nbYgx4NP9iygMpwAwFWJwW81ioCiSF', { limit: 50 });

  ```
</CodeGroup>


## OpenAPI

````yaml /cn/data-api/pnl-v2/openapi.json get /v2/pnl/wallets/{wallet}/positions
openapi: 3.1.0
info:
  title: SolanaTracker PnL V2 API
  description: >-
    面向 Solana 钱包的盈亏追踪：钱包级 PnL 汇总、按代币的持仓、排行榜、KOL 榜单、风险分析与历史表现。金额均为美元；除另有说明外，时间戳均为
    Unix 毫秒。
  version: 2.0.0
servers:
  - url: https://data.solanatracker.io
    description: 生产环境
security:
  - apiKey: []
tags:
  - name: Leaderboard
    description: 顶尖交易者、巨鲸与 KOL 排名
  - name: Token
    description: 按代币的交易者与持币数据
  - name: Wallet
    description: 钱包级盈亏、持仓、历史与分析
  - name: Batch
    description: 批量钱包摘要与持仓查询
paths:
  /v2/pnl/wallets/{wallet}/positions:
    get:
      tags:
        - Wallet
      summary: Get Wallet Positions
      description: 分页返回钱包下各代币仓位；支持排序及按持仓状态、盈亏、ROI、投入资金、市场、流动性、市值、代币列表等筛选。
      operationId: getWalletPositions
      parameters:
        - $ref: '#/components/parameters/walletPath'
        - $ref: '#/components/parameters/pnlMode'
        - name: sort
          in: query
          description: 持仓排序字段
          schema:
            type: string
            enum:
              - last_trade
              - pnl
              - realized
              - unrealized
              - roi
              - value
              - holding
              - invested
              - cost
              - proceeds
              - buys
              - sells
            default: last_trade
        - $ref: '#/components/parameters/direction'
        - $ref: '#/components/parameters/cursor'
        - name: limit
          in: query
          description: 每页条数（1–200）
          schema:
            type: integer
            default: 100
            maximum: 200
        - name: filter
          in: query
          description: 按持仓状态筛选
          schema:
            type: string
            enum:
              - all
              - holding
              - active
              - sold
              - profitable
              - losing
            default: all
        - name: period
          in: query
          description: 仅显示该时间段内有活动的仓位
          schema:
            type: string
            enum:
              - 1d
              - 7d
              - 14d
              - 30d
              - 90d
              - all
            default: all
        - name: tokens
          in: query
          description: 筛选用的代币 mint 地址列表（逗号分隔），最多 100 个
          schema:
            type: string
        - name: minValue
          in: query
          description: 仓位当前价值下限（美元）
          schema:
            type: number
        - name: maxValue
          in: query
          description: 仓位当前价值上限（美元）
          schema:
            type: number
        - name: minPnl
          in: query
          description: 总盈亏下限（美元）
          schema:
            type: number
        - name: maxPnl
          in: query
          description: 总盈亏上限（美元）
          schema:
            type: number
        - name: minInvested
          in: query
          description: 总投入下限（美元）
          schema:
            type: number
        - name: maxInvested
          in: query
          description: 总投入上限（美元）
          schema:
            type: number
        - name: minRoi
          in: query
          description: 最低 ROI（%）
          schema:
            type: number
        - name: maxRoi
          in: query
          description: 最高 ROI（%）
          schema:
            type: number
        - name: minTrades
          in: query
          description: 最低成交笔数
          schema:
            type: integer
        - name: minHolding
          in: query
          description: 最低代币余额（原生单位）
          schema:
            type: number
        - name: market
          in: query
          description: 按主要市场/DEX 筛选（如 Raydium、Orca）
          schema:
            type: string
        - name: minLiquidity
          in: query
          description: 代币最低流动性（美元）
          schema:
            type: number
        - name: minMarketCap
          in: query
          description: 代币最低市值（美元）
          schema:
            type: number
      responses:
        '200':
          description: Successful response.
          content:
            application/json:
              schema:
                type: object
                properties:
                  wallet:
                    type: string
                  identity:
                    $ref: '#/components/schemas/Identity'
                  positions:
                    type: array
                    items:
                      $ref: '#/components/schemas/Position'
                  stats:
                    type: object
                    description: >-
                      Position counts across the entire wallet (not just this
                      page).
                    properties:
                      total:
                        type: integer
                      filtered:
                        type: integer
                        description: How many match the current filters.
                      holding:
                        type: integer
                      sold:
                        type: integer
                      profitable:
                        type: integer
                      losing:
                        type: integer
                  pagination:
                    $ref: '#/components/schemas/Pagination'
              example:
                wallet: CyaE1VxvBrahnPWkqm5VsdCvyS2QmNht2UFrKJHga54o
                identity:
                  name: Cented
                  twitter: '@Cented7'
                  avatar: >-
                    https://kol-avatar.solanatracker.io/CyaE1VxvBrahnPWkqm5VsdCvyS2QmNht2UFrKJHga54o
                  platforms:
                    - axiom
                    - bloom
                  type: kol
                  tags:
                    - kol
                    - axiom
                    - bloom
                positions:
                  - token: 38PgzpJYu2HkiYvV8qePFakB8tuobPdGm2FFEn7Dpump
                    pnl:
                      realized: 88872.66
                      unrealized: 0
                      total: 88872.66
                    invested: 3071.27
                    proceeds: 91943.94
                    roi: 2893.67
                    current:
                      balance: 0
                      costBasis: 0
                      value: 0
                      price: 0.001490308105474092
                      avgCost: 0
                    volume:
                      tokensBought: 46026806.173715
                      tokensSold: 46026806.173715
                      buyUsd: 3071.27
                      sellUsd: 91943.94
                    averages:
                      buy: 341.25
                      sell: 1242.49
                    counts:
                      buys: 9
                      sells: 74
                      total: 83
                    timing:
                      firstBuy: 1746044721229
                      lastBuy: 1772031549416
                      firstSell: 1746044751527
                      lastSell: 1772032040873
                      firstTrade: 1746044721229
                      lastTrade: 1772032040873
                      holdTimeSecs: 25987320
                    meta:
                      symbol: gork
                      name: New XAI gork
                      image: >-
                        https://image.solanatracker.io/proxy?url=https%3A%2F%2Fipfs-forward.solanatracker.io%2Fipfs%2FQmXkHvTBRFMyY5ozYHXcF7JHqqLBTorca3dXAdF3ooD5e3
                      decimals: 6
                      price: 0.001490308105474092
                      snapshotPrice: 0.001666646257827002
                      marketCap: 1489948.99
                      liquidity: 371378.83
                      primaryMarket: pumpfun-amm
                    portfolioPercent: 0
                  - token: 84cAEWqiDsV5xXh6CB69Hi3HcnumBbdjH4THfyorpump
                    pnl:
                      realized: 50791.19
                      unrealized: 0
                      total: 50791.19
                    invested: 2621.72
                    proceeds: 53412.92
                    roi: 1937.32
                    current:
                      balance: 0
                      costBasis: 0
                      value: 0
                      price: 0.000016173713662274
                      avgCost: 0
                    volume:
                      tokensBought: 96296057.47450998
                      tokensSold: 96296057.47451006
                      buyUsd: 2621.72
                      sellUsd: 53412.92
                    averages:
                      buy: 70.86
                      sell: 346.84
                    counts:
                      buys: 37
                      sells: 154
                      total: 191
                    timing:
                      firstBuy: 1774277622281
                      lastBuy: 1774294723039
                      firstSell: 1774277870173
                      lastSell: 1774296331666
                      firstTrade: 1774277622281
                      lastTrade: 1774296331666
                      holdTimeSecs: 18709
                    meta:
                      symbol: '7'
                      name: The 7 Wanderers
                      image: >-
                        https://image.solanatracker.io/proxy?url=https%3A%2F%2Fedge.uxento.io%2Fimage%2FBxu1Dr8rLNBDyEutHRapKLdquDLeZkn8zkiUn9Avpump
                      decimals: 6
                      price: 0.000016173713662274
                      snapshotPrice: 0.000022584238960459607
                      marketCap: 16168.06
                      liquidity: 14118.7
                      primaryMarket: pumpfun-amm
                    portfolioPercent: 0
                stats:
                  total: 78195
                  filtered: 78195
                  holding: 67
                  sold: 77978
                  profitable: 47817
                  losing: 30175
                pagination:
                  hasMore: true
                  nextCursor: >-
                    eyJzb3J0VmFsdWUiOjUwNzkxLjE5Mzc4MjkwNzc5NCwidGllQnJlYWtlciI6Ijg0Y0FFV3FpRHNWNXhYaDZDQjY5SGkzSGNudW1CYmRqSDRUSGZ5b3JwdW1wIn0=
                  count: 2
                  total: 78195
                  pnlMode: strict
        '400':
          description: Invalid request parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-codeSamples:
        - lang: typescript
          label: SDK
          source: >
            import { Client } from '@solana-tracker/data-api';


            const client = new Client({ apiKey: 'YOUR_API_KEY' });


            const data = await
            client.getPnlV2WalletPositions('FbMxP3GVq8TQ36nbYgx4NP9iygMpwAwFWJwW81ioCiSF',
            { limit: 50 });
      x-code-samples:
        - lang: typescript
          label: SDK
          source: >
            import { Client } from '@solana-tracker/data-api';


            const client = new Client({ apiKey: 'YOUR_API_KEY' });


            const data = await
            client.getPnlV2WalletPositions('FbMxP3GVq8TQ36nbYgx4NP9iygMpwAwFWJwW81ioCiSF',
            { limit: 50 });
components:
  parameters:
    walletPath:
      name: wallet
      in: path
      required: true
      description: Solana 钱包地址（Base58，约 32–44 字符）
      schema:
        type: string
        pattern: ^[1-9A-HJ-NP-Za-km-z]{32,44}$
    pnlMode:
      name: pnlMode
      in: query
      description: >-
        对被无效 PnL 启发式标记的仓位：`strict` 归零；`adjusted` 按成本基础封顶；`raw` 不改动已实现盈亏。API
        也接受别名 `pnl_mode` 与 `mode`。
      schema:
        type: string
        enum:
          - strict
          - adjusted
          - raw
        default: strict
    direction:
      name: direction
      in: query
      description: 排序方向
      schema:
        type: string
        enum:
          - asc
          - desc
        default: desc
    cursor:
      name: cursor
      in: query
      description: 分页游标，取自上一页响应的 `pagination.nextCursor`
      schema:
        type: string
  schemas:
    Identity:
      type: object
      description: >-
        Unified wallet identity. Only fields with known values are returned; a
        wallet can carry multiple tags at once.
      properties:
        name:
          type:
            - string
            - 'null'
          description: Display name, if known.
        twitter:
          type:
            - string
            - 'null'
          description: Twitter/X handle, if known.
        avatar:
          type:
            - string
            - 'null'
          format: uri
          description: Avatar image URL.
        type:
          type:
            - string
            - 'null'
          description: >-
            Primary label for single-badge UIs, such as `kol`, `developer`,
            `pool`, `bot`, `hacker`, `spam_dusting`, `exchange`, or a platform
            tag.
        tags:
          type: array
          items:
            type: string
          description: >-
            All resolved labels for the wallet, including KOL, platform, pool,
            developer, bot, arbitrage, hacker, spam-dusting, or exchange tags.
        platforms:
          type: array
          items:
            type: string
          description: >-
            Normalized trading frontend tags such as `axiom`, `bloom`, or
            `photon`. Query filters also accept `axiom-flash`, which is
            normalized to `axiom` in identity responses.
        bot:
          type: object
          properties:
            name:
              type:
                - string
                - 'null'
            avatar:
              type:
                - string
                - 'null'
              format: uri
        pool:
          type: object
          properties:
            program:
              type:
                - string
                - 'null'
            poolAddress:
              type:
                - string
                - 'null'
        developer:
          type: object
          properties:
            token:
              type:
                - string
                - 'null'
            via:
              type: array
              items:
                type: string
            pools:
              type: array
              items:
                type: string
            creationTx:
              type:
                - string
                - 'null'
            createdAt:
              type:
                - integer
                - 'null'
              description: Unix timestamp in seconds.
        hacker:
          type: object
          description: Curated exploit/scam wallet label, when known.
          properties:
            label:
              type:
                - string
                - 'null'
        spamDusting:
          type: object
          description: Curated spam-dusting wallet label, when known.
          properties:
            label:
              type:
                - string
                - 'null'
        exchange:
          type: object
          description: Known centralized exchange hot wallet label, when known.
          properties:
            name:
              type:
                - string
                - 'null'
    Position:
      type: object
      description: A single token position for a wallet.
      properties:
        token:
          type: string
          description: Token mint address (base58).
        pnl:
          $ref: '#/components/schemas/PnlBlock'
        invested:
          type:
            - number
            - 'null'
          description: Total cost basis (USD spent buying this token).
        proceeds:
          type:
            - number
            - 'null'
          description: Total USD received from sales of this token.
        roi:
          type:
            - number
            - 'null'
          description: Return on investment percentage.
        current:
          type: object
          properties:
            balance:
              type:
                - number
                - 'null'
              description: Current token balance (native units).
            costBasis:
              type:
                - number
                - 'null'
              description: Cost basis of remaining held tokens.
            value:
              type:
                - number
                - 'null'
              description: Current USD value of held tokens.
            price:
              type:
                - number
                - 'null'
              description: Current token price in USD.
            avgCost:
              type:
                - number
                - 'null'
              description: Average cost per token in USD.
        volume:
          type: object
          properties:
            tokensBought:
              type:
                - number
                - 'null'
              description: Total tokens purchased (native units).
            tokensSold:
              type:
                - number
                - 'null'
              description: Total tokens sold (native units).
            buyUsd:
              type:
                - number
                - 'null'
              description: Total USD spent on buys.
            sellUsd:
              type:
                - number
                - 'null'
              description: Total USD received from sells.
        averages:
          type: object
          properties:
            buy:
              type:
                - number
                - 'null'
              description: Average buy size in USD.
            sell:
              type:
                - number
                - 'null'
              description: Average sell size in USD.
        counts:
          type: object
          properties:
            buys:
              type: integer
            sells:
              type: integer
            total:
              type: integer
              description: Total transactions (buys + sells).
        timing:
          type: object
          properties:
            firstBuy:
              type:
                - integer
                - 'null'
              description: Unix ms.
            lastBuy:
              type:
                - integer
                - 'null'
              description: Unix ms.
            firstSell:
              type:
                - integer
                - 'null'
              description: Unix ms.
            lastSell:
              type:
                - integer
                - 'null'
              description: Unix ms.
            firstTrade:
              type:
                - integer
                - 'null'
              description: Unix ms.
            lastTrade:
              type:
                - integer
                - 'null'
              description: Unix ms.
            holdTimeSecs:
              type:
                - integer
                - 'null'
              description: How long the position has been (or was) held, in seconds.
        meta:
          $ref: '#/components/schemas/TokenMeta'
        portfolioPercent:
          type:
            - number
            - 'null'
          description: >-
            This position's value as a percentage of the wallet's total holdings
            value. Only present on the positions endpoint.
    Pagination:
      type: object
      description: Cursor-based pagination metadata.
      properties:
        hasMore:
          type: boolean
          description: Whether more pages exist after this one.
        nextCursor:
          type:
            - string
            - 'null'
          description: >-
            Opaque cursor to pass as `?cursor=` for the next page. Null when
            there are no more results.
        count:
          type: integer
          description: Number of items returned in this page.
        total:
          type: integer
          description: Total number of matching items across all pages.
        pnlMode:
          type: string
          enum:
            - strict
            - adjusted
            - raw
          description: Resolved PnL treatment mode when the endpoint supports `pnlMode`.
        enrich:
          type: array
          description: List of enrichment modules applied to the response when supported.
          items:
            type: string
      required:
        - hasMore
        - nextCursor
        - count
        - total
    Error:
      type: object
      properties:
        error:
          type: string
          description: Human-readable error message.
      required:
        - error
    PnlBlock:
      type: object
      description: Realized, unrealized, and total profit/loss in USD.
      properties:
        realized:
          type:
            - number
            - 'null'
          description: Profit/loss from closed trades (tokens fully or partially sold).
        realizedRaw:
          type:
            - number
            - 'null'
          description: >-
            Unfiltered realized PnL before `pnlMode` adjustments. Present on
            position rows and leaderboard period stats when available.
        unrealized:
          type:
            - number
            - 'null'
          description: >-
            Paper profit/loss on tokens still held, based on current market
            price.
        total:
          type:
            - number
            - 'null'
          description: Sum of realized + unrealized PnL.
    TokenMeta:
      type: object
      description: Basic token metadata and current market data.
      properties:
        symbol:
          type:
            - string
            - 'null'
        name:
          type:
            - string
            - 'null'
        decimals:
          type:
            - integer
            - 'null'
        price:
          type:
            - number
            - 'null'
          description: Current price in USD.
        liquidity:
          type:
            - number
            - 'null'
          description: Current liquidity in USD.
        marketCap:
          type:
            - number
            - 'null'
          description: Current market cap in USD.
        primaryMarket:
          type:
            - string
            - 'null'
          description: Primary DEX where this token trades (e.g. Raydium, Orca).
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: 用于鉴权的 API Key

````