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

# Wallet trade history with per-trade PnL

> Cursor-paginated trade history for a wallet, newest first. Per-trade `pnl_delta_sol` is the FIFO realized gain/loss on sells; `null` on buys.

Filter by `from_token` or `to_token` to scope to a specific mint. For Phase 4 both params filter against the swap's token mint (pump.fun is single-mint-vs-SOL). True two-leg Jupiter routing attribution ships in Phase 5.

`hide_arb` and `parse_jupiter` are accepted but are **no-ops in Phase 4**. The response always includes a `coverage_note` pointing to Phase 5. Wire them into your UI now so they take effect without a contract change.

Response cached 30 seconds.



## OpenAPI

````yaml /api-reference/openapi.json get /wallets/{w}/trades
openapi: 3.1.0
info:
  title: Dexploit API
  version: 1.0.0
  description: Real-time and historical Solana DEX swap and OHLCV data.
servers:
  - url: https://api.dexploit.dev
    description: Production
security:
  - ApiKeyHeader: []
  - BearerAuth: []
  - ApiKeyQuery: []
paths:
  /wallets/{w}/trades:
    get:
      tags:
        - Wallet portfolio
      summary: Wallet trade history with per-trade PnL
      description: >-
        Cursor-paginated trade history for a wallet, newest first. Per-trade
        `pnl_delta_sol` is the FIFO realized gain/loss on sells; `null` on buys.


        Filter by `from_token` or `to_token` to scope to a specific mint. For
        Phase 4 both params filter against the swap's token mint (pump.fun is
        single-mint-vs-SOL). True two-leg Jupiter routing attribution ships in
        Phase 5.


        `hide_arb` and `parse_jupiter` are accepted but are **no-ops in Phase
        4**. The response always includes a `coverage_note` pointing to Phase 5.
        Wire them into your UI now so they take effect without a contract
        change.


        Response cached 30 seconds.
      operationId: getWalletTrades
      parameters:
        - name: w
          in: path
          required: true
          schema:
            type: string
          description: Wallet address (base58, 32–44 characters).
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            default: 50
            minimum: 1
            maximum: 200
        - name: before
          in: query
          required: false
          schema:
            type: integer
          description: >-
            Cursor — Unix epoch milliseconds. Returns trades strictly older than
            this timestamp. Use `next_before` from the previous response.
        - name: from_token
          in: query
          required: false
          schema:
            type: string
          description: Filter to trades involving this token mint.
        - name: to_token
          in: query
          required: false
          schema:
            type: string
          description: >-
            Filter to trades involving this token mint (alias of `from_token` in
            Phase 4; full two-leg routing in Phase 5).
        - name: dex
          in: query
          required: false
          schema:
            type: integer
          description: Filter to a single DEX by integer ID. See `DexId` for the mapping.
        - name: hide_arb
          in: query
          required: false
          schema:
            type: boolean
          description: >-
            **No-op in Phase 4.** Will filter arbitrage round-trips when the arb
            tagger ships in Phase 5.
        - name: parse_jupiter
          in: query
          required: false
          schema:
            type: boolean
          description: >-
            **No-op in Phase 4.** Will expand Jupiter aggregator hops and
            attribute trades to source/destination tokens in Phase 5.
      responses:
        '200':
          description: Trade history page
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TradesResponse'
        '400':
          description: Invalid parameter
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
components:
  schemas:
    TradesResponse:
      type: object
      description: Cursor-paginated trade history for a wallet, newest first.
      required:
        - wallet
        - trades
      properties:
        wallet:
          type: string
        trades:
          type: array
          items:
            $ref: '#/components/schemas/Trade'
        next_before:
          type:
            - integer
            - 'null'
          description: >-
            Pass as `?before=` on the next request to get the next page. `null`
            when there are no more trades.
        coverage_note:
          type: string
          description: >-
            Always present in Phase 4. Explains that `hide_arb` and
            `parse_jupiter` are no-ops until Phase 5.
    ErrorEnvelope:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          enum:
            - false
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              example: INVALID_PARAM
            message:
              type: string
              example: >-
                use pair_address; see /api/v1/pairs?token_address=X to discover
                pools
    Trade:
      type: object
      description: >-
        One trade in a wallet's history. `pnl_delta_sol` is the FIFO realized
        gain/loss on sells; `null` on buys.
      required:
        - signature
        - timestamp
        - mint
        - is_buy
        - sol_amount
        - token_amount
        - dex
      properties:
        signature:
          type: string
          description: Solana transaction signature.
        timestamp:
          type: integer
          format: int64
          description: Unix epoch milliseconds.
        mint:
          type: string
          description: Token mint address.
        is_buy:
          type: boolean
          description: '`true` if SOL → token; `false` if token → SOL.'
        sol_amount:
          type: number
          description: SOL value of the swap (already divided by 1e9 from lamports).
        token_amount:
          type: integer
          format: int64
          description: Token base units.
        dex:
          $ref: '#/components/schemas/DexId'
        pnl_delta_sol:
          type:
            - number
            - 'null'
          description: >-
            FIFO realized PnL in SOL on this sell (`proceeds − matched_cost`).
            Always `null` on buys.
    DexId:
      type: integer
      description: |-
        Integer DEX identifier used in raw swap rows. Mapping:

        | ID | DEX |
        | -- | --- |
        | 1  | `pumpfun` |
        | 2  | `pumpswap` |
        | 3  | `raydium_amm` |
        | 4  | `raydium_clmm` |
        | 5  | `raydium_cpmm` |
        | 6  | `orca` |
        | 7  | `meteora_damm_v2` |
        | 8  | `meteora_dbc` |
        | 9  | `meteora_dlmm` |
        | 10 | `meteora_pools` |
      enum:
        - 1
        - 2
        - 3
        - 4
        - 5
        - 6
        - 7
        - 8
        - 9
        - 10
  securitySchemes:
    ApiKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        Preferred for swaps-api endpoints (`/swaps/*`, `/stats/*`, `/trending`,
        `/pool-events`).
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Required by the OHLCV endpoints (`/api/v1/*`) and accepted by every
        other endpoint. Send `Authorization: Bearer ohlcv_live_sk_<your_key>`.
    ApiKeyQuery:
      type: apiKey
      in: query
      name: api_key
      description: >-
        Browser-friendly alternative to the Bearer header — accepted by every
        endpoint and required for WebSocket from the browser.

````