Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Derivatives schema changes #51

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 33 additions & 9 deletions schemas/derivatives/SCHEMA.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,38 @@ Pools in the protocol (one entry for each token).

### Pairs (AMM)

| 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 pair was created on. | number |
| pair_name | The name of the pool (ie, name() in the smart contract). | string |
| pair_index | The index of the token in the smart contract (one row for each pair). | number |
| pair_address | The contract address of the pair. | string |
| pair_symbol | The symbol of the pair. | string |
| vault_address | The address of the vault where each pair are traded in. | string |

### Pairs snapshot (AMM)

Pairs traded in the protocol (one entry for each pair).

| 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 |
| pair_name | The name of the pool (ie, name() in the smart contract). | string |
| pair_index | The index of the token in the smart contract (one row for each pair). | number |
| pair_address | The contract address of the pair. | string |
| pair_symbol | The symbol of the pair. | string |
| pair_liquidity | The liquidity available for trading for the pair (24h rolling average, in tokens). | number |
| pair_liquidity_usd | The liquidity available for trading for the pair (24h rolling average, in USD). | number |
| volume_usd | The volume of each pair opened and closed in the given snapshot (24h rolling average, in USD). | number |
| pair_liquidity | The liquidity available for trading for the pair (at snapshot, in tokens). | number |
| pair_liquidity_usd | The liquidity available for trading for the pair (at snapshot, in USD). | number |
| volume_usd | The volume of each pair opened and closed in the given snapshot (at snapshot, in USD). | number |
| open_interest_longs_usd | The sum of open interest of longs held for each pair, in USD. | number |
| open_interest_shorts_usd | The sum of open interest in shorts held for each pair, in USD. | number |
| liquidation_fees_usd | The total liquidation fees accrued for each pair (24h rolling average, in USD). | number |
| liquidation_fees_usd | The total liquidation fees accrued for each pair (at snapshot, in USD). | number |
| funding_rate | The funding rate for each pair at the time of the snapshot, as a percentage. | number |
| open_fees_usd | The total open fees accrued for each pair (24h rolling average, in USD). | number |
| close_fees_usd | The total close fees accrued for each pair (24h rolling average, in USD). | number |
| open_fees_usd | The total open fees accrued for each pair (at snapshot, in USD). | number |
| close_fees_usd | The total close fees accrued for each pair (at snapshot, in USD). | number |

### LP Snapshot

Expand Down Expand Up @@ -104,6 +116,18 @@ Snapshot of the pool's metrics.
| 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 |

### Vault (AMM)

Vault(s) in the protocol (one entry for each vault).
| 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 |
| vault_address | The smart contract address of the vault. | string |
| token_address | The smart contract address of the token used as collateral (for each token). | string |
| token_index | The index of the token in the smart contract. | number |

Comment on lines +121 to +130
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets include token_symbol here as well

### Vault Snapshot (AMM)

Snapshot of the vault's metrics.
Expand All @@ -121,8 +145,8 @@ Snapshot of the vault's metrics.
| liquidity_available_usd | The total liquidity available in the vault for trading, in USD. | number |
| open_interest_longs_usd | The aggregate value of open long positions backed by the vault’s liquidity at snapshot, in USD. | number |
| open_interest_shorts_usd | The aggregate value of open short positions backed by the vault’s liquidity at snapshot, in USD. | number |
| volume_usd | The volume of trades generated by the vault in the given snapshot (24h rolling average, in USD). | number |
| vault_fees_usd | The portion of fees accrued by the protocol (24h rolling average, in USD). | number |
| volume_usd | The volume of trades generated by the vault in the given snapshot (at snapshot, in USD). | number |
| vault_fees_usd | The portion of fees accrued by the protocol (at snapshot, in USD). | number |

### Trades

Expand Down
Loading