fetch_account_collaterals

Documentation for eth_defi.derive.account.fetch_account_collaterals function.

fetch_account_collaterals(client, subaccount_id=None)

Fetch collateral balances for a Derive subaccount.

Requires authenticated client with session key (minimum scope: read_only).

Example:

from eth_defi.derive.authentication import DeriveApiClient
from eth_defi.derive.account import fetch_account_collaterals

client = DeriveApiClient(...)
client.session_key_private = "0x..."

collaterals = fetch_account_collaterals(client)
for col in collaterals:
    print(f"{col.token}: {col.available} available, {col.locked} locked")
Parameters
  • client (DeriveApiClient) – Authenticated Derive API client with session key

  • subaccount_id (int | None) – Subaccount ID (defaults to client.subaccount_id)

Returns

List of collateral balances

Raises

ValueError – If authentication fails or account not found

Return type

list[eth_defi.derive.account.CollateralBalance]