# Data Schemas & Execution Formats

{% tabs %}
{% tab title="CEX" %}

**Historical Trade Data Schema**\
Historical trade data contains information about executed trades over a given period. Each trade is uniquely identified and includes details about execution, pricing, and fees.<br>

| <p>Field<br></p>        | <p>Type<br></p>      | <p>Description<br></p>                                                     |
| ----------------------- | -------------------- | -------------------------------------------------------------------------- |
| <p>id<br></p>           | <p>INT<br></p>       | <p>A unique identifier assigned to each trade.<br></p>                     |
| <p>order<br></p>        | <p>STRING<br></p>    | <p>The order ID associated with the trade, if available.<br></p>           |
| <p>info<br></p>         | <p>STRING<br></p>    | <p>Additional details about the trade, stored in raw format.<br></p>       |
| <p>timestamp<br></p>    | <p>FLOAT<br></p>     | <p>Unix epoch timestamp indicating when the trade occurred.<br></p>        |
| <p>datetime<br></p>     | <p>TIMESTAMP<br></p> | <p>The execution date and time of the trade in UTC.<br></p>                |
| <p>symbol<br></p>       | <p>STRING<br></p>    | <p>The trading pair (e.g., BTC/USD, ETH/USD).<br></p>                      |
| <p>type<br></p>         | <p>STRING<br></p>    | <p>The order type (e.g., market, limit, stop-limit).<br></p>               |
| <p>side<br></p>         | <p>STRING<br></p>    | <p>The trade direction, either "buy" or "sell."<br></p>                    |
| <p>takerOrMaker<br></p> | <p>STRING<br></p>    | <p>Specifies whether the trade was executed as a taker or a maker.<br></p> |
| <p>price<br></p>        | <p>FLOAT<br></p>     | <p>The price at which the trade was executed.<br></p>                      |
| <p>amount<br></p>       | <p>FLOAT<br></p>     | <p>The quantity of the asset traded.<br></p>                               |
| <p>cost<br></p>         | <p>FLOAT<br></p>     | <p>The total cost of the trade (price \* amount).<br></p>                  |
| <p>fee<br></p>          | <p>STRING<br></p>    | <p>The trade fee details, including cost and currency.<br></p>             |
| <p>fees<br></p>         | <p>STRING<br></p>    | <p>Any additional fee details if applicable.<br></p>                       |

\
**Batch Trade Data Schema**\
Batch trade data follows the same structure as historical trade data but is collected in batches at specific intervals instead of continuously.<br>

| <p>Field<br></p>        | <p>Type<br></p>      | <p>Description<br></p>                                                     |
| ----------------------- | -------------------- | -------------------------------------------------------------------------- |
| <p>id<br></p>           | <p>INT<br></p>       | <p>A unique identifier assigned to each trade.<br></p>                     |
| <p>order<br></p>        | <p>STRING<br></p>    | <p>The order ID associated with the trade, if available.<br></p>           |
| <p>info<br></p>         | <p>STRING<br></p>    | <p>Additional details about the trade, stored in raw format.<br></p>       |
| <p>timestamp<br></p>    | <p>FLOAT<br></p>     | <p>Unix epoch timestamp indicating when the trade occurred.<br></p>        |
| <p>datetime<br></p>     | <p>TIMESTAMP<br></p> | <p>The execution date and time of the trade in UTC.<br></p>                |
| <p>symbol<br></p>       | <p>STRING<br></p>    | <p>The trading pair (e.g., BTC/USD, ETH/USD).<br></p>                      |
| <p>type<br></p>         | <p>STRING<br></p>    | <p>The order type (e.g., market, limit, stop-limit).<br></p>               |
| <p>side<br></p>         | <p>STRING<br></p>    | <p>The trade direction, either "buy" or "sell."<br></p>                    |
| <p>takerOrMaker<br></p> | <p>STRING<br></p>    | <p>Specifies whether the trade was executed as a taker or a maker.<br></p> |
| <p>price<br></p>        | <p>FLOAT<br></p>     | <p>The price at which the trade was executed.<br></p>                      |
| <p>amount<br></p>       | <p>FLOAT<br></p>     | <p>The quantity of the asset traded.<br></p>                               |
| <p>cost<br></p>         | <p>FLOAT<br></p>     | <p>The total cost of the trade (price \* amount).<br></p>                  |
| <p>fee<br></p>          | <p>STRING<br></p>    | <p>The trade fee details, including cost and currency.<br></p>             |
| <p>fees<br></p>         | <p>STRING<br></p>    | <p>Any additional fee details if applicable.<br></p>                       |

\
\
**Market Data Schema**\
Market data captures real-time information about trade orders, bids, asks, and overall market movements.<br>

| <p>Field<br></p>         | <p>Type<br></p>   | <p>Description<br></p>                                                  |
| ------------------------ | ----------------- | ----------------------------------------------------------------------- |
| <p>timestamp\_ny<br></p> | <p>STRING<br></p> | <p>Timestamp of the order event in New York time.<br></p>               |
| <p>side<br></p>          | <p>STRING<br></p> | <p>The order side: "Bid" (buy) or "Ask" (sell).<br></p>                 |
| <p>price<br></p>         | <p>FLOAT<br></p>  | <p>The current market price of the asset.<br></p>                       |
| <p>size<br></p>          | <p>INT<br></p>    | <p>The number of units in the order.<br></p>                            |
| <p>symbol<br></p>        | <p>STRING<br></p> | <p>The trading pair (e.g., BTC/USD).<br></p>                            |
| <p>action<br></p>        | <p>STRING<br></p> | <p>The type of order action (e.g., add, modify, cancel).<br></p>        |
| <p>order\_type<br></p>   | <p>STRING<br></p> | <p>Defines the type of order (e.g., market, limit, stop-limit).<br></p> |
| {% endtab %}             |                   |                                                                         |

{% tab title="DEX" %}

### **Data Schema**

#### **DEX Transaction Data**

**Description**

DEX transaction data captures all relevant on-chain swaps, trades, and liquidity interactions on decentralized exchanges. Each transaction record provides details about executed swaps, liquidity additions, removals, and associated metadata.

**Fields (`dex_transaction_data`)**

| **Field**      | **Type** | **Description**                             |
| -------------- | -------- | ------------------------------------------- |
| `tx_hash`      | string   | Unique transaction identifier.              |
| `block_number` | int64    | Block where the transaction was confirmed.  |
| `timestamp`    | int64    | Unix timestamp for transaction execution.   |
| `address`      | string   | DEX contract or liquidity pool address.     |
| `from`         | string   | Sender wallet address.                      |
| `to`           | string   | Recipient contract address.                 |
| `token0`       | object   | First token in the swap (symbol, address).  |
| `token1`       | object   | Second token in the swap (symbol, address). |
| `amount0In`    | float64  | Amount of token0 input.                     |
| `amount1In`    | float64  | Amount of token1 input.                     |
| `amount0Out`   | float64  | Amount of token0 output.                    |
| `amount1Out`   | float64  | Amount of token1 output.                    |
| `pool`         | string   | Liquidity pool identifier.                  |
| `fee`          | float64  | Transaction fee.                            |
| `price_impact` | float64  | Calculated price impact percentage.         |
| `method_id`    | string   | Function signature for the transaction.     |
| `success`      | boolean  | Whether the transaction was successful.     |

#### **DEX Market Data**

**Description**

DEX market data provides real-time and historical insights into decentralized liquidity pools, token reserves, exchange rates, and trading activity.

**Fields (`dex_market_data`)**

| **Field**        | **Type** | **Description**                                 |
| ---------------- | -------- | ----------------------------------------------- |
| `timestamp`      | string   | Timestamp of the market snapshot.               |
| `pool_address`   | string   | Address of the liquidity pool.                  |
| `token0_reserve` | float64  | Reserve amount for first token.                 |
| `token1_reserve` | float64  | Reserve amount for second token.                |
| `liquidity`      | float64  | Total pool liquidity value.                     |
| `fee_tier`       | int      | Fee percentage tier (e.g., 0.3%, 1%).           |
| `price`          | float64  | Current exchange rate between tokens.           |
| `volume_24h`     | float64  | Trading volume in the last 24 hours.            |
| `tvl`            | float64  | Total value locked in the pool.                 |
| `apr`            | float64  | Annual percentage rate for liquidity providers. |
| `active_tick`    | int      | Current tick index (for V3 pools).              |
| `tick_spacing`   | int      | Distance between ticks.                         |
| {% endtab %}     |          |                                                 |
| {% endtabs %}    |          |                                                 |

##


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://blockhouse-app.gitbook.io/blockhouse/asset-classes/crypto/data-schemas-and-execution-formats.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
