# Wallet PnL Analyzer — On-Chain Profit & Loss by Address (`gochujang/wallet-pnl-analyzer`) Actor

On-demand wallet analysis: full ERC20 transfer history, per-token positions, current USD value via DexScreener, top 10 holdings. Supports Ethereum, Base, Arbitrum, Optimism, Polygon, BSC. PPE $0.05 per wallet analyzed. No subscription.

- **URL**: https://apify.com/gochujang/wallet-pnl-analyzer.md
- **Developed by:** [Hojun Lee](https://apify.com/gochujang) (community)
- **Categories:** Developer tools, Automation, News
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $50.00 / 1,000 wallet analyzeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Wallet PnL Analyzer

> On-demand wallet analysis: full ERC20 history, per-token positions, current USD value, top holdings. **Free Zerion / Debank alternative.** Pay $0.05 per analysis, no subscription.

***

### ⚡ Run in 30 seconds

Click **Start** with default settings — analyzes the sample Ethereum wallet and returns every ERC-20 token position with current USD value, total portfolio value, realized/unrealized PnL, and top holdings ranked by value.

***

### Input Parameters

| Parameter | Type | Default | Description |
|---|---|---|---|
| `walletAddress` | string | `—` | EVM wallet address (0x...). |
| `chain` | string | `ethereum` | EVM chain to analyze. |
| `priceCurrentHoldings` | boolean | `true` | Fetch current USD price for each open position via DexScreener. |
| `minHoldingUsd` | integer | `0` | Skip positions worth less than this USD value. 0 = include all. |
| `etherscanApiKey` | string | `—` | Bring your own Etherscan V2 key for higher rate limits. Default works  |
| `telegramBotToken` | string | `—` | Telegram bot token for summary notification. |
| `telegramChatId` | string | \`\` | Telegram chat ID to send alerts to (get it from @userinfobot) |

***

### Why this exists

You want to analyze a wallet — your own, a competitor's, a whale's — and the options are:

- **Etherscan UI**: free, but no PnL, no current portfolio value
- **Zerion**: $15/mo, paywalls the API
- **Debank Pro**: gated, scrapes blocked
- **Nansen**: $150/mo, mostly aggregate data

This actor takes one wallet address, pulls every ERC20 transfer from Etherscan V2, builds a per-token ledger, prices open positions via DexScreener, and returns a clean PnL report — for **$0.05**.

***

### Supported chains

| Chain | Status |
|---|---|
| Ethereum | ✅ |
| Base | ✅ |
| Arbitrum | ✅ |
| Optimism | ✅ |
| Polygon | ✅ |
| BSC | ✅ |

***

### What you get

#### 1. Summary row

```json
{
  "_type": "summary",
  "wallet": "0xd8da...96045",
  "chain": "ethereum",
  "total_transfers": 1247,
  "unique_tokens": 38,
  "open_position_count": 12,
  "current_portfolio_value_usd": 4250120.50,
  "top_10_holdings": [
    {"symbol": "USDC", "qty": 2000000, "value_usd": 2000000},
    {"symbol": "WETH", "qty": 850, "value_usd": 2028500},
    ...
  ]
}
```

#### 2. One row per token

```json
{
  "_type": "token_position",
  "token_symbol": "WETH",
  "token_name": "Wrapped Ether",
  "token_address": "0xc02aaa39...",
  "buy_count": 23,
  "sell_count": 18,
  "transfers_in": 23,
  "transfers_out": 18,
  "total_buy_qty": 1200.5,
  "total_sell_qty": 350.0,
  "net_qty": 850.5,
  "current_price_usd": 2385.0,
  "current_value_usd": 2028442.5,
  "first_seen_ts": 1707000000,
  "last_seen_ts":  1717999999
}
```

***

### Quick start

#### Analyze Vitalik's main wallet on Ethereum

```json
{
  "walletAddress": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
  "chain": "ethereum"
}
```

#### Analyze a Base wallet, filter dust

```json
{
  "walletAddress": "0x...",
  "chain": "base",
  "minHoldingUsd": 100
}
```

#### Analyze multiple chains

Run the actor 6 times (one per chain) and merge results — each costs $0.05.

***

### Pricing

**Pay-Per-Event**: `$0.05 per wallet analyzed.`

Flat fee per run regardless of transfer count. Vs:

- Zerion API: $15/mo (subscription)
- Debank Pro: $40/mo
- Nansen: $150/mo

If you analyze fewer than 300 wallets/mo, this actor is cheaper than any subscription.

***

### How it works

1. **Etherscan V2 tokentx** — page through all ERC20 transfers (up to 10K) for the wallet
2. **Build buy/sell ledger** per token from incoming vs outgoing transfers
3. **DexScreener price lookup** for open positions (max-liquidity pair on the target chain)
4. **Aggregate** per-token totals + top-10 holdings + summary
5. **Push rows** with `_type: "summary"` or `_type: "token_position"` for easy filtering

***

### Limitations & honest disclosure

- **No native ETH/MATIC/BNB tracking** in this version — only ERC20s. Native PnL coming in v0.2.
- **No swap-level matching** — counts buys / sells based on transfer direction, not actual DEX swap matching. Tokens received via airdrop will count as a "buy" with cost-basis 0.
- **No realized PnL with cost basis** — net\_qty + current\_value gives you portfolio snapshot, not historical realized PnL. Cost-basis tracking with cross-token swap matching is v0.3.
- **Prices via DexScreener** — for highly illiquid or new tokens, may be stale or absent.

For more sophisticated PnL (cross-token matching, FIFO cost basis, capital gains tax reports), use CoinTracker or Koinly.

***

### Related actors (same author)

- [Smart Money Wallet Tracker](https://apify.com/gochujang/smart-money-tracker) — Find smart wallets, then analyze them here
- [DeFi Liquidation Risk Checker](https://apify.com/gochujang/defi-liquidation-risk-checker) — Check Aave/Compound positions on the same wallet
- [Hyperliquid Whale Tracker](https://apify.com/gochujang/hyperliquid-whale-tracker) — Perp side
- [Token Holder Tracker](https://apify.com/gochujang/token-holder-tracker)

***

### Feedback

A short review helps other crypto analysts find it: [Leave a review on Apify Store](https://apify.com/gochujang/wallet-pnl-analyzer#reviews)

# Actor input Schema

## `walletAddress` (type: `string`):

EVM wallet address (0x...).

## `chain` (type: `string`):

EVM chain to analyze.

## `priceCurrentHoldings` (type: `boolean`):

Fetch current USD price for each open position via DexScreener.

## `minHoldingUsd` (type: `integer`):

Skip positions worth less than this USD value. 0 = include all.

## `etherscanApiKey` (type: `string`):

Bring your own Etherscan V2 key for higher rate limits. Default works for low volume.

## `telegramBotToken` (type: `string`):

Telegram bot token for summary notification.

## `telegramChatId` (type: `string`):

Telegram chat ID to send alerts to (get it from @userinfobot)

## Actor input object example

```json
{
  "walletAddress": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
  "chain": "ethereum",
  "priceCurrentHoldings": true,
  "minHoldingUsd": 0,
  "telegramChatId": ""
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

## `summary` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "walletAddress": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
};

// Run the Actor and wait for it to finish
const run = await client.actor("gochujang/wallet-pnl-analyzer").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "walletAddress": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" }

# Run the Actor and wait for it to finish
run = client.actor("gochujang/wallet-pnl-analyzer").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "walletAddress": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
}' |
apify call gochujang/wallet-pnl-analyzer --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=gochujang/wallet-pnl-analyzer",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/tmcccQ1YF8EQeBXoZ/builds/zG0pTVGlEyw9xLToW/openapi.json
