merge_into_vault_database

Documentation for eth_defi.hyperliquid.vault_data_export.merge_into_vault_database function.

merge_into_vault_database(db, vault_db_path, review_statuses=None)

Merge Hyperliquid vault metadata into an existing VaultDatabase pickle.

Reads the existing pickle, upserts Hyperliquid VaultRow entries (keyed by VaultSpec), and writes back. Idempotent: running twice produces the same result.

If the pickle file does not exist, creates a new VaultDatabase.

The review_statuses argument is how the Hyperliquid review Google Sheet feeds human-entered OK / Avoid decisions into the pickle so downstream consumers (calculate_vault_record → JSON export) can surface them without re-reading the sheet on every invocation.

Behaviour:

  • review_statuses is None (sheet unreachable, credentials missing, or the caller explicitly opted out): the existing _manual_review_status value is carried forward from the previous pickle entry for each vault. This is the “persist if Google Sheets is down” contract — the last known manual review survives an outage.

  • review_statuses is a mapping: the mapped value (including an explicit None for “no review”) is written for every address present in the mapping. Addresses absent from the mapping fall back to the carry-forward path above.

Parameters
Returns

The updated VaultDatabase.

Return type

eth_defi.vault.vaultdb.VaultDatabase