What Clicker Provides
| Data | Description |
|---|---|
| Cost Basis | What you paid for your tokens, tracked per acquisition |
| Holdings | Current token balances per position |
| Realized PNL | Actual profit/loss from closed positions |
| Lot History | Record of token acquisitions with cost basis |
| Sales History | Record of dispositions with realized gains |
How PNL Works
The Basic Flow
When you buy tokens and later sell them, Clicker tracks the cost basis and computes your realized gain or loss:How Receives Are Handled
On-chain, tokens can arrive without a purchase - airdrops, bridge transfers, staking rewards, payments. Clicker assigns a cost basis at market price when received:| Field | Definition |
|---|---|
| bought | Sum of actual dollars spent (buys only) |
| recv_basis | Market value of tokens at time of receive |
| cost_basis | bought + recv_basis - used for PNL calculation |
FIFO Lot Matching
When you sell tokens, Clicker uses FIFO (First In, First Out) to determine which tokens are sold first. Each acquisition creates a “lot” with its own cost basis:What You Need to Bring: Unrealized PNL
Clicker does not provide realtime token prices. We focus on the hard accounting problem - tracking cost basis and computing realized gains - while you retain control over pricing. For Unrealized PNL (paper gains on current holdings), use:| Input | Source |
|---|---|
| Holdings | Clicker API |
| Cost Basis | Clicker API |
| Realtime Price | Your pricing feed (Codex, CoinGecko, DEX, etc.) |
Why PNL Is Harder Than It Looks
Building accurate PNL for onchain trading involves solving several interconnected problems:Swap Detection
A blockchain transaction is just a list of token transfers. Determining whether those transfers represent a buy, sell, swap, airdrop, bridge, or something else requires parsing balance changes, identifying contract patterns (DEX routers, bridges), handling multi-hop swaps, and distinguishing intentional trades from fees, MEV, and dust.Cost Basis Tracking
Each acquisition creates a lot record:(token, amount, unit_price, timestamp, type). Partial sales consume lots in FIFO order, splitting lots when necessary. Receives are priced at market rate via Codex at transaction time.
Position Lifecycle
Position opens on first acquisition, closes when balance reaches zero (below dust threshold of ~$0.01). Re-acquiring after full sale opens a new position with fresh lots.Edge Cases
Failed transactions with partial state changes, LP token mints/burns, and cross-chain trades.What We Handle
Clicker solves these problems so you don’t have to:- Swap derivation from raw transaction data
- Cost basis tracking across acquisitions
- FIFO accounting for sales
- Position lifecycle management
- Cross-chain awareness for common bridges
- Historical pricing at transaction time (via Codex)
Summary
| Concern | Who Handles It |
|---|---|
| Cost basis tracking | Clicker |
| Realized PNL | Clicker |
| Position accounting | Clicker |
| Swap detection | Clicker |
| Realtime pricing | You |
| Unrealized PNL | You (using our data) |