> ## Documentation Index
> Fetch the complete documentation index at: https://docs.allium.so/llms.txt
> Use this file to discover all available pages before exploring further.

# Spl Token Pnl

### Table Details

| Property | Value |
| - | - |
| Table Name | `solana.assets.spl_token_pnl` |
| Table Status | Production-Ready |
| Unique Key | `block_timestamp`, `txn_id`, `unique_id` |

### Table Columns

| Column Name | Data Type | Description |
| - | - | - |
| token\_type | VARCHAR(16777216) | Token standard for the asset. One of: `erc20` (fungible), `erc721` (non-fungible), `erc1155` (semi-fungible), or the native currency symbol (e.g. `eth`, `matic`, `bnb`). |
| address | VARCHAR(16777216) | Wallet or contract address of the account. On EVM chains, a 42-character hex string (0x-prefixed). On other chains, the native address format applies. |
| token\_account | VARCHAR(16777216) | SPL token account address that holds the token balance. On Solana, token balances are tracked in separate token accounts associated with a wallet (owner) address and a mint. |
| mint | VARCHAR(16777216) | Base58-encoded mint address of the SPL token. Analogous to `token_address` on EVM chains. Each mint uniquely identifies a fungible or non-fungible token on Solana. |
| token\_name | VARCHAR(16777216) | Full name of the token (e.g. "USD Coin", "Wrapped Ether"). |
| token\_symbol | VARCHAR(16777216) | Ticker symbol of the token (e.g. "USDC", "WETH"). |
| prev\_balance | FLOAT | Token balance for this address before this transfer event. |
| balance | FLOAT | Sum of end-of-day token balances for this address\_type. |
| balance\_change | FLOAT | Change in token balance from this transfer. Positive for inflows, negative for outflows. |
| usd\_exchange\_rate | FLOAT | USD price per unit of the token at the time of the event, used to compute `usd_amount`. Sourced from Allium's hourly price feed. |
| usd\_balance | FLOAT | USD value of the token balance, computed using the exchange rate at the time of the balance snapshot. |
| usd\_balance\_change | FLOAT | USD value of the balance change at the token price at time of event. |
| usd\_exchange\_rate\_latest | FLOAT | Most recent available USD price per token unit, used to compute current unrealized PnL. |
| usd\_balance\_latest | FLOAT | Current USD value of the balance at the latest available price (balance × usd\_exchange\_rate\_latest). |
| transaction\_type | VARCHAR(16777216) | Ethereum transaction envelope type. 0 = Legacy, 1 = Access List (EIP-2930), 2 = EIP-1559 dynamic fee. |
| tokens\_purchased | FLOAT | Number of tokens acquired in this transfer event (positive inflow quantity). |
| tokens\_sold | FLOAT | Array of token addresses that were sold in the trade. |
| average\_cost | FLOAT | Volume-weighted average purchase price (VWAP) of the cost basis for current holdings. Uses purchase group VWAP when available. |
| cumulative\_costs | FLOAT | Running total of USD spent acquiring this token by this address up to and including this event. |
| cumulative\_quantities | FLOAT | Running total of token quantity acquired up to and including this event. |
| cumulative\_cost\_from\_purchases | FLOAT | Cumulative USD cost from buy (inflow) events only. Excludes sell proceeds. |
| cumulative\_quantity\_from\_purchases | FLOAT | Cumulative token quantity from buy (inflow) events only. |
| realized\_pnl | FLOAT | Total realized profit or loss up to this event: (sell\_price − average\_cost) × quantity\_sold, summed across all sells. |
| realized\_pnl\_this\_block | FLOAT | Realized PnL from sell events in the current block only. |
| unrealized\_pnl | FLOAT | The unrealized PnL of the position. |
| unrealized\_pnl\_latest | FLOAT | Unrealized profit or loss at the latest price: balance × (usd\_exchange\_rate\_latest − average\_cost). Zero when balance is zero. |
| group\_vwap | FLOAT | VWAP of the current purchase group — average cost per token for the most recent cluster of buys before any intervening sells. |
| group\_id | NUMBER(38,0) | Identifier for the purchase group used to compute cost basis. Resets when balance falls to zero after a sell. |
| block\_timestamp | TIMESTAMP\_NTZ(9) | Timestamp (UTC) of the block that contains this record. |
| block\_slot | NUMBER(38,0) | Solana slot number in which this transaction was confirmed. Slots are the fundamental unit of time on Solana (analogous to block numbers on EVM chains). Not every slot produces a block. |
| block\_hash | VARCHAR(16777216) | Cryptographic hash of the block header that contains this record. Uniquely identifies a block. |
| txn\_index | NUMBER(38,0) | Zero-based position of this transaction within its slot. |
| txn\_id | VARCHAR(16777216) | Base58-encoded transaction signature on Solana. Analogous to `transaction_hash` on EVM chains. Uniquely identifies a transaction. |
| unique\_id | VARCHAR(16777216) | Allium's deterministic unique identifier for this row. Generated from the fields that uniquely identify the record (e.g. transaction hash + log index). Stable across full refreshes. |
| \_created\_at | TIMESTAMP\_NTZ(9) | Timestamp of when the entry was created in the database. |
| \_updated\_at | TIMESTAMP\_NTZ(9) | Timestamp of when the entry was last updated in the database. |
