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

# Swap

> Raw swap data capturing every token exchange on liquidity venues.

| Field                    | Type                                                       | Description                                   |
| ------------------------ | ---------------------------------------------------------- | --------------------------------------------- |
| `id`                     | *Integer*                                                  | Unique identifier for the swap                |
| `chain_id`               | *Integer*                                                  | Chain the swap was executed on                |
| `swap_type`              | *[Swap Type](#swap-type)*                                  | Type of swap pair based on token roles.       |
| `protocol`               | *[Protocol](/documentation/evm/dex/overview#data-sources)* | DEX protocol that executed the swap.          |
| `wallet_address`         | *String \[address]*                                        | Wallet address that initiated the swap        |
| `pool_address`           | *String \[address]*                                        | Pool address that executed the swap           |
| `token_address_in`       | *String \[address]*                                        | Token address being swapped from              |
| `token_address_out`      | *String \[address]*                                        | Token address being swapped to                |
| `token_amount_in`        | *Number*                                                   | Amount of input token swapped                 |
| `token_amount_out`       | *Number*                                                   | Amount of output token received               |
| `token_price_in`         | *Number \[USD]*                                            | Price of input token at swap time             |
| `token_price_out`        | *Number \[USD]*                                            | Price of output token at swap time            |
| `pre_token_balance_in`   | *Number*                                                   | Wallet's input token balance before the swap  |
| `pre_token_balance_out`  | *Number*                                                   | Wallet's output token balance before the swap |
| `post_token_balance_in`  | *Number*                                                   | Wallet's input token balance after the swap   |
| `post_token_balance_out` | *Number*                                                   | Wallet's output token balance after the swap  |
| `usd_amount_in`          | *Number \[USD]*                                            | Value of input tokens                         |
| `usd_amount_out`         | *Number \[USD]*                                            | Value of output tokens                        |
| `block_number`           | *Integer*                                                  | Block number                                  |
| `block_time`             | *String \[date-time]*                                      | Timestamp of the block                        |
| `tx_hash`                | *String \[hash]*                                           | Transaction hash                              |

The price, balance and USD amount fields are nullable. They are omitted when the pool's tokens have no resolvable price on the chain, or when the wallet's balances around the swap could not be determined.

## Swap Type

Classifies the swap by the roles of the two tokens exchanged. A *quote* is a reference asset — the chain's native asset, its wrapped form, or a major stablecoin; a *token* is any other asset. Which addresses count as quotes is chain-specific.

*Enum(String)*

| Value         | Description                      |
| ------------- | -------------------------------- |
| `quote_token` | Quote (sell) to token (buy) swap |
| `token_quote` | Token (sell) to quote (buy) swap |
| `token_token` | Token (sell) to token (buy) swap |
| `quote_quote` | Quote (sell) to quote (buy) swap |
