Blockchain Coverage

We support pnl data for the following blockchains:
BlockchainBalances Model
EVM-Compatible BlockchainsThe crosschain.assets.fungible_pnl_evm model offers a historical record of fungible asset pnls at block-level granularity. Chain-specific tables are available at <chain>.assets.fungible_pnl.
SolanaThe solana.assets.pnl model offers a historical record of SOL and spl tokens (no NFTs) pnls at transaction-level granularity. Refer to here for more details.

PNL calculation

The PNL (Profit and Loss) calculation uses the average-cost methodology to determine realized and unrealized gains/losses for fungible assets. This approach provides a fair and consistent way to calculate performance across multiple transactions and time periods.

Average-Cost Methodology

The average-cost method calculates PNL by maintaining a running average of the cost basis for each asset position. The methodology tracks cumulative costs and quantities to compute accurate profit and loss metrics.

Key Fields

The PNL model provides several important fields for analysis:
  • average_cost: The current weighted average cost per token unit, calculated as cumulative_costs / cumulative_quantities
  • cumulative_costs: The total USD cost basis remaining after accounting for sales (reduces proportionally when tokens are sold)
  • cumulative_quantities: The remaining token quantity after accounting for sales
  • realized_pnl: The cumulative realized profit/loss from all sales transactions for this token
  • unrealized_pnl: The unrealized profit/loss based on the token price at the time of the transaction
  • unrealized_pnl_latest: The current unrealized profit/loss using the latest available token price

Core Principles

  1. Cost Basis Averaging: When acquiring additional tokens, the new average cost becomes the weighted average of previous holdings and the new acquisition.
  2. Proportional Cost Reduction: When disposing of tokens, both cumulative_costs and quantities are reduced proportionally, keeping the average_cost unchanged.
  3. Transaction-Level Tracking: The average cost basis and PNL metrics are updated with every transaction that changes the token balance.

Table Columns

Unique Key: chain, address, token_address, unique_id
Column NameDescription
chainThe EVM-compatible blockchain where the assets are held.
token_typeThe type of token (e.g., ‘native’, ‘erc20’).
addressThe wallet address holding the token.
token_addressThe contract address of the token. Native tokens are represented with zero address.
token_nameThe name of the token.
token_symbolThe symbol of the token.
balanceThe current token balance after this transaction.
prev_balanceThe token balance before this transaction.
balance_changeThe change in token balance from this transaction (balance - prev_balance). Can be negative.
usd_exchange_rateThe USD exchange rate for the token at the time of the transaction.
usd_balanceThe current token balance converted to USD at transaction time.
usd_balance_changeThe change in USD balance from this transaction. Can be negative.
usd_exchange_rate_latestThe latest available USD exchange rate for the token.
usd_balance_latestThe current token balance converted to USD using the latest exchange rate.
transaction_typeThe type of transaction: ‘first_purchase’, ‘purchase’, ‘sale’, or ‘no_change’.
tokens_purchasedThe number of tokens purchased in this transaction (0 for sales).
tokens_soldThe number of tokens sold in this transaction (0 for purchases).
average_costThe current weighted average cost per token unit after this transaction.
cumulative_costsThe total USD cost basis remaining after accounting for proportional reductions from sales.
cumulative_quantitiesThe total token quantity remaining after accounting for sales.
realized_pnlThe cumulative realized profit/loss from all sales transactions for this token up to this point.
realized_pnl_this_txThe realized profit/loss from this specific transaction (null for purchases).
unrealized_pnlThe unrealized profit/loss based on the token price at the time of this transaction.
unrealized_pnl_latestThe unrealized profit/loss based on the latest available token price.
block_timestampThe timestamp of the block containing this transaction.
block_numberThe block number containing this transaction.
block_hashThe hash of the block containing this transaction.
unique_idA unique identifier for this PNL record.