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:Position-Based PnL (Not Token-Based)
Clicker uses position-based PnL tracking, which is the standard approach used by leading trading apps like Axiom and fomo. This differs from token-based systems that aggregate all activity on a token into a single view.How It Works
When you buy a token, Clicker opens a position. When you sell all of it, that position closes. If you re-enter that same token later, a new position opens with its own separate PnL:Why Position-Based Matters
With position-based tracking, each position stands on its own. This makes it easier to:- Reason about your trading history - See exactly how each entry into a token performed
- Evaluate current positions clearly - Your new entry’s PnL isn’t clouded by gains or losses from previous trades in the same token
Token-Based Systems Are Different
Some portfolio trackers use token-based PnL, which aggregates all activity on a token into one combined view. In the example above, a token-based system would show:Trade Types: Buys, Sells, and Swaps
Clicker categorizes every trade based on the tokens involved. This determines how we price each side of the trade.Quote Tokens
Quote tokens are the “base currencies” of crypto trading:- Native assets: ETH, SOL, and other chain-native tokens
- Stablecoins: USDC, USDT, DAI, and other standard stablecoins
How We Categorize Trades
| Trade Type | Definition | Example |
|---|---|---|
| Buy | Spending a quote token to acquire a non-quote token | ETH → PEPE |
| Sell | Selling a non-quote token back into a quote token | PEPE → USDC |
| Swap | Trading one non-quote token for another | PEPE → WIF |
How We Price Trades
Every trade has two sides: the token you send (sold) and the token you receive (bought). Clicker prices both sides independently at the block timestamp, then uses the appropriate side to determine trade value:Why We Price This Way
- Buys: The quote token (ETH, USDC) has reliable pricing. We use it to determine what you paid for the new token.
- Sells: The quote token you receive has reliable pricing. We use it to determine your proceeds.
- Swaps: Neither token is a quote token, so we price both independently. The sold token’s value becomes the cost basis for what you bought, and the bought token’s value determines the sale proceeds for what you sold. These values may differ slightly due to liquidity differences.
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) |