OpenInterestEntry
Documentation for eth_defi.derive.api.OpenInterestEntry Python class.
- class OpenInterestEntry
Bases:
objectA daily on-chain snapshot for a Derive perpetual instrument.
Contains open interest, mark price (perp price), and index price read from on-chain view functions via Multicall3 at daily intervals.
Attributes summary
Instrument name (e.g.
Snapshot timestamp (naive UTC, aligned to midnight)
Timestamp in milliseconds since epoch
Open interest in the instrument's base currency (e.g.
Mark/perp price in USD (18 decimals on-chain).
Spot/index price in USD (18 decimals on-chain).
Methods summary
__init__(instrument, timestamp, ...[, ...])- instrument: str
Instrument name (e.g.
"ETH-PERP")
- timestamp: datetime.datetime
Snapshot timestamp (naive UTC, aligned to midnight)
- timestamp_ms: int
Timestamp in milliseconds since epoch
- open_interest: decimal.Decimal
Open interest in the instrument’s base currency (e.g. ETH for ETH-PERP). From
openInterest(uint256).
- perp_price: decimal.Decimal | None
Mark/perp price in USD (18 decimals on-chain). From
getPerpPrice()— the first return value (price).Noneif the call reverted (contract not yet deployed).
- index_price: decimal.Decimal | None
Spot/index price in USD (18 decimals on-chain). From
getIndexPrice()— the first return value (price).Noneif the call reverted (contract not yet deployed).
- __init__(instrument, timestamp, timestamp_ms, open_interest, perp_price=None, index_price=None)
- Parameters
instrument (str) –
timestamp (datetime.datetime) –
timestamp_ms (int) –
open_interest (decimal.Decimal) –
perp_price (decimal.Decimal | None) –
index_price (decimal.Decimal | None) –
- Return type
None