fetch_lagoon_vaults_for_chain

Documentation for eth_defi.erc_4626.vault_protocol.lagoon.offchain_metadata.fetch_lagoon_vaults_for_chain function.

fetch_lagoon_vaults_for_chain(chain_id, cache_path=PosixPath('/home/runner/.tradingstrategy/cache/lagoon'), api_base_url='https://app.lagoon.finance/api', now_=None, max_cache_duration=datetime.timedelta(days=2))

Fetch and cache Lagoon offchain vault metadata for a given chain.

  • Enumerates vaults using the listing endpoint, then fetches each vault’s detail (including description) from the detail endpoint

  • One JSON cache file per chain

  • Multiprocess safe via file lock

Parameters
  • chain_id (int) – EVM chain id

  • cache_path (pathlib.Path) – Directory for cache files (default ~/.tradingstrategy/cache/lagoon/)

  • api_base_url (str) – Lagoon API base URL

  • now – Override current time (for testing)

  • max_cache_duration (datetime.timedelta) – How long before refreshing cache (default 2 days)

  • now_ (Optional[datetime.datetime]) –

Returns

Dict mapping checksummed vault address to LagoonVaultMetadata

Return type

dict[str, eth_defi.erc_4626.vault_protocol.lagoon.offchain_metadata.LagoonVaultMetadata]