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

# Trades

> Comprehensive Prediction Market trade data on Polygon.

The `polygon.predictions.trades` table provides comprehensive trade data from prediction market platforms on Polygon. Currently featuring Polymarket data, this schema is designed to seamlessly integrate additional prediction market protocols as they become available.

Use this table to analyze trading patterns, market volumes, participant behavior, and event outcomes across prediction markets on Polygon.

### Table Columns

**Data Precision Notes:**

* `_raw` fields contain unnormalized amounts for maximum precision
* `_str` columns are numeric fields cast to `varchar` to retain precision
* USD amounts reflect value at time of trade

Unique Key: `unique_id`

| Column Name                 | Data Type         | Description                                                                |
| --------------------------- | ----------------- | -------------------------------------------------------------------------- |
| event\_name                 | VARCHAR           | Name of the prediction market event.                                       |
| project                     | VARCHAR           | Name of the project (e.g., Polymarket).                                    |
| protocol                    | VARCHAR           | Protocol name (e.g., polymarket).                                          |
| exchange\_type              | VARCHAR           | Type of exchange (e.g., Polymarket Fixed Product Market Maker, Orderbook). |
| condition\_id               | VARCHAR           | Unique identifier for the event condition.                                 |
| market\_address             | VARCHAR           | Address of the prediction market contract.                                 |
| order\_hash                 | VARCHAR           | Unique hash of the order.                                                  |
| maker                       | VARCHAR           | Address of the maker in the trade.                                         |
| taker                       | VARCHAR           | Address of the taker in the trade.                                         |
| asset\_id                   | VARCHAR           | Identifier for the traded asset.                                           |
| collateral\_amount\_raw     | VARCHAR           | Raw collateral amount (unnormalized).                                      |
| token\_amount\_raw          | VARCHAR           | Raw share amount (unnormalized).                                           |
| price\_str                  | VARCHAR           | Share price as a string.                                                   |
| price                       | FLOAT             | Share price as a float.                                                    |
| maker\_amount\_raw          | VARCHAR           | Raw amount provided by the maker.                                          |
| taker\_amount\_raw          | VARCHAR           | Raw amount provided by the taker.                                          |
| fee\_raw                    | VARCHAR           | Raw fee amount.                                                            |
| collateral\_token\_address  | VARCHAR           | Address of the collateral token.                                           |
| collateral\_token\_name     | VARCHAR           | Name of the collateral token.                                              |
| collateral\_token\_symbol   | VARCHAR           | Symbol of the collateral token.                                            |
| collateral\_token\_decimals | NUMBER            | Decimals of the collateral token.                                          |
| collateral\_amount          | VARCHAR           | Collateral amount (normalized).                                            |
| fee\_amount                 | VARCHAR           | Fee amount (normalized).                                                   |
| usd\_exchange\_rate         | FLOAT             | USD exchange rate of the collateral token at the time of trade.            |
| usd\_collateral\_amount     | FLOAT             | Collateral amount in USD.                                                  |
| usd\_fee\_amount            | FLOAT             | Fee amount in USD.                                                         |
| transaction\_index          | NUMBER            | Index of the transaction in the block.                                     |
| transaction\_hash           | VARCHAR           | Hash of the transaction.                                                   |
| log\_index                  | NUMBER            | Log index of the trade event.                                              |
| block\_timestamp            | TIMESTAMP\_NTZ(9) | Timestamp of the block containing the trade.                               |
| block\_number               | NUMBER            | Block number of the trade.                                                 |
| block\_hash                 | VARCHAR           | Hash of the block containing the trade.                                    |
| unique\_id                  | VARCHAR           | Unique identifier for the trade.                                           |
| \_created\_at               | TIMESTAMP\_NTZ(9) | The timestamp of the creation of the trade.                                |
| \_updated\_at               | TIMESTAMP\_NTZ(9) | The timestamp of the last update of the trade.                             |

***

### Sample Queries

<Tabs>
  <Tab title="Recent Trades">
    Get recent prediction market trades with essential details:

    ```sql theme={null}
    select
      event_name,
      project,
      price,
      usd_collateral_amount,
      maker,
      taker,
      block_timestamp
    from polygon.predictions.trades
    where block_timestamp >= current_timestamp - interval '3 days'
    order by block_timestamp desc
    ```
  </Tab>

  <Tab title="Daily Volume">
    Calculate daily trading volume and trading activity for the past month:

    ```sql theme={null}
    select
      date(block_timestamp) as day,
      count(*) as total_trades,
      sum(usd_collateral_amount) as daily_volume_usd
    from polygon.predictions.trades
    where block_timestamp >= current_timestamp - interval '30 days'
    group by day
    order by day desc
    ```
  </Tab>
</Tabs>

### Protocol Coverage

| Protocol   | Status   | Exchange Types Supported              |
| ---------- | -------- | ------------------------------------- |
| Polymarket | ✅ Active | Fixed Product Market Maker, Orderbook |

*More protocols will be added as they launch or integrate with Polygon.*
