> For the complete documentation index, see [llms.txt](https://docs.dapplooker.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dapplooker.com/products/api-endpoints/wallet-intelligence/wallet-p-and-l.md).

# Wallet P\&L

#### **Endpoint**

**GET** `https://api.dapplooker.com/v1/wallet-pnl/{address}`

#### **Authentication**

| Method                    | Description                                                                                                       |
| ------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| **API Key**               | Provide your DappLooker API key using the `api_key` query parameter for authenticated access.                     |
| **x402 Payment Protocol** | If `api_key` is not provided, the request automatically uses the x402 protocol for on-chain payment verification. |

#### **Path Parameters**

| Parameter | Type   | Mandatory | Description                           |
| --------- | ------ | --------- | ------------------------------------- |
| `address` | string | Yes       | EVM (`0x…`) or Solana wallet address. |

#### **Query Parameters**

| Parameter name                     | Type   | Mandatory | Description                                                                                  |
| ---------------------------------- | ------ | --------- | -------------------------------------------------------------------------------------------- |
| `api_key`                          | string | Yes       | Your unique DappLooker API key used for authentication. Optional if querying via x402        |
| `currency`                         | string | No        | Currency for all value fields. Default: `usd`.                                               |
| `filter[chain_ids]`                | string | No        | Comma-separated chain IDs to scope P\&L to specific networks.                                |
| `filter[fungible_ids]`             | string | No        | Comma-separated token IDs to scope P\&L to specific assets.                                  |
| `filter[fungible_implementations]` | string | No        | Filter by specific token contract implementations. Format: `ethereum:0x…,base:0x…`.          |
| `since`                            | string | No        | Start of the P\&L calculation window. Accepts ISO 8601 datetime or Unix timestamp (seconds). |
| `till`                             | string | No        | End of the P\&L calculation window. Accepts ISO 8601 datetime or Unix timestamp (seconds).   |

#### **Example Request**

bash

```bash
# Full wallet P&L across all chains and all time
curl --location 'https://api.dapplooker.com/v1/wallet-pnl/0x42b9df65b219b3dd36ff330a4dd8f327a6ada990?api_key=<API_KEY>&currency=usd'

# P&L scoped to Ethereum only
curl --location 'https://api.dapplooker.com/v1/wallet-pnl/0x42b9df65b219b3dd36ff330a4dd8f327a6ada990?api_key=<API_KEY>&filter[chain_ids]=ethereum'

# P&L for a specific time window (Q1 2026)
curl --location 'https://api.dapplooker.com/v1/wallet-pnl/0x42b9df65b219b3dd36ff330a4dd8f327a6ada990?api_key=<API_KEY>&since=2026-01-01T00:00:00Z&till=2026-03-31T23:59:59Z'

# P&L for a specific token
curl --location 'https://api.dapplooker.com/v1/wallet-pnl/0x42b9df65b219b3dd36ff330a4dd8f327a6ada990?api_key=<API_KEY>&filter[fungible_ids]=eth,usdc'
```

#### **Example Response**

json

```json
{
  "success": true,
  "data": {
    "wallet_address": "0x42b9df65b219b3dd36ff330a4dd8f327a6ada990",
    "currency": "usd",
    "net_invested": 38450.00,
    "total_invested": 52100.00,
    "total_fee": 1240.50,
    "realized_cost_basis": 28450.00,
    "received_external": 5000.00,
    "sent_external": 2000.00,
    "total_gain": 18106.05,
    "relative_total_gain_percentage": 47.09,
    "realized_gain": 11875.30,
    "relative_realized_gain_percentage": 30.89,
    "unrealized_gain": 6230.75,
    "relative_unrealized_gain_percentage": 16.20
  }
}
```

#### **Response Fields Explanation**

* `wallet_address` *(string)*: The queried wallet address.
* `currency` *(string)*: Currency used for all value fields.
* `net_invested` *(float)*: Net capital currently deployed — cost basis of open positions after accounting for received and sent external transfers.
* `total_invested` *(float)*: Gross capital deployed across all buy events, including positions that have since been closed.
* `total_fee` *(float)*: Total gas and protocol fees paid across all transactions included in this P\&L window.
* `realized_cost_basis` *(float)*: The cost basis of positions that have been fully or partially closed — used to calculate realized gain.
* `received_external` *(float)*: Value of fungible tokens received via external transfers (not buys). Deducted from cost basis to avoid inflating gains.
* `sent_external` *(float)*: Value of fungible tokens sent via external transfers (not sells). Excluded from realized gain calculations.
* `total_gain` *(float)*: Combined realized + unrealized gain in the selected currency.
* `relative_total_gain_percentage` *(float)*: `total_gain` as a percentage of `net_invested`.
* `realized_gain` *(float)*: Actual profit/loss from fully or partially closed positions in the selected currency.
* `relative_realized_gain_percentage` *(float)*: `realized_gain` as a percentage of `realized_cost_basis`.
* `unrealized_gain` *(float)*: Paper profit/loss on currently open positions — current market value vs. cost basis — in the selected currency.
* `relative_unrealized_gain_percentage` *(float)*: `unrealized_gain` as a percentage of `net_invested`.
