Skip to content
Draft
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
35 changes: 27 additions & 8 deletions schemas/derivatives/SCHEMA.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ OpenBlock Labs standard schema for derivatives protocols (options and perps).

## Version: 1.0.0-alpha

### Pools
### Pools/Markets

Pools in the protocol (one entry for each token).

Expand All @@ -18,10 +18,12 @@ Pools in the protocol (one entry for each token).
| 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 |
| protocol_type | Type of derivatives protocol (Option, Perpetual). | string |
| option_type | (Only for Options) The type of options traded on the protocol (ie, AMERICAN, EUROPEAN). | string |

### LP Snapshot
### LP/Market Maker Snapshot

Liquidity providers snapshot (one entry for each token in a pool).
Liquidity providers (for AMMs) or Market Makers (for order book protocols) snapshots (one entry for each token in a pool/market).

| Property | Description | Type |
|-------------------------|-----------------------------------------------------------|--------|
Expand All @@ -42,8 +44,18 @@ Liquidity providers snapshot (one entry for each token in a pool).
| 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 |

### Pool Snapshot
| role | Role of the participant (LP, MM). | string |
| bid_order_opened_amount | (Only for MMs, both Perps & Options) The amount in tokens of an active order opened by the Market Maker, bid side. | number |
| ask_order_opened_amount | (Only for MMs, both Perps & Options) The amount in tokens of an active order opened by the Market Maker, ask side. | number |
| bid_order_opened_usd | (Only for MMs, both Perps & Options) The amount in USD of an active order opened by the Market Maker, bid side. | number |
| ask_order_opened_usd | (Only for MMs, both Perps & Options) The amount in USD of an active order opened by the Market Maker, ask side. | number |
| bid_order_filled_amount | (Only for MMs, both Perps & Options) The amount in tokens of a successfully executed order by the Market Maker, bid side. | number |
| ask_order_filled_amount | (Only for MMs, both Perps & Options) The amount in tokens of a successfully executed order by the Market Maker, ask side. | number |
| bid_order_filled_usd | (Only for MMs, both Perps & Options) The amount in USD of a successfully executed order by the Market Maker, bid side. | number |
| bid_order_filled_usd | (Only for MMs, both Perps & Options) The amount in USD of a successfully executed order by the Market Maker, ask side. | number |
| average_mid_price | (Only for MMs, both Perps & Options) The daily rolling average mid-price per MM and market. | number |

### Pool/Market Snapshot

Snapshot of the pool's metrics.

Expand All @@ -55,11 +67,13 @@ Snapshot of the pool's metrics.
| 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 |
| fee_rate | The 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 |
| premium_collected_usd | (Only for Options) Total premiums collected in USD by LPs or MMs from writing options contracts. | number |
| liquidity_usd | The liquidity available in the pool/market at snapshot, denominated in USD | number |

### Trades

Expand All @@ -82,8 +96,13 @@ Trade data, 1 entry for each close, open, or update of a trade.
| notional_value_usd | The notional value, in USD. | number |
| maker_pnl_usd | (Only applicable on trade close) The total profit and loss of the trade on the maker's side, in USD. | number |
| taker_pnl_usd | (Only applicable on trade close) 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). | string |
| trade_action_perps | (Only for Perps) The action of trade being recorded in this entry (ie, OPEN, CLOSE, INCREASE, DECREASE, LIQUIDATED). | string |
| trade_action_options | (Only for Options) The action of trade being recorded in this entry (ie, PUT, CALL, INCREASE, DECREASE, EXERCISED, NOT EXERCISED). | string |
| trade_type | The type of the trade being recorded in this entry (ie, LONG, SHORT or PUT, CALL). | string |
| strike_price | (Only for Options) The strike price of the option in USD. | number |
| expiration_timestamp | (Only for Options) The expiration time of the option (UTC). | number |
| premium_usd | (Only for Options) The premium paid by the bidder (daily). | number |
| leverage | The leverage used in the trade. | number |

### Incentive Claim Data

Expand Down
Loading