Solana Tracker LogoSolana Tracker
Swap
Developers
⌘K
Affiliate
All Resources
Build a Solana Wallet Portfolio Tracker Without Account Parsing
Data APITypeScriptJune 1, 20262 min read

Build a Solana Wallet Portfolio Tracker Without Account Parsing

Return SPL balances, USD value and PnL for a Solana wallet from one enriched API response and live Datastream updates.

  • data-api,
  • wallet,
  • portfolio,
  • pnl,
  • typescript
Solana Data API›

Wallet portfolios should not start with token account parsing

Tracking a portfolio normally means: fetch all SPL token accounts, decode balances, match prices, compute USD values. With an enriched Solana Data API you get that back as a single JSON object.

What you need

  • A Solana Tracker API key (free) and Datastream key (Premium+, same dashboard)
  • Node.js 18+

Step 1: Wallet holdings

import { Client } from '@solana-tracker/data-api';

const client = new Client({
  apiKey: process.env.ST_API_KEY,
  baseUrl: 'https://data.solanatracker.io',
});
const portfolio = await client.getWallet(WALLET_ADDRESS);

console.log(portfolio.total, portfolio.totalSol);
for (const row of portfolio.tokens) {
  console.log(row.token.symbol, row.balance, row.value, row.pools?.[0]?.market);
}

Step 2: PnL v2 overview and positions

const overview = await client.getPnlV2WalletOverview(WALLET_ADDRESS);
if ('summary' in overview) {
  console.log(overview.summary.pnl.total, overview.analysis.winRate);
}

const positions = await client.getPnlV2WalletPositions(WALLET_ADDRESS, {
  limit: 10,
  sort: 'value',
});

Step 3: Live PnL on the Datastream

import WebSocket from 'ws';
(globalThis as any).WebSocket = WebSocket;
const { Datastream } = await import('@solana-tracker/data-api');

const ds = new Datastream({ wsUrl: `wss://datastream.solanatracker.io/${process.env.ST_DATASTREAM_KEY}` });
await ds.connect();

ds.subscribe.pnl.summary(WALLET_ADDRESS).on((update) => {
  console.log(update.pnl.total, update.openPositions.value);
});

FAQ

Do I get all SPL tokens automatically?

Yes, the wallet response includes every token with balance, metadata and USD value, no manual account parsing needed.

Can I see PnL per token?

Yes, getPnlV2WalletPositions() returns cost basis, ROI, and trade counts per token.

How do I keep it live without hitting rate limits?

Use the WebSocket subscribe.wallet(address).balance() room instead of REST polling.

Related: Get a Solana token price (REST) -> · Solana Data API

Download the example

Clone the full runnable project on GitHub, npm install && npm start with your keys in .env. Or open it in StackBlitz to run in your browser (free). See the tutorial for step-by-step context.

View source on GitHub›Run in StackBlitz›

Runnable Node.js project — clone from GitHub, add keys to .env, then npm start. StackBlitz runs REST and Datastream examples in your browser for free.

Related Guides

Rank Solana Traders by PnL, Not Follower Count
Data API

Rank Solana Traders by PnL, Not Follower Count

Read more
Stream a Live Solana Trade Tape over WebSocket
Data API

Stream a Live Solana Trade Tape over WebSocket

Read more
Build a Solana Token Screener with Search Filters
Data API

Build a Solana Token Screener with Search Filters

Read more

Products

  • Data API
  • Pump.fun API
  • Solana RPC
  • Dedicated Nodes
  • Yellowstone gRPC
  • Raptor Swap API
  • Enterprise

Trading

  • Swap
  • Latest Tokens
  • Trending
  • Top Gainers
  • Memescope
  • Whale Watch
  • KOL Tracker

Tools

  • Wallet Tracker
  • Rugcheck
  • PnL Leaderboard
  • KOLScan
  • Axiom Leaderboard
  • Photon Leaderboard
  • Bloom Leaderboard
  • My Positions
  • Teams

Resources

  • Developer Guides
  • Blog
  • Documentation
  • API Reference
  • Status
  • Affiliate Program — 25% recurring, uncapped
Solana TrackerSolana Tracker© 2026
Terms of ServicePrivacy PolicyContact