Description

Whip leverages real-time data feeds to build a risk model for protocol and DAO treasuries. We source risk mitigation strategies and allow users to backtest performance using historical token price data, e.g. diversification with stables or hedging with interest rate swaps. This allows treasuries to validate strategies will have the desired mitigation impact in the future by analysing past performance and helps build conviction through governance processes

Whip by Butter showcase

How it's made

Whip receives a treasury's address via the frontend and requests historical price data for each asset in the treasury as well as the treasury's historical balance from Covalent's API. Performance statistics are processed using Pandas and Numpy, and are cached on Redis. This process is done periodically utilising a periodic task scheduler built using Celery (https://github.com/celery/celery). The scheduler checks treasuries previously requested by users on the frontend and updates the asset balances' USD values, asset historical price data (obtained from Coingecko), historical balances (obtained from Covalent) and portfolio performance data such as volatility, and risk contribution. The scheduler then caches this data in Redis. The API acts as a gateway between the Redis database and the frontend, grabbing cached data of a requested treasury's stats if cached and fresh data otherwise. Covalent's API was great at getting historical transfers for a given treasury address. We originally intended to get historical wallet balance data from Covalent but the endpoint only gives historical balances for 1 month. Our final solution was to use Covalent's historical transfers endpoint for each asset in the treasury's wallet, use Coingecko's api to fetch the quote rate for each asset, then create a time-series using the product of the quote rate and the balance at the given time.