butterygg / whip

Treasury Risk Analytics Dashboard with Strategy Backtesting for DAOs
4 stars 2 forks source link

Refactor: Balance At Transfers #82

Closed lajarre closed 2 years ago

lajarre commented 2 years ago

A quick refactoring together with a change in the transfers logic.

It seems this fixes multiple issues, including coherence between the total balance and the graph (which is the sum of the individual balance series).

Todo:

I believe an important next step is to move the balance series (today in the Balances object) inside of the Treasury object, so that Treasury is the only maintainer of the dict mapping between token symbols and values. This way, no place for any incoherence between balance series and treasury structure.

Then later, I believe we should remove the BalancesAtTransfers struct and replace it with a Transfers struct which holds a sparse series containing only transfers with amounts (deltas in token value). We should start properly bookkeeping the transfers themselves, as transfers a more fundamental data points than balances, and will allow refining our backtesting features.