fetch_perp_snapshots_multicall
Documentation for eth_defi.derive.api.fetch_perp_snapshots_multicall function.
- fetch_perp_snapshots_multicall(w3, contract_addresses, block_number, sub_id=0)
Fetch open interest, perp price, and index price for multiple instruments in one RPC call.
Uses Multicall3
aggregate3to batch three view function calls per instrument:openInterest(uint256 subId)— OI in base currencygetPerpPrice()— mark/perp price in USDgetIndexPrice()— spot/index price in USD
For N instruments this sends 3×N subcalls in a single RPC round-trip. Each call uses
allowFailure=Trueso a single contract reverting (e.g. not yet deployed at that block) does not fail the whole batch.- Parameters
- Returns
List of
PerpSnapshotMulticallResultin the same order ascontract_addresses.- Raises
Exception – Transient RPC errors propagate to the caller.
- Return type