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

# Trader positions list

> Returns a trader's open or closed positions with lifetime PnL, live balance and token metadata, keyset-paginated. Follow `pagination.pagination_key` for the next page.

Lists one side of a trader's book: `status=open` (non-zero balance, the default) or `status=closed` (sold out). Each position carries its lifetime PnL, live balance and value, and `token_metadata` covers every token on the page.

* Sorted by `sort_by` (default `last_trade_at`) in `sort_order` (default `desc`).
* Pages hold at most 100 positions (`limit`). When `pagination.has_more` is true, pass `pagination.pagination_key` back, with the same `status`, `sort_by`, `sort_order` and `min_value_usd`, to get the next page.
* `min_value_usd` (open positions only) hides positions worth less than the given USD value at the live price. Tokens with no price count as worth \$0.

The [trader portfolio](https://docs.struct.to/api-reference/trader/trader-portfolio.md) returns the first page of each list. Its `active_positions_pagination` and `closed_positions_pagination` keys continue here:

| Portfolio list | Continue with |
| - | - |
| `active_positions_pnl_stats` | `status=open&min_value_usd=0.001&pagination_key=…` |
| `closed_positions_pnl_stats` | `status=closed&pagination_key=…` |

```bash theme={null}
curl "https://staging-api.struct.to/v1/trader/pnl/positions/list?chain=robinhood&chain_id=4663&trader=0x12a371444CCeBb6B64Cc35EBbC70d1d998433d51&status=open&sort_by=last_trade_at&sort_order=desc&limit=100&min_value_usd=0.001&fields=short" \
  -H "X-API-Key: YOUR_API_KEY"
```

```json Response (Long) theme={null}
{
  "trader": "0x12a371444ccebb6b64cc35ebbc70d1d998433d51",
  "status": "open",
  "positions": [
    {
      "token_address": "0x39dbed3a2bd333467115de45665cc57f813c4571",
      "buy_count": 8,
      "sell_count": 5,
      "buy_native": 4.85,
      "buy_usd": 12000.0,
      "buy_tokens": 680000.0,
      "sell_native": 6.22,
      "sell_usd": 15400.0,
      "sell_tokens": 420000.0,
      "pnl_native": 1.37,
      "pnl_usd": 3400.0,
      "pnl_native_percent": 28.25,
      "pnl_usd_percent": 28.33,
      "average_buy_price_usd": 0.01765,
      "average_buy_price_native": 7.13e-06,
      "average_sell_price_usd": 0.03667,
      "average_sell_price_native": 1.481e-05,
      "overall_average_price_usd": null,
      "overall_average_price_native": null,
      "average_buy_market_cap_usd": 261760.0,
      "average_buy_market_cap_native": 1760.0,
      "average_sell_market_cap_usd": 564290.0,
      "average_sell_market_cap_native": 3810.0,
      "overall_average_market_cap_usd": null,
      "overall_average_market_cap_native": null,
      "current_token_balance_usd": 25160.0,
      "current_token_balance_native": 10.17,
      "current_token_balance": 260000.0,
      "potential_max_value_usd": 41600.0,
      "potential_max_value_native": 16.81,
      "couldve_made_usd": 16440.0,
      "couldve_made_native": 6.64,
      "most_recent_pool_id": "0xed50bdeea8adc232f159486192a4157281d722ff",
      "first_active": 1784116377000,
      "last_active": 1784216377000
    }
  ],
  "token_metadata": [
    {
      "address": "0x39dbed3a2bd333467115de45665cc57f813c4571",
      "name": "Pons",
      "symbol": "PONS",
      "image_url": "https://cdn.example.com/pons.png",
      "created_at": 1783816377000,
      "protocol": "UniswapV4",
      "migrated_from_protocol": "PonsV2"
    }
  ]
}
```

```jsonc Response (Short) theme={null}
{
  "tr": "0x12a371444ccebb6b64cc35ebbc70d1d998433d51",
  "st": "open",
  "p": [
    {
      "ta": "0x39dbed3a2bd333467115de45665cc57f813c4571",
      "bc": 8,
      "sc": 5,
      "bn": 4.85,
      "bu": 12000.0,
      "bt": 680000.0,
      "sn": 6.22,
      "su": 15400.0,
      "st": 420000.0,
      "pnn": 1.37,
      "pu": 3400.0,
      "pnp": 28.25,
      "pup": 28.33,
      "abpu": 0.01765,
      "abpn": 7.13e-06,
      "aspu": 0.03667,
      "aspn": 1.481e-05,
      "oapu": null,
      "oapn": null,
      "abmcu": 261760.0,
      "abmcn": 1760.0,
      "asmcu": 564290.0,
      "asmcn": 3810.0,
      "oamcu": null,
      "oamcn": null,
      "ctbu": 25160.0,
      "ctbn": 10.17,
      "ctb": 260000.0,
      "pmvu": 41600.0,
      "pmvn": 16.81,
      "cmu": 16440.0,
      "cmn": 6.64,
      "mrp": "0xed50bdeea8adc232f159486192a4157281d722ff",
      "fa": 1784116377000,
      "la": 1784216377000
    }
  ],
  "tm": [
    {
      "a": "0x39dbed3a2bd333467115de45665cc57f813c4571",
      "n": "Pons",
      "s": "PONS",
      "i": "https://cdn.example.com/pons.png",
      "c": 1783816377000,
      "pr": "UniswapV4",
      "mp": "PonsV2"
    }
  ]
}
```


## OpenAPI

````yaml onchain-openapi.json GET /trader/pnl/positions/list
openapi: 3.1.0
info:
  title: Struct On-chain API
  description: >-
    RESTful API for token market data, discovery, holders, audits, and trader
    analytics across supported chains. Pass `fields=short` or header
    `x-field-names: short` for abbreviated keys. HTTP defaults to `long`. Token
    candlesticks, token trades and wallet batch trades also support
    `fields=array` for typed positional rows.
  version: 1.0.0
servers:
  - url: https://staging-api.struct.to/v1
    description: Staging
security:
  - ApiKey: []
paths:
  /trader/pnl/positions/list:
    get:
      tags:
        - Trader
      summary: Trader positions list
      description: >-
        Returns a trader's open or closed positions with lifetime PnL, live
        balance and token metadata, keyset-paginated. Follow
        `pagination.pagination_key` for the next page.
      operationId: get_trader_position_list
      parameters:
        - name: chain
          in: query
          description: Chain name. Required unless `chain_id` is provided.
          required: false
          schema:
            type: string
          example: robinhood
        - name: chain_id
          in: query
          description: Chain id. Required unless `chain` is provided. Use `-1` for Solana.
          required: false
          schema:
            type: integer
            format: int64
          example: 4663
        - name: trader
          in: query
          description: Trader wallet address (required).
          required: true
          schema:
            type: string
          example: '0x12a371444CCeBb6B64Cc35EBbC70d1d998433d51'
        - name: status
          in: query
          description: '`open` (non-zero balance, default) or `closed`.'
          required: false
          schema:
            type: string
          example: open
        - name: sort_by
          in: query
          description: >-
            `last_trade_at` (default), `first_trade_at`, `pnl_usd`,
            `pnl_native`, `buy_usd` or `sell_usd`.
          required: false
          schema:
            type: string
          example: last_trade_at
        - name: sort_order
          in: query
          description: '`desc` (default) or `asc`.'
          required: false
          schema:
            type: string
          example: desc
        - name: limit
          in: query
          description: Positions per page, at most 100 (default 50).
          required: false
          schema:
            type: integer
            minimum: 0
          example: 100
        - name: pagination_key
          in: query
          description: Opaque key from the previous page's `pagination.pagination_key`.
          required: false
          schema:
            type: string
        - name: min_value_usd
          in: query
          description: >-
            Open positions only: hide positions whose live USD value is below
            this (unpriced tokens count as 0). Pass the same value on every
            page.
          required: false
          schema:
            type: number
            format: double
          example: 0.001
        - name: x-field-names
          in: header
          required: false
          description: >-
            Select long (full) or short (abbreviated) field names. HTTP defaults
            to `long`. Takes precedence over `fields`. See [Response
            Format](/api-reference/response-format#long-and-short-field-names).
          schema:
            type: string
            enum:
              - long
              - short
            default: long
          example: short
        - name: fields
          in: query
          required: false
          description: >-
            Same as `x-field-names`. Use `long` or `short`. HTTP defaults to
            `long`. Ignored when the header is set. `field_names` is accepted as
            an alias.
          schema:
            type: string
            enum:
              - long
              - short
            default: long
          example: short
      responses:
        '200':
          description: Trader positions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TraderPositionListResponse'
              examples:
                long:
                  summary: Response (Long)
                  value:
                    trader: '0x12a371444ccebb6b64cc35ebbc70d1d998433d51'
                    status: open
                    positions:
                      - token_address: '0x39dbed3a2bd333467115de45665cc57f813c4571'
                        buy_count: 8
                        sell_count: 5
                        buy_native: 4.85
                        buy_usd: 12000
                        buy_tokens: 680000
                        sell_native: 6.22
                        sell_usd: 15400
                        sell_tokens: 420000
                        pnl_native: 1.37
                        pnl_usd: 3400
                        pnl_native_percent: 28.25
                        pnl_usd_percent: 28.33
                        average_buy_price_usd: 0.01765
                        average_buy_price_native: 0.00000713
                        average_sell_price_usd: 0.03667
                        average_sell_price_native: 0.00001481
                        overall_average_price_usd: null
                        overall_average_price_native: null
                        average_buy_market_cap_usd: 261760
                        average_buy_market_cap_native: 1760
                        average_sell_market_cap_usd: 564290
                        average_sell_market_cap_native: 3810
                        overall_average_market_cap_usd: null
                        overall_average_market_cap_native: null
                        current_token_balance_usd: 25160
                        current_token_balance_native: 10.17
                        current_token_balance: 260000
                        potential_max_value_usd: 41600
                        potential_max_value_native: 16.81
                        couldve_made_usd: 16440
                        couldve_made_native: 6.64
                        most_recent_pool_id: '0xed50bdeea8adc232f159486192a4157281d722ff'
                        first_active: 1784116377000
                        last_active: 1784216377000
                    token_metadata:
                      - address: '0x39dbed3a2bd333467115de45665cc57f813c4571'
                        name: Pons
                        symbol: PONS
                        image_url: https://cdn.example.com/pons.png
                        created_at: 1783816377000
                        protocol: UniswapV4
                        migrated_from_protocol: PonsV2
                short:
                  summary: Response (Short)
                  value:
                    tr: '0x12a371444ccebb6b64cc35ebbc70d1d998433d51'
                    st: open
                    p:
                      - ta: '0x39dbed3a2bd333467115de45665cc57f813c4571'
                        bc: 8
                        sc: 5
                        bn: 4.85
                        bu: 12000
                        bt: 680000
                        sn: 6.22
                        su: 15400
                        st: 420000
                        pnn: 1.37
                        pu: 3400
                        pnp: 28.25
                        pup: 28.33
                        abpu: 0.01765
                        abpn: 0.00000713
                        aspu: 0.03667
                        aspn: 0.00001481
                        oapu: null
                        oapn: null
                        abmcu: 261760
                        abmcn: 1760
                        asmcu: 564290
                        asmcn: 3810
                        oamcu: null
                        oamcn: null
                        ctbu: 25160
                        ctbn: 10.17
                        ctb: 260000
                        pmvu: 41600
                        pmvn: 16.81
                        cmu: 16440
                        cmn: 6.64
                        mrp: '0xed50bdeea8adc232f159486192a4157281d722ff'
                        fa: 1784116377000
                        la: 1784216377000
                    tm:
                      - a: '0x39dbed3a2bd333467115de45665cc57f813c4571'
                        'n': Pons
                        s: PONS
                        i: https://cdn.example.com/pons.png
                        c: 1783816377000
                        pr: UniswapV4
                        mp: PonsV2
        '400':
          description: >-
            Validation error — missing or invalid `trader`, `status`, `sort_by`,
            `sort_order`, `limit` or `pagination_key`.
components:
  schemas:
    TraderPositionListResponse:
      type: object
      required:
        - trader
        - status
        - positions
        - token_metadata
      properties:
        trader:
          type: string
        status:
          type: string
          description: '`open` or `closed`.'
        positions:
          type: array
          items:
            $ref: '#/components/schemas/TokenPnlStats'
        token_metadata:
          type: array
          items:
            $ref: '#/components/schemas/PortfolioTokenMetadata'
          description: Metadata for every token in `positions`.
    TokenPnlStats:
      type: object
      properties:
        token_address:
          type:
            - string
            - 'null'
        buy_count:
          type:
            - integer
            - 'null'
          format: int64
          minimum: 0
        sell_count:
          type:
            - integer
            - 'null'
          format: int64
          minimum: 0
        buy_native:
          type:
            - number
            - 'null'
          format: double
        buy_usd:
          type:
            - number
            - 'null'
          format: double
        buy_tokens:
          type:
            - number
            - 'null'
          format: double
        sell_native:
          type:
            - number
            - 'null'
          format: double
        sell_usd:
          type:
            - number
            - 'null'
          format: double
        sell_tokens:
          type:
            - number
            - 'null'
          format: double
        pnl_native:
          type:
            - number
            - 'null'
          format: double
        pnl_usd:
          type:
            - number
            - 'null'
          format: double
        pnl_native_percent:
          type:
            - number
            - 'null'
          format: double
        pnl_usd_percent:
          type:
            - number
            - 'null'
          format: double
        average_buy_price_usd:
          type:
            - number
            - 'null'
          format: double
        average_buy_price_native:
          type:
            - number
            - 'null'
          format: double
        average_sell_price_usd:
          type:
            - number
            - 'null'
          format: double
        average_sell_price_native:
          type:
            - number
            - 'null'
          format: double
        overall_average_price_usd:
          type:
            - number
            - 'null'
          format: double
        overall_average_price_native:
          type:
            - number
            - 'null'
          format: double
        average_buy_market_cap_usd:
          type:
            - number
            - 'null'
          format: double
        average_buy_market_cap_native:
          type:
            - number
            - 'null'
          format: double
        average_sell_market_cap_usd:
          type:
            - number
            - 'null'
          format: double
        average_sell_market_cap_native:
          type:
            - number
            - 'null'
          format: double
        overall_average_market_cap_usd:
          type:
            - number
            - 'null'
          format: double
        overall_average_market_cap_native:
          type:
            - number
            - 'null'
          format: double
        current_token_balance_usd:
          type:
            - number
            - 'null'
          format: double
        current_token_balance_native:
          type:
            - number
            - 'null'
          format: double
        current_token_balance:
          type:
            - number
            - 'null'
          format: double
        potential_max_value_usd:
          type:
            - number
            - 'null'
          format: double
        potential_max_value_native:
          type:
            - number
            - 'null'
          format: double
        couldve_made_usd:
          type:
            - number
            - 'null'
          format: double
        couldve_made_native:
          type:
            - number
            - 'null'
          format: double
        most_recent_pool_id:
          type:
            - string
            - 'null'
        first_active:
          type:
            - integer
            - 'null'
          format: int64
          description: Time of the first trade, in milliseconds.
        last_active:
          type:
            - integer
            - 'null'
          format: int64
          description: Time of the latest trade, in milliseconds.
    PortfolioTokenMetadata:
      type: object
      properties:
        address:
          type:
            - string
            - 'null'
        name:
          type:
            - string
            - 'null'
        symbol:
          type:
            - string
            - 'null'
        image_url:
          type:
            - string
            - 'null'
        created_at:
          type:
            - integer
            - 'null'
          format: int64
          description: Pool creation time, in milliseconds.
        protocol:
          type:
            - string
            - 'null'
        underlying_protocol:
          type:
            - string
            - 'null'
          description: >-
            AMM venue holding the pool's liquidity when `protocol` is a
            launchpad

            living on another AMM.
        migrated_from_protocol:
          type:
            - string
            - 'null'
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: X-API-Key
      description: Secret API key (`sk_*`) or JWT public key (`pk_jwt_*`).

````

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