OpenInterestEntry

Documentation for eth_defi.derive.api.OpenInterestEntry Python class.

class OpenInterestEntry

Bases: object

A 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

Instrument name (e.g.

timestamp

Snapshot timestamp (naive UTC, aligned to midnight)

timestamp_ms

Timestamp in milliseconds since epoch

open_interest

Open interest in the instrument's base currency (e.g.

perp_price

Mark/perp price in USD (18 decimals on-chain).

index_price

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). None if 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). None if the call reverted (contract not yet deployed).

__init__(instrument, timestamp, timestamp_ms, open_interest, perp_price=None, index_price=None)
Parameters
Return type

None