> ## 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 token positions

> Returns the current positions of one or more traders in a specific token, including live balance, token metadata, and lifetime PnL. Set `include_closed=false` to keep only positions with a non-zero balance.

```bash theme={null}
curl "https://staging-api.struct.to/v1/trader/pnl/positions?chain=robinhood&chain_id=4663&token_address=0x39dBED3a2bd333467115dE45665cC57F813C4571&traders=0x12a371444CCeBb6B64Cc35EBbC70d1d998433d51&include_closed=false&fields=short" \
  -H "X-API-Key: YOUR_API_KEY"
```

```json Response (Long) theme={null}
[
  {
    "wallet": "0x12a371444CCeBb6B64Cc35EBbC70d1d998433d51",
    "token_address": "0x39dBED3a2bd333467115dE45665cC57F813C4571",
    "token_balance": "1250500000000000000000",
    "decimals": 18,
    "block_number": 22100000,
    "metadata": {
      "name": "Pons",
      "symbol": "PONS",
      "image_url": "https://cdn.example.com/pons.png",
      "protocol": "PonsV2"
    },
    "pnl_data": {
      "current_token_balance": 1250.5,
      "buy_count": 8,
      "sell_count": 5,
      "buy_usd": 178.0,
      "buy_native": 1.2,
      "buy_tokens": 680000.0,
      "sell_usd": 237.0,
      "sell_native": 1.6,
      "sell_tokens": 420000.0,
      "pnl_usd": 59.0,
      "pnl_native": 0.4,
      "pnl_usd_percent": 33.15,
      "pnl_native_percent": 33.33,
      "current_token_balance_usd": 120770.48,
      "current_token_balance_native": 0.0343,
      "avg_entry_price_usd": 0.00026176,
      "avg_entry_price_native": 1.76e-06,
      "avg_exit_price_usd": 0.00056429,
      "avg_exit_price_native": 3.81e-06,
      "avg_entry_market_cap_usd": 261760,
      "avg_exit_market_cap_usd": 564290,
      "avg_entry_market_cap_native": 1760,
      "avg_exit_market_cap_native": 3810,
      "first_active": 1705000000000,
      "last_active": 1710000000000,
      "most_recent_pool_id": "0xEd50bDeeA8aDC232f159486192a4157281D722ff"
    }
  }
]
```

```jsonc Response (Short) theme={null}
[
  {
    "w": "0x12a371444CCeBb6B64Cc35EBbC70d1d998433d51",
    "ta": "0x39dBED3a2bd333467115dE45665cC57F813C4571",
    "tb": "1250500000000000000000",
    "d": 18,
    "bn": 22100000,
    "md": {
      "n": "Pons",
      "sy": "PONS",
      "iu": "https://cdn.example.com/pons.png",
      "pr": "PonsV2"
    },
    "pnl": {
      "ctb": 1250.5,
      "bc": 8,
      "sc": 5,
      "bu": 178.0,
      "bn": 1.2,
      "bt": 680000.0,
      "su": 237.0,
      "sn": 1.6,
      "st": 420000.0,
      "pu": 59.0,
      "pn": 0.4,
      "pup": 33.15,
      "pnp": 33.33,
      "ctbu": 120770.48,
      "ctbn": 0.0343,
      "aepu": 0.00026176,
      "aepn": 1.76e-06,
      "axpu": 0.00056429,
      "axpn": 3.81e-06,
      "aemcu": 261760,
      "axmcu": 564290,
      "aemcn": 1760,
      "axmcn": 3810,
      "fa": 1705000000000,
      "la": 1710000000000,
      "mrpi": "0xEd50bDeeA8aDC232f159486192a4157281D722ff"
    }
  }
]
```


## OpenAPI

````yaml onchain-openapi.json GET /trader/pnl/positions
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:
    get:
      tags:
        - Trader
      summary: Trader token positions
      description: >-
        Returns the current positions of one or more traders in a specific
        token, including live balance, token metadata, and lifetime PnL. Set
        `include_closed=false` to keep only positions with a non-zero balance.
      operationId: get_trader_positions
      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: token_address
          in: query
          description: Token address (required).
          required: true
          schema:
            type: string
          example: '0x39dBED3a2bd333467115dE45665cC57F813C4571'
        - name: traders
          in: query
          description: >-
            Comma-separated trader addresses (max 25). Alias: `trader` (single).
            Required.
          required: false
          schema:
            type: string
          example: '0x12a371444CCeBb6B64Cc35EBbC70d1d998433d51'
        - name: trader
          in: query
          description: Single trader address (alternative to `traders`).
          required: false
          schema:
            type: string
        - name: include_closed
          in: query
          description: >-
            When false, drops positions whose current token balance is zero.
            Default true.
          required: false
          schema:
            type: boolean
          example: false
        - 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:
                type: array
                items:
                  $ref: '#/components/schemas/TraderPosition'
              examples:
                long:
                  summary: Response (Long)
                  value:
                    - wallet: '0x12a371444CCeBb6B64Cc35EBbC70d1d998433d51'
                      token_address: '0x39dBED3a2bd333467115dE45665cC57F813C4571'
                      token_balance: '1250500000000000000000'
                      decimals: 18
                      block_number: 22100000
                      metadata:
                        name: Pons
                        symbol: PONS
                        image_url: https://cdn.example.com/pons.png
                        protocol: PonsV2
                      pnl_data:
                        current_token_balance: 1250.5
                        buy_count: 8
                        sell_count: 5
                        buy_usd: 178
                        buy_native: 1.2
                        buy_tokens: 680000
                        sell_usd: 237
                        sell_native: 1.6
                        sell_tokens: 420000
                        pnl_usd: 59
                        pnl_native: 0.4
                        pnl_usd_percent: 33.15
                        pnl_native_percent: 33.33
                        current_token_balance_usd: 120770.48
                        current_token_balance_native: 0.0343
                        avg_entry_price_usd: 0.00026176
                        avg_entry_price_native: 0.00000176
                        avg_exit_price_usd: 0.00056429
                        avg_exit_price_native: 0.00000381
                        avg_entry_market_cap_usd: 261760
                        avg_exit_market_cap_usd: 564290
                        avg_entry_market_cap_native: 1760
                        avg_exit_market_cap_native: 3810
                        first_active: 1705000000000
                        last_active: 1710000000000
                        most_recent_pool_id: '0xEd50bDeeA8aDC232f159486192a4157281D722ff'
                short:
                  summary: Response (Short)
                  value:
                    - w: '0x12a371444CCeBb6B64Cc35EBbC70d1d998433d51'
                      ta: '0x39dBED3a2bd333467115dE45665cC57F813C4571'
                      tb: '1250500000000000000000'
                      d: 18
                      bn: 22100000
                      md:
                        'n': Pons
                        sy: PONS
                        iu: https://cdn.example.com/pons.png
                        pr: PonsV2
                      pnl:
                        ctb: 1250.5
                        bc: 8
                        sc: 5
                        bu: 178
                        bn: 1.2
                        bt: 680000
                        su: 237
                        sn: 1.6
                        st: 420000
                        pu: 59
                        pn: 0.4
                        pup: 33.15
                        pnp: 33.33
                        ctbu: 120770.48
                        ctbn: 0.0343
                        aepu: 0.00026176
                        aepn: 0.00000176
                        axpu: 0.00056429
                        axpn: 0.00000381
                        aemcu: 261760
                        axmcu: 564290
                        aemcn: 1760
                        axmcn: 3810
                        fa: 1705000000000
                        la: 1710000000000
                        mrpi: '0xEd50bDeeA8aDC232f159486192a4157281D722ff'
        '400':
          description: >-
            Validation error — missing `token_address`/`trader(s)`, >25 traders,
            or invalid address.
components:
  schemas:
    TraderPosition:
      type: object
      required:
        - wallet
        - token_address
        - token_balance
        - block_number
      properties:
        wallet:
          type: string
        token_address:
          type: string
        token_balance:
          type: string
        decimals:
          type:
            - integer
            - 'null'
          format: int32
          minimum: 0
        block_number:
          type: integer
          format: int64
          minimum: 0
        metadata:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/TokenMetadata'
        pnl_data:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/FrontendPnlStats'
    TokenMetadata:
      type: object
      properties:
        name:
          type:
            - string
            - 'null'
        symbol:
          type:
            - string
            - 'null'
        image_url:
          type:
            - string
            - 'null'
        protocol:
          type:
            - string
            - 'null'
    FrontendPnlStats:
      type: object
      properties:
        current_token_balance:
          type:
            - number
            - 'null'
          format: double
        buy_count:
          type: integer
          format: int64
          minimum: 0
        sell_count:
          type: integer
          format: int64
          minimum: 0
        buy_usd:
          type:
            - number
            - 'null'
          format: double
        buy_native:
          type:
            - number
            - 'null'
          format: double
        buy_tokens:
          type:
            - number
            - 'null'
          format: double
        sell_usd:
          type:
            - number
            - 'null'
          format: double
        sell_native:
          type:
            - number
            - 'null'
          format: double
        sell_tokens:
          type:
            - number
            - 'null'
          format: double
        pnl_usd:
          type:
            - number
            - 'null'
          format: double
        pnl_native:
          type:
            - number
            - 'null'
          format: double
        pnl_usd_percent:
          type: number
          format: double
        pnl_native_percent:
          type: number
          format: double
        current_token_balance_usd:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Decimal'
        current_token_balance_native:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Decimal'
        avg_entry_price_usd:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Decimal'
        avg_entry_price_native:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Decimal'
        avg_exit_price_usd:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Decimal'
        avg_exit_price_native:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Decimal'
        avg_entry_market_cap_usd:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Decimal'
        avg_exit_market_cap_usd:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Decimal'
        avg_entry_market_cap_native:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Decimal'
        avg_exit_market_cap_native:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Decimal'
        first_active:
          type:
            - integer
            - 'null'
          format: int64
          minimum: 0
        last_active:
          type:
            - integer
            - 'null'
          format: int64
          minimum: 0
        most_recent_pool_id:
          type:
            - string
            - 'null'
    Decimal:
      type: number
      format: double
      description: Floating-point number serialized as JSON number.
      examples:
        - 4.108801574e-7
  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.