Overview
Moralis provides realized profit and loss (PnL) analytics for wallets and tokens, calculated directly from on-chain swap activity. PnL data is designed for:- Wallet analytics
- Trading performance dashboards
- Portfolio tools
- Token-level profitability analysis
- Leaderboards and rankings
Supported PnL endpoints
PnL data is exposed through the following endpoints:- Wallet PnL Summary
High-level profitability metrics for a wallet - Wallet PnL Breakdown
Token-by-token profitability details - Top Traders by Token
Rankings of wallets by realized profit for a given token
What type of PnL is supported?
Moralis currently supports realized PnL only.- Realized PnL is calculated from completed on-chain swaps (buys and sells).
- Unrealized PnL (open positions based on current market prices) is not calculated directly by the PnL endpoints.
Calculating Unrealized PnL
You can calculate unrealized PnL yourself by combining:- Cost basis / realized trade data from the PnL endpoints
- Real-time token balances + real-time prices from the Token Balances endpoint
- Realized PnL
- Unrealized PnL
- Total PnL (realized + unrealized)
How PnL is calculated
Moralis uses a method closely aligned with a weighted average cost basis.Core formula
- avgSellPriceUsd
Continuously updated average sell price in USD - avgCostOfQuantitySold
Calculated as:
totalUsdInvested / totalTokensBought
How trades are matched
PnL is calculated per trading pair, not per token globally. Examples:- Buy
UNIwithWETH→ tracked asUNI/WETH - Sell
UNIforWETH→ updates the same trade - Sell
UNIforPEPE→ tracked as a new trade (UNI/PEPE)
Token pricing & trade history
Moralis determines token prices by:- Indexing on-chain DEX swap events
- Extracting price directly from swap logs
- Converting swap prices to USD
- Applying those prices to PnL calculations
Supported swap events
Currently supported swap topics:- Uniswap V2
- Uniswap V3
Transaction fees
Gas fees and transaction fees are not included in PnL calculations. PnL strictly reflects token-level trading performance, not net wallet balance changes.Update latency
PnL data updates in near real-time.- Average update time: ~10 seconds
- Triggered after swap settlement on-chain
- Live dashboards
- Trading analytics
- Near real-time alerts
Token Support
ERC20 Tokens
PnL is supported for all ERC20 tokens that:- Have participated in a supported DEX swap
- Emit supported swap events
- Are paired with either:
- a stablecoin (e.g. USDC, USDT, DAI), or
- a native or wrapped native token (e.g. ETH, WETH)
Native Tokens (e.g. ETH)
- Native tokens are supported for PnL, but only when traded against stablecoins.
- Trades between native tokens and stablecoins are used to establish realized PnL.
- ✅ ETH ↔ USDC → ETH PnL supported
- ❌ ETH ↔ WETH → not tracked (native ↔ wrapped native)
Wrapped Native Tokens (e.g. WETH)
- Wrapped native tokens are supported, but only when traded against stablecoins.
- They are not tracked when traded against native tokens or other wrapped natives.
- ✅ WETH ↔ USDC → WETH PnL supported
- ❌ WETH ↔ ETH → not tracked
- ❌ WETH ↔ WBTC → not tracked unless a stablecoin leg exists
Stablecoins
- Wallet PnL is not calculated for stablecoins themselves (e.g. USDC, USDT, DAI).
- However, ERC20, native, and wrapped native tokens that are paired with stablecoins are fully supported.
- ✅ UNI ↔ USDC → UNI PnL supported
- ✅ ETH ↔ USDT → ETH PnL supported
- ❌ USDC ↔ DAI → no wallet PnL (stablecoin-only trade)
Summary
| Asset | PnL tracked? | Conditions |
|---|---|---|
| ERC20 tokens | ✅ Yes | Paired with stable or native/wrapped native |
| Native tokens (ETH, etc.) | ✅ Yes | Only when paired with stablecoins |
| Wrapped native tokens (WETH, etc.) | ✅ Yes | Only when paired with stablecoins |
| Stablecoins | ❌ No | Used for pricing only |
| ERC20 ↔ Stablecoin | ✅ Yes | Fully supported |
| ERC20 ↔ WETH | ✅ Yes | Fully supported |
| ETH ↔ USDC | ✅ Yes | Supported |
| ETH ↔ WETH | ❌ No | Not supported |
Supported chains
Profitability is currently live on:- Ethereum Mainnet
- Polygon Mainnet
- Base Mainnet
Known limitations
- Unrealized gains are not included
- Gas costs are excluded
- Only supported DEX events are tracked
- PnL is per trading pair, not global per token
Summary
Moralis Profitability (PnL) provides:- Realized, on-chain PnL
- Weighted average cost basis
- Near real-time updates
- Token- and wallet-level views
- Deterministic, explainable calculations

