derive.v3_vaults
Documentation for eth_defi.derive.v3_vaults Python module.
Public Derive v3 native vault data.
Derive v3 vaults are managed exchange subaccounts, not ERC-4626 contracts. The unauthenticated HTTP API exposes discovery, live NAV and sampled performance history. See Derive’s vault documentation and the public API.
Classes
One public native vault record. |
|
Synchronous client for the public Derive v3 vault endpoints. |
|
One sampled vault performance point. |
- class DeriveV3Vault
Bases:
objectOne public native vault record.
The vault subaccount ID is unique only within the chosen Derive v3 deployment. Monetary values are decimal strings in the source API.
- curator: eth_typing.evm.HexAddress
Curator wallet address.
- deposit_spot_asset: eth_typing.evm.HexAddress
Derive spot asset address accepted for deposits.
Live mark-to-market NAV in USD, if priceable.
Live USD price per share, assuming accrued fees were settled now.
Outstanding native shares.
- classmethod from_api(value)
Parse a public vault record without rounding decimal amounts.
- Parameters
value (dict) –
Vaultobject frompublic/get_vaults.- Returns
Parsed vault metadata.
- Return type
- __init__(subaccount_id, name, description, curator, deposit_spot_asset, nav_usd, share_price_usd, total_shares, management_fee_bps, performance_fee_bps, cooldown_sec, whitelist_only, closed, deposit_symbol=None, deposit_decimals=None, raw_metadata=None)
- Parameters
subaccount_id (int) –
name (str) –
description (str) –
curator (eth_typing.evm.HexAddress) –
deposit_spot_asset (eth_typing.evm.HexAddress) –
nav_usd (Optional[decimal.Decimal]) –
share_price_usd (Optional[decimal.Decimal]) –
total_shares (decimal.Decimal) –
management_fee_bps (int) –
performance_fee_bps (int) –
cooldown_sec (int) –
whitelist_only (bool) –
closed (bool) –
- Return type
None
- class DeriveV3VaultPrice
Bases:
objectOne sampled vault performance point.
share_priceis the historical mark-to-market share price reported by Derive. It can differ from the live simulated post-fee settlement price.See public/get_vault_performance_history.
- timestamp: datetime.datetime
Naive UTC observation time.
Historical USD price per native share.
Vault NAV in USD, or
Nonewhen the API cannot value the vault.
Outstanding native shares.
- classmethod from_api(subaccount_id, value)
Parse a performance point and normalise its Unix timestamp.
Derive’s OpenAPI text describes milliseconds. Testnet responses on 24 September 2026 used seconds, so the parser accepts both units.
- Parameters
- Returns
Parsed performance observation.
- Return type
- __init__(subaccount_id, timestamp, share_price, nav_usd, total_shares)
- Parameters
subaccount_id (int) –
timestamp (datetime.datetime) –
share_price (decimal.Decimal) –
nav_usd (Optional[decimal.Decimal]) –
total_shares (decimal.Decimal) –
- Return type
None
- class DeriveV3VaultClient
Bases:
objectSynchronous client for the public Derive v3 vault endpoints.
Defaults to testnet. Pass
network="mainnet"for production data; subaccount IDs are scoped to a deployment. No credentials are needed.The default session retries HTTP 429 and selected server errors up to three times. A supplied session keeps its own retry configuration.
close()closes either session, including one supplied by the caller.- Parameters
network –
testnetormainnet.session – Optional configured HTTP session.
timeout – Per-request timeout in seconds.
api_error_retry_attempts – Maximum attempts for retryable errors returned inside a successful Derive JSON response.
api_error_retry_backoff – Initial exponential backoff in seconds between retryable API errors.
- __init__(network='testnet', session=None, timeout=30.0, api_error_retry_attempts=3, api_error_retry_backoff=0.5)
- fetch_vaults(page_size=100)
Fetch each page of the deployment’s public vault listing.
An empty listing yields no records. HTTP and response errors propagate to the caller, so an unavailable API is distinguishable from no vaults.
- Parameters
page_size (int) – API page size, between 1 and 100.
- Returns
Vault records in API page order.
- Return type
collections.abc.Iterator[eth_defi.derive.v3_vaults.DeriveV3Vault]
- fetch_vault(subaccount_id)
Fetch a full public native vault record for manual inspection.
Returns the response without parsing it into
DeriveV3Vault, so callers can inspect fields absent from the listing model. See public/get_vault.
- fetch_spot_assets()
Map configured spot asset addresses to symbols and decimals.
Derive identifies a vault’s deposit asset by its internal spot address. Currency metadata is the public source for a display symbol. See public/get_all_currencies.
- fetch_vault_performance(subaccount_id, resolution='24h', limit=10000)
Iterate the available sampled price history, newest first.
The endpoint caps a page at 10,000 points. Older points are fetched using the exclusive
tobound in Unix seconds, even when a response supplies bucket timestamps in milliseconds.- Parameters
- Returns
Historical observations, newest first.
- Return type
collections.abc.Iterator[eth_defi.derive.v3_vaults.DeriveV3VaultPrice]
- close()
Close the underlying HTTP session.
- Returns
None.- Return type
None