# Derivative

Key Tables:

* **Pools:** Details of liquidity pools, including token addresses, pool creation data, and associated tokens.
* **LP Snapshot:** Liquidity provider snapshots, tracking deposits, liquidated amounts, and fees accrued for each token in a pool.
* **Pool Snapshot:** Snapshot of individuals pools, including funding rates, fee rates, and open interest for long and short positions.
* **Trades:** Records of user trades, including open/close actions, trade amounts, notional values, and profit/loss (P\&L) data for both makers and takers.

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

| Property                | Description                                                                      | Type   |
| ----------------------- | -------------------------------------------------------------------------------- | ------ |
| chain\_id               | Standard chain id.                                                               | number |
| timestamp               | The timestamp of the block the pool was created on.                              | number |
| creation\_block\_number | The block number this pool was created on.                                       | number |
| pool\_address           | The contract address of the pool.                                                | string |
| pool\_name              | The name of the pool (ie, name()) in the smart contract).                        | string |
| token\_index            | The index of the token in the smart contract (one row for each token in a pool). | number |
| token\_address          | The contract address of the token.                                               | string |
| token\_symbol           | The symbol of the token.                                                         | string |
| {% endtab %}            |                                                                                  |        |

{% tab title="LP Snapshot" %}

| Property                | Description                                                                                                                | Type   |
| ----------------------- | -------------------------------------------------------------------------------------------------------------------------- | ------ |
| timestamp               | The timestamp of the snapshot.                                                                                             | number |
| block\_date             | The timestamp truncated (ie, YYYY-MM-DD format for daily snapshots and YYYY-MM-DD HH:00:00 for hourly snapshots).          | date   |
| chain\_id               | Standard chain id.                                                                                                         | number |
| pool\_address           | The address of the pool.                                                                                                   | string |
| lp\_address             | The address of the liquidity provider.                                                                                     | string |
| token\_index            | The index of the token in the smart contract.                                                                              | number |
| token\_address          | The address of the token provided as liquidity.                                                                            | string |
| token\_symbol           | The symbol of the token.                                                                                                   | string |
| deposit\_amount         | (Optional, for Order Books) The amount deposited into the pool, decimal normalized.                                        | number |
| deposit\_amount\_usd    | (Optional, for Order Books) The amount deposited, in USD.                                                                  | number |
| amount\_useful          | (Optional, for LPs) The amount of tokens supplied that are liquid and usable by users of the protocol, decimal normalized. | number |
| amount\_useful\_usd     | (Optional, for LPs) The amount of liquid tokens supplied in USD.                                                           | number |
| liquidated\_amount      | The amount of tokens liquidated from the LP, decimal normalized.                                                           | number |
| liquidated\_amount\_usd | The amount liquidated, in USD.                                                                                             | number |
| total\_fees\_usd        | (Optional) All fees generated by the LP in the given snapshot in USD.                                                      | number |
| user\_fees\_usd         | (Optional) The portion of fees accrued to users of the protocol, in USD.                                                   | number |
| protocol\_fees\_usd     | (Optional) The portion of fees accrued to the protocol, in USD.                                                            | number |
| {% endtab %}            |                                                                                                                            |        |

{% tab title="Pool Snapshot" %}

| Property                    | Description                                                                                                       | Type   |
| --------------------------- | ----------------------------------------------------------------------------------------------------------------- | ------ |
| timestamp                   | The timestamp of the snapshot.                                                                                    | number |
| block\_date                 | The timestamp truncated (ie, YYYY-MM-DD format for daily snapshots and YYYY-MM-DD HH:00:00 for hourly snapshots). | date   |
| chain\_id                   | Standard chain id.                                                                                                | number |
| pool\_address               | The smart contract address of the pool.                                                                           | string |
| token\_index                | The index of the token in the smart contract (one row for each token in a pool).                                  | number |
| funding\_rate               | The funding rate in this pool at the time of the snapshot, as a percentage.                                       | number |
| fee\_rate                   | he pool's fee rate, as a percentage.                                                                              | number |
| total\_value\_locked\_usd   | The total value locked in USD.                                                                                    | number |
| volume\_usd                 | The volume of positions opened and closed in the given snapshot in USD.                                           | number |
| open\_interest\_longs\_usd  | The sum of open interest of longs held within this pool in USD.                                                   | number |
| open\_interest\_shorts\_usd | The sum of open interest in shorts held within this pool in USD.                                                  | number |
| {% endtab %}                |                                                                                                                   |        |

{% tab title="Trades" %}

| Property             | Description                                                                                         | Type    |
| -------------------- | --------------------------------------------------------------------------------------------------- | ------- |
| timestamp            | The timestamp of the trade.                                                                         | number  |
| chain\_id            | Standard chain id.                                                                                  | number  |
| transaction\_hash    | The hash of the transaction this trade was performed in.                                            | string  |
| log\_index           | Event log index.                                                                                    | number  |
| block\_number        | The block number of the trade.                                                                      | number  |
| pool\_address        | The address of the pool this token was traded in.                                                   | string  |
| maker\_address       | The address of the maker.                                                                           | string  |
| taker\_address       | The address of the taker.                                                                           | string  |
| token\_address       | The address of the token.                                                                           | string  |
| amount               | The value that a trader is putting to open a long or short, decimal normalized.                     | number  |
| amount\_usd          | The trade amount in USD.                                                                            | number  |
| notional\_value      | The value of the leveraged amount of the trade, decimal normalized.                                 | number  |
| notional\_value\_usd | The notional value, in USD.                                                                         | number  |
| maker\_pnl\_usd      | The total profit and loss of the trade on the maker's side, in USD.                                 | number  |
| taker\_pnl\_usd      | The total profit and loss of the trade on the taker's side, in USD.                                 | number  |
| trade\_action        | The action of trade being recorded in this entry (ie, OPEN, CLOSE, INCREASE, DECREASE, LIQUIDATED). | string  |
| trade\_type          | The type of the trade being recorded in this entry (ie, LONG, SHORT).                               | vstring |
| {% endtab %}         |                                                                                                     |         |
| {% endtabs %}        |                                                                                                     |         |
