export_lifetime_row

Documentation for eth_defi.research.vault_metrics.export_lifetime_row function.

export_lifetime_row(row)

Export lifetime metrics row to a fully JSON-serialisable dict.

  • Recursively handles nested dicts, lists, tuples, sets, and dataclasses.

  • Normalises pandas, numpy, datetime, and custom types.

  • Converts finite Decimal values to JSON number floats.

  • Preserves legacy fee field names.

The denomination_token_rate dataclass from eth_defi.feed.stablecoin_rate.DenominationTokenRate is converted to JSON fields here. This includes usd_rate/usd_rate_fetched_at for all stablecoins and native_rate/native_rate_fetched_at only when the native source currency is not USD.

Parameters

row (pandas.Series) –

Return type

dict