build_crypto_vault_record

Documentation for eth_defi.vault.crypto_vaults.build_crypto_vault_record function.

build_crypto_vault_record(record, vault_row, threshold_usd)

Convert one common metric record to the crypto bundle schema.

The transformation preserves the observed denomination while replacing mixed-unit rankings and choosing the applicable stablecoin or native qualification policy.

Parameters
  • record (dict[str, Any]) – Serialised common metric record.

  • vault_row (eth_defi.vault.vaultdb.VaultRow) – Source vault database row.

  • threshold_usd (decimal.Decimal) – Fixed USD qualification guideline for stablecoin records. ETH/BTC records use CRYPTO_NATIVE_MIN_PEAK_TOTAL_ASSETS instead.

Returns

Native-unit crypto record and its resolved qualification threshold.

Return type

tuple[dict[str, Any], decimal.Decimal]