fetch_instrument_details

Documentation for eth_defi.derive.api.fetch_instrument_details function.

fetch_instrument_details(session, base_url='https://api.lyra.finance', timeout=30.0)

Fetch instrument details including on-chain contract addresses.

Returns a mapping of instrument name to instrument metadata dict, including base_asset_address (the on-chain perp contract), scheduled_activation (Unix timestamp of listing), and other fields.

Example:

from eth_defi.derive.api import fetch_instrument_details
from eth_defi.derive.session import create_derive_session

session = create_derive_session()
details = fetch_instrument_details(session)
eth = details["ETH-PERP"]
print(eth["base_asset_address"])  # 0xAf65...
print(eth["scheduled_activation"])  # 1701820800 (Unix timestamp)
Parameters
  • session (requests.sessions.Session) – HTTP session from create_derive_session().

  • base_url (str) – Derive API base URL.

  • timeout (float) – HTTP request timeout in seconds.

Returns

Dict mapping instrument name to metadata dict.

Raises

ValueError – If the API returns an error response.

Return type

dict[str, dict]