> ## 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.

# Trade

> Normalized trade data representing the economic intent of a user.

| Field                | Type                                                          | Description                                        |
| -------------------- | ------------------------------------------------------------- | -------------------------------------------------- |
| `id`                 | *Integer*                                                     | Unique identifier for the trade                    |
| `chain_id`           | *Integer*                                                     | Chain the trade was executed on                    |
| `protocol`           | *[Protocol](/documentation/evm/dex/overview#data-sources)*    | DEX protocol that executed the trade.              |
| `swap_type`          | *[Swap Type](/documentation/evm/dex/datasets/swap#swap-type)* | Type of underlying swap pair based on token roles. |
| `wallet_address`     | *String \[address]*                                           | Wallet address that executed the trade             |
| `token_address`      | *String \[address]*                                           | Traded token address                               |
| `quote_address`      | *String \[address]*                                           | Quote token address                                |
| `position_address`   | *String \[hash]*                                              | Wallet-token position identifier                   |
| `direction`          | *[Direction](#direction)*                                     | Direction of the trade.                            |
| `position_state`     | *[Position State](#position-state)*                           | Position state of the trade.                       |
| `token_amount`       | *Number*                                                      | Amount of traded token                             |
| `quote_amount`       | *Number*                                                      | Amount of quote tokens                             |
| `native_amount`      | *Number*                                                      | Value of the trade in the chain's native asset     |
| `usd_amount`         | *Number \[USD]*                                               | Value of the trade                                 |
| `pre_token_balance`  | *Number*                                                      | Traded token balance before the trade              |
| `post_token_balance` | *Number*                                                      | Traded token balance after the trade               |
| `token_price`        | *Number \[USD]*                                               | Price of traded token at trade time                |
| `quote_price`        | *Number \[USD]*                                               | Price of quote token at trade time                 |
| `token_mcap`         | *Number \[USD]*                                               | Market cap of the traded token at trade time       |
| `block_number`       | *Integer*                                                     | Block number                                       |
| `block_time`         | *String \[date-time]*                                         | Timestamp of the block                             |
| `tx_hash`            | *String \[hash]*                                              | Transaction hash                                   |

The `position_address` is not a deployed contract. It is the keccak-256 hash of the wallet and token addresses, used as a stable identifier for a wallet's position in a token.

## Direction

Indicates whether the trade increased or decreased the trader's exposure to the token.

*Enum(String)*

| Value  | Description            |
| ------ | ---------------------- |
| `buy`  | Trader bought a token. |
| `sell` | Trader sold a token.   |

## Position State

Describes how the trade affected the lifecycle of the trader's position in the token.

*Enum(String)*

| Value     | Description                                                                                           |
| --------- | ----------------------------------------------------------------------------------------------------- |
| `open`    | Trader opened a position.                                                                             |
| `close`   | Trader closed a position.                                                                             |
| `trade`   | Trader executed a trade against a position.                                                           |
| `unknown` | Position state could not be determined, because the token balances around the trade were unavailable. |
