> ## 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.

# Solana 钱包代币持仓 API V2

> 获取 Solana 钱包持有的所有代币及其 USD 价值、24 小时变化、市值、收益率和定价池，可按价值、数量或涨跌排序。

钱包中的每个代币，每个代币一行。分布在多个代币账户中的余额会合并计算。钱包的 SOL 余额单独一行，`native: true`；代币账户中的 wrapped SOL 是另外一行。

每行包含 USD 和 SOL 价格、价值、24 小时变化、市值，以及 `market`（价格来源的池子）。流动性质押代币和 JLP 等生息代币还带有 `apy` 和 `yearlyUsd`。代币名称、符号和 logo 在 `tokens` 中。

代表 DeFi 仓位的代币（例如 LP 代币、金库份额或借贷凭证）不在此列出，而是出现在 [Get Wallet Positions](https://docs.solanatracker.io/cn/data-api/wallet-v2/wallet/get-wallet-positions.md) 中，因此不会重复计算。

没有价格的代币 `priceUsd` 为 `null`，不计入净值并排在最后。使用 `minValue` 可隐藏小额余额。

**分页。** 将 `nextCursor` 作为 `cursor` 传入，直到 `hasNextPage` 为 `false`，并保持 `sort`、`sortDirection` 和 `minValue` 不变。请在约 2 分钟内获取所有页面：之后余额会刷新，行可能在页面之间移动。

## SDK Example

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

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

const data = await client.getWalletTokensV2('CN8w8cuh87gZYjhpaPxbD78GTrBmUKmVysqgsC9uYu9i', {
  sort: 'value', // Or 'amount' or 'change24h'.
  minValue: 1, // Hides tokens worth less than $1.
  limit: 100,
});

for (const row of data.holdings) {
  console.log(data.tokens[row.mint]?.symbol, row.amount, row.usd, row.market?.market);
}

// client.iterateWalletTokensV2() walks every page.
```


## OpenAPI

````yaml /cn/data-api/wallet-v2/openapi.json get /v2/wallet/{wallet}/tokens
openapi: 3.1.0
info:
  title: Solana Tracker Wallet API v2
  version: 2.0.0
  description: >-
    Solana 钱包持有和赚取的一切：代币，以及在借贷、流动性、质押、杠杆和挂单平台上的 DeFi 仓位，按 USD 和 SOL
    计价，并提供收益率、可领取奖励和净值历史。百分比直接用数字表示（6.99 即 6.99%），除另有说明外，时间均为 Unix 毫秒。
  contact:
    email: contact@solanatracker.io
servers:
  - url: https://data.solanatracker.io
    description: Production server
security:
  - apiKey: []
tags:
  - name: Wallet
    description: 钱包的净值、代币、DeFi 仓位和净值历史。
  - name: Platforms
    description: Wallet V2 支持的 DeFi 平台。
paths:
  /v2/wallet/{wallet}/tokens:
    get:
      tags:
        - Wallet
      summary: Get Wallet Tokens
      description: 钱包中的每个代币，每个代币一行，附带价格、价值、24 小时变化、生息代币的收益率，以及价格来源的池子。
      operationId: getWalletTokensV2
      parameters:
        - $ref: '#/components/parameters/Wallet'
        - $ref: '#/components/parameters/Limit'
        - $ref: '#/components/parameters/Cursor'
        - $ref: '#/components/parameters/TokenSort'
        - $ref: '#/components/parameters/SortDirection'
        - $ref: '#/components/parameters/MinValue'
      responses:
        '200':
          description: 一页钱包代币。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WalletV2TokensResponse'
              example:
                wallet: CN8w8cuh87gZYjhpaPxbD78GTrBmUKmVysqgsC9uYu9i
                slot: 475880510
                updatedAt: 1796067095507
                holdings:
                  - mint: So11111111111111111111111111111111111111112
                    native: true
                    amount: 90.206855417
                    priceUsd: 70.59621911611814
                    usd: 6368.262931
                    change24h:
                      usd: -143.111131
                      percent: -2.2
                    apy: null
                    yearlyUsd: null
                    accounts:
                      - CN8w8cuh87gZYjhpaPxbD78GTrBmUKmVysqgsC9uYu9i
                    priceSol: 1
                    marketCapUsd: 41798032000.91
                    market:
                      pool: 3ucNos4NbumPLZNWztqGHNFFgkHeRMBQAVemeeomsUxv
                      market: raydium-clmm
                      quoteToken: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                      liquidityUsd: 5463752.959761908
                      buys: 9655901
                      sells: 5678715
                      lpBurn: 0
                      createdAt: null
                      mintAuthority: null
                      freezeAuthority: null
                      volume24hUsd: 15002704.633705806
                  - mint: 2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo
                    native: false
                    amount: 331.403437
                    priceUsd: 1.0001716013994661
                    usd: 331.460306
                    change24h:
                      usd: 0.047309
                      percent: 0.01
                    apy: null
                    yearlyUsd: null
                    accounts:
                      - CwqQ9ATCstxfuXK5KAMP6NZQk3yPeGukssdgZicK6V31
                    priceSol: 0.0141674952841
                    marketCapUsd: 688800917.2
                    market:
                      pool: 9tXiuRRw7kbejLhZXtxDxYs2REe43uH2e7k1kocgdM9B
                      market: orca
                      quoteToken: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                      liquidityUsd: 18880560.60595127
                      buys: 19790
                      sells: 36656
                      lpBurn: 0
                      createdAt: 1739746605000
                      mintAuthority: DRXA1H9SjZPyPCEeuAWpfwk8GqVW6dZsKFAtdfpFwApX
                      freezeAuthority: 2apBGMsS6ti9RyF5TwQTDswXBWskiJP2LD4cUEDqYJjk
                      volume24hUsd: 2984713.513107223
                  - mint: Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB
                    native: false
                    amount: 90.041275
                    priceUsd: 1
                    usd: 90.041275
                    change24h:
                      usd: 0
                      percent: 0
                    apy: null
                    yearlyUsd: null
                    accounts:
                      - 4PdxHm2q9pijHw1L2d3s52TwheVfAGuBYtXTXdJESVSZ
                    priceSol: 0.0141650645392
                    marketCapUsd: 3839903778.2
                    market:
                      pool: 7XawhbbxtsRcQA8KTkHT9f9nc6d69UwqCDh6U5EEbEmX
                      market: raydium
                      quoteToken: So11111111111111111111111111111111111111112
                      liquidityUsd: 837422.2772992249
                      buys: 863564
                      sells: 785526
                      lpBurn: 0
                      createdAt: null
                      mintAuthority: Q6XprfkF8RQQKoQVG33xT88H7wi8Uk1B1CC7YAs69Gi
                      freezeAuthority: Q6XprfkF8RQQKoQVG33xT88H7wi8Uk1B1CC7YAs69Gi
                      volume24hUsd: 100712.71976680927
                tokens:
                  So11111111111111111111111111111111111111112:
                    name: Wrapped SOL
                    symbol: SOL
                    decimals: 9
                    image: >-
                      https://image.solanatracker.io/proxy?url=https://static.datapi.jup.ag/token-icons/79a96c7b893fd899512411dd07a8adf6f9e26dd135989f51d46ddb50f0b8bb6c.webp
                    supply: 592071820.902525
                    uri: null
                    description: null
                    creator: null
                    createdOn: null
                    twitter: null
                    telegram: null
                    website: null
                  2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo:
                    name: PayPal USD
                    symbol: PYUSD
                    decimals: 6
                    image: >-
                      https://image.solanatracker.io/proxy?url=https://static.datapi.jup.ag/token-icons/0817b3345e648b1663385bac48eb086877635ee27639c3d5da2a4d9dfd8603b1.webp
                    supply: 688682738.280124
                    uri: >-
                      https://token-metadata.paxos.com/pyusd_metadata/prod/solana/pyusd_metadata.json
                    description: >-
                      PayPal USD is designed to contribute to the opportunity
                      stablecoins offer for payments and is 100% backed by U.S.
                      dollar deposits, short-term U.S Treasuries and similar
                      cash equivalents. PayPal USD is redeemable 1:1 for U.S.
                      dollars and is issued by Paxos Trust Company.
                    creator: null
                    createdOn: null
                    twitter: null
                    telegram: null
                    website: null
                  Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB:
                    name: USDT
                    symbol: USDT
                    decimals: 6
                    image: >-
                      https://image.solanatracker.io/proxy?url=https://static.datapi.jup.ag/token-icons/36574a5ee2cd469e059d070180985e59fbd57c82a54ea95763fab39973174100.webp
                    supply: 3839903778.200564
                    uri: null
                    description: null
                    creator: null
                    createdOn: null
                    twitter: null
                    telegram: null
                    website: null
                nextCursor: >-
                  eyJ2IjoyLCJhdCI6MTc5NjA2NzA5NTUwNywicyI6OTAuMDQxMjc1LCJ0IjoiRXM5dk1GcnphQ0VSbUpmckY0SDJGWUQ0S0NvTmtZMTFNY0NlOEJlbndOWUIiLCJxIjoidHx2YWx1ZXxkfDEifQ
                hasNextPage: true
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '503':
          $ref: '#/components/responses/Unavailable'
      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.getWalletTokensV2('CN8w8cuh87gZYjhpaPxbD78GTrBmUKmVysqgsC9uYu9i',
            {
              sort: 'value', // Or 'amount' or 'change24h'.
              minValue: 1, // Hides tokens worth less than $1.
              limit: 100,
            });


            for (const row of data.holdings) {
              console.log(data.tokens[row.mint]?.symbol, row.amount, row.usd, row.market?.market);
            }


            // client.iterateWalletTokensV2() walks every page.
      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.getWalletTokensV2('CN8w8cuh87gZYjhpaPxbD78GTrBmUKmVysqgsC9uYu9i',
            {
              sort: 'value', // Or 'amount' or 'change24h'.
              minValue: 1, // Hides tokens worth less than $1.
              limit: 100,
            });


            for (const row of data.holdings) {
              console.log(data.tokens[row.mint]?.symbol, row.amount, row.usd, row.market?.market);
            }


            // client.iterateWalletTokensV2() walks every page.
components:
  parameters:
    Wallet:
      name: wallet
      in: path
      required: true
      schema:
        type: string
        default: CN8w8cuh87gZYjhpaPxbD78GTrBmUKmVysqgsC9uYu9i
      description: 钱包地址。
    Limit:
      name: limit
      in: query
      schema:
        type: integer
        minimum: 1
        maximum: 500
        default: 100
      description: 每页行数，最多 500。超过 500 时按 500 行返回。
    Cursor:
      name: cursor
      in: query
      schema:
        type: string
      description: 上一页返回的 `nextCursor`。其他参数需保持不变，否则请求会返回 400。
    TokenSort:
      name: sort
      in: query
      schema:
        type: string
        enum:
          - value
          - amount
          - change24h
        default: value
      description: '`value` 按 USD 价值排序（默认），`amount` 按代币数量，`change24h` 按 24 小时价格涨跌。'
    SortDirection:
      name: sortDirection
      in: query
      schema:
        type: string
        enum:
          - DESC
          - ASC
        default: DESC
      description: '`DESC` 从大到小（默认），`ASC` 从小到大。没有值的行始终排在最后。'
    MinValue:
      name: minValue
      in: query
      schema:
        type: number
        minimum: 0
      description: 只返回价值不低于该 USD 金额的代币。没有价格的代币不会返回。
  schemas:
    WalletV2TokensResponse:
      type: object
      required:
        - wallet
        - slot
        - updatedAt
        - holdings
        - tokens
        - nextCursor
        - hasNextPage
      properties:
        wallet:
          type: string
        slot:
          type: integer
          description: Solana slot the data was fetched at.
        updatedAt:
          type: integer
          description: When the data was fetched, in Unix milliseconds.
        holdings:
          type: array
          items:
            $ref: '#/components/schemas/WalletV2Token'
        tokens:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/TradeTokenV2'
          description: >-
            Details of each token on the page: name, symbol, decimals, logo and
            supply, plus metadata link, description, creator and socials when
            known.
        nextCursor:
          type:
            - string
            - 'null'
          description: Pass as `cursor` to get the next page. Null on the last page.
        hasNextPage:
          type: boolean
    WalletV2Token:
      type: object
      description: >-
        A token in the wallet. Values are in USD and percentages are plain
        numbers (6.99 means 6.99%). Unknown values are null.
      required:
        - mint
        - native
        - amount
        - priceUsd
        - usd
        - change24h
        - apy
        - yearlyUsd
        - accounts
        - priceSol
        - marketCapUsd
        - market
      properties:
        mint:
          type: string
        native:
          type: boolean
          description: >-
            `true` on the row for the wallet's SOL balance. Wrapped SOL in a
            token account is a separate row.
        amount:
          type: number
          description: >-
            Amount in whole tokens, across all of the wallet's token accounts.
            Already adjusted for decimals.
        priceUsd:
          type:
            - number
            - 'null'
          description: Price of one token in USD. Null when no price is available.
        usd:
          type:
            - number
            - 'null'
          description: >-
            Value in USD (`amount` × `priceUsd`). Null when there is no price;
            the token is then not counted in totals.
        change24h:
          type: object
          required:
            - usd
            - percent
          description: >-
            How much this holding's value changed in 24 hours because of the
            price move. Both fields are null when the price 24 hours ago is
            unknown.
          properties:
            usd:
              type:
                - number
                - 'null'
              description: Change in USD.
            percent:
              type:
                - number
                - 'null'
              description: Change in percent.
        apy:
          type:
            - number
            - 'null'
          description: >-
            Yearly yield in percent for yield-bearing tokens, such as liquid
            staking tokens and JLP. Null for other tokens.
        yearlyUsd:
          type:
            - number
            - 'null'
          description: >-
            USD the holding earns per year at that rate. Null without a rate or
            price.
        accounts:
          type: array
          items:
            type: string
          description: >-
            The token accounts holding this token. On the SOL row, the wallet
            address.
        priceSol:
          type:
            - number
            - 'null'
          description: Price of one token in SOL. Null when no price is available.
        marketCapUsd:
          type:
            - number
            - 'null'
          description: Price times total supply, in USD. Null when unknown.
        market:
          oneOf:
            - $ref: '#/components/schemas/WalletV2Market'
            - type: 'null'
          description: >-
            The pool the token's price comes from. Null when the token is priced
            another way (for example, a liquid staking token priced by its
            exchange rate) or has no price.
    TradeTokenV2:
      type: object
      description: Token details, current at the time of the request.
      required:
        - name
        - symbol
        - decimals
        - image
        - supply
      properties:
        name:
          type:
            - string
            - 'null'
        symbol:
          type:
            - string
            - 'null'
        decimals:
          type:
            - integer
            - 'null'
        image:
          type:
            - string
            - 'null'
        supply:
          type:
            - number
            - 'null'
          description: Current supply, in whole tokens.
        uri:
          type:
            - string
            - 'null'
          description: Metadata link, when known.
        description:
          type:
            - string
            - 'null'
          description: At most 2,000 characters.
        creator:
          type:
            - string
            - 'null'
        createdOn:
          type:
            - string
            - 'null'
        twitter:
          type:
            - string
            - 'null'
        telegram:
          type:
            - string
            - 'null'
        website:
          type:
            - string
            - 'null'
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Error message.
    WalletV2Market:
      type: object
      description: >-
        The pool a token's price comes from: the most liquid pool with a recent,
        reliable price.
      required:
        - pool
        - market
        - quoteToken
        - liquidityUsd
        - volume24hUsd
        - buys
        - sells
        - lpBurn
        - createdAt
        - mintAuthority
        - freezeAuthority
      properties:
        pool:
          type: string
          description: Pool address.
        market:
          type:
            - string
            - 'null'
          description: >-
            DEX of the pool, such as `raydium`, `orca`, `meteora-dlmm` or
            `pumpfun-amm`.
        quoteToken:
          type:
            - string
            - 'null'
          description: The token it is paired with in the pool.
        liquidityUsd:
          type:
            - number
            - 'null'
          description: Liquidity in the pool, in USD.
        volume24hUsd:
          type:
            - number
            - 'null'
          description: >-
            Volume in the pool over the last 24 hours, in USD. Null when
            unknown.
        buys:
          type:
            - number
            - 'null'
          description: Total number of buys in the pool.
        sells:
          type:
            - number
            - 'null'
          description: Total number of sells in the pool.
        lpBurn:
          type:
            - number
            - 'null'
          description: Share of the pool's LP tokens that are burned, in percent.
        createdAt:
          type:
            - number
            - 'null'
          description: When the pool was created, in Unix milliseconds. Null when unknown.
        mintAuthority:
          type:
            - string
            - 'null'
          description: Address that can mint more of the token. Null when nobody can.
        freezeAuthority:
          type:
            - string
            - 'null'
          description: Address that can freeze token accounts. Null when nobody can.
  responses:
    BadRequest:
      description: 钱包地址或查询参数无效。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: 'Invalid sort. Valid options are: value, amount, change24h'
    Unauthorized:
      description: API 密钥缺失或无效。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unavailable:
      description: 暂时无法加载该钱包。请在 `Retry-After` 秒后重试。
      headers:
        Retry-After:
          description: 重试前需等待的秒数。
          schema:
            type: integer
            example: 1
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: Wallet data is temporarily unavailable, please retry
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: API Key for authentication

````

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