Technical Deep Dive

How PnL is Calculated

A transparent look at how we process transactions, track cost basis, and compute accurate profit and loss for your Solana portfolio.

1High-Level Flow

Fetch Raw Transactions

We pull all historical transactions for your wallet from the Solana blockchain via Helius RPC.

Parse & Classify Transactions

Each transaction is analyzed to determine its type: Swap, Transfer, Liquidity, Create, or Burn.

Extract Token Changes & Fees

For each transaction, we extract token balance changes and identify all fees paid.

Update Token Info

Token-level metrics are updated: balance, cost basis, realized PnL, and transaction counts.

Aggregate to Portfolio

Token-level data is aggregated into portfolio-wide metrics with current price valuations.

2Transaction Classification

Each transaction is classified based on program interactions and balance changes:

SWAP

Exchange one token for another through a DEX (Jupiter, Raydium, Pump.fun, etc.)

• Detected via DEX program IDs
• Extracts input/output amounts
• Updates buy/sell metrics
TRANSFER

Move tokens between wallets (including your own wallets)

• Preserves cost basis through transfers
• Tracks pending cost basis for exports
• No realized PnL on transfers
LIQUIDITY

Add or remove liquidity from AMM pools

• Tracks ADD and REMOVE operations
• Calculates liquidity PnL separately
• Handles LP token issuance
CREATEBURN

Token creation (bonding curves) and token burns

• CREATE: Initial token purchase
• BURN: Token destruction
• Affects cost basis accordingly

3Fee Extraction

We identify and track all fees to ensure accurate cost basis and PnL:

Transaction Fees

Base Solana transaction fee + priority fee paid to validators

Protocol Fees

Fees paid to DEXs, trading bots (Photon, Axiom), and platforms

MEV Tips

Jito bundle tips and other MEV-related payments

Why fees matter: Most portfolio trackers ignore fees entirely. A $100 buy with $5 in fees means your actual cost basis is $105, not $100. This 5% difference compounds across hundreds of trades, leading to significantly incorrect PnL.

4PnL Calculation

Realized PnL is calculated when you sell tokens. We use FIFO (First In, First Out) cost basis:

// On each SELL transaction:
avgBuyCost = remainingCost / tokenBalance
costBasisSold = avgBuyCost × tokensSold
saleProceeds = actualAmountReceived
realizedPnL = saleProceeds - costBasisSold
Example: Profitable Trade
Buy 100 tokens for 1 SOL → Sell 50 tokens for 0.8 SOL
Cost basis: 0.5 SOL → Proceeds: 0.8 SOL
Realized PnL: +0.3 SOL (+60%)
Example: Loss Trade
Buy 100 tokens for 1 SOL → Sell 50 tokens for 0.2 SOL
Cost basis: 0.5 SOL → Proceeds: 0.2 SOL
Realized PnL: -0.3 SOL (-60%)

5Portfolio Aggregation

Individual token metrics are aggregated to create portfolio-wide statistics:

MetricCalculation
Total Realized PnLΣ token.realizedPnL
Total Unrealized PnLΣ token.unrealizedPnL
Win RatetokensWithProfit / totalTokens
Total FeesΣ token.fees (tx + protocol + MEV)
2x / 10x / 100x Countcount(token.pnlPct >= threshold)
Rug Countcount(token.pnlPct <= -95%)

6Supported Platforms & Protocols

DEX Aggregators

• Jupiter
• Raydium
• Orca
• Meteora

Launchpads

• Pump.fun
• Moonshot
• Bonk Bot

Trading Bots

• Photon
• Axiom
• BullX
• Trojan

Ready to see your real PnL?

Join the waitlist to get early access to accurate portfolio tracking.

Join Waitlist