How to Calculate Solana Wallet PnL from On-Chain Transactions
A reliable cost-basis and PnL pipeline for Solana wallets across swaps, transfers and token-account changes.
A reliable cost-basis and PnL pipeline for Solana wallets across swaps, transfers and token-account changes.
Normalize trades
Decode inner instructions and net token changes by owner. A transfer is not automatically a trade and failed transactions must be excluded.
Cost basis
Choose FIFO, average cost or another explicit method. Treat inbound transfers with unknown basis separately rather than inventing profit.
Prices and fees
Attach timestamped prices, SOL fees, priority fees and token transfer fees. Preserve the price source for auditability.
Reconciliation
Compare computed holdings with live token accounts and flag unsupported programs or missing history.
Start with our Solana TX Inspector or build a wallet tracker.
Building this for production?
We turn this architecture into tested, non-custodial software with monitoring, documentation and deployment support.
Related technical guides
Best Solana RPC for Trading Bots: Reproducible Latency Benchmark
Benchmark Helius, QuickNode, Triton and self-hosted Solana RPC endpoints with a reproducible Node.js harness for p50/p95/p99 latency, errors and slot freshness.
Read articleJupiter Legacy Swap v1/v6 Guide: Quote and Route Migration Notes
Understand legacy Jupiter v6 quote and route responses, then migrate new Solana integrations to the currently supported Jupiter Swap API.
Read articleSanctum and LST Arbitrage: Trading Solana Liquid Staking Tokens
Build a Solana LST arbitrage bot around Sanctum: capture jitoSOL, mSOL and INF peg deviations against SOL via Infinity pool routes and unstake tickets.
Read article