butterygg/whip

Total value incoherent with graph (rm Covalent portfolio_v2 USD balance)

lajarre opened this issue · 0 comments

The ERC20.balance_usd value is defined using Covalent portfolio_v2 's data (["holdings"][0]["close"]["quote"]), whereas our Balances objects calculate the USD balance themselves based on the token balance and the token USD quote for each day (which lives in Prices objects).

This introduces a discrepancy between how Treasury.usd_total is calculated (using ERC20.balance_usd) and what the UI graph plot shows (which is based on the Balances objects).

Let's keep a single source of truth, and thus remove the ERC20.balance_usd values.

This should probably be bundled together in a refactoring which merges Balances objects inside the Treasury object.