How To: Create a CeFi crisis dashboard

🧠
This is part of our How To series: A selection of use-cases that have high educational value, and/or best showcases Vektor's capabilities. We will continue to add new How To articles over time, and they should not be considered exhaustive! Vektor is a powerful tool and VXL is a very flexible language with many different use-cases; this is just a taster.

Objective & Benefit

Sometimes we see a centralized ('CeFi') exchange or wealth management entity in the news, with reports of wrongdoing or mass withdrawals. But as an observer it's hard to know if there is any merit to the news or if it's just FUD.

We're going to show you how to use Vektor to easily whip up a live-updating crisis dashboard like this one below, so you can easily see for yourself what's going on, and stop relying on information in the news and/or social media. Starting with just a list of known addresses belonging to the entity, we can quickly see things like net withdrawals, % value in their own token, and even lend/borrow positions using just a couple of VXL functions.

Our example CeFi crisis dashboard
💡
NB we're using Nexo as an example here purely for illustrative purposes, because it is a real world example after being subject to attention in Jan 2023

Functions used

LABELS.ADD - Add a human readable label to a blockchain address
BALANCES - Get the balances for all assets on all blockchains for all labelled addresses
BALANCES.SUM - Sum the balances for all on all blockchains for all labelled addresses
PRICE - Get the price of an asset
LEND.POSITIONS - Get info on supplied lending positions
BORROW.POSITIONS - Get info on borrowed positions

Step-by-step

1. Add labels for all the addresses associated with the CeFi entity

Use LABELS.ADD to register all the known on-chain addresses associated with Nexo. In this case we sourced the addresses from a spreadsheet found online.

💡
Tip: You can do all of these in one shot by using Vektor's multi-line feature; just press Shift+Enter to move to a new line without submitting the command.
Batch-adding LABELS using multi-line

2. See a global breakdown of assets using BALANCES

Now that we have added the LABELS, simply run BALANCES to see a breakdown across all assets, chains, and labelled addresses. We can see that the top few balance items are all in the NEXO asset.

Output of the BALANCES function

3. See a total balance using BALANCES.SUM

You can see the total balance using BALANCES.SUM. Vektor will live-convert all the individual assets (default USD) and sum the total.

We can see that there is ~$366m across all the known Nexo addresses.

Output of the BALANCES.SUM function

4. Calculate net withdrawals

We can use some simple arithmetic to subtract this figure from the known balance on Jan 13, to get a live-updating net withdrawals metric.

5. Breakout the entity token, and compute it's value as a % of the total

Remembering the FTX collapse, what started this crisis was the undermining of confidence of the exchange's native token, and it's relative weighting in the overall balance sheet.

Focusing here on the NEXO asset, we can add an asset filter to BALANCES to see the total NEXO balance across these addresses (quoted in USD). Then it's just some simple arithmetic to show the % that NEXO value makes up of the total.

6. Add a PRICE feed

For good measure we add the NEXO price feed. Remember, everything so far is all live-updating, not just price!

7. Search and display global LEND and BORROW positions

Finally, using Vektor's LEND.POSITIONS and BORROW.POSITIONS functions, we discovered that Nexo has 7 lend and 7 borrow positions on Aave on Ethereum and Polygon. They are also LP'ing on Curve Finance (using LP.POSITIONS - not shown here).

Lend and Borrow positions discovered across all labels on all chains and venues

8. Arrange the WORKSPACE layout

A bit of layout tweaks and we have our dashboard on all-things Nexo. Now we can watch all of our metrics, some direct and some derived, and get a much better picture of what's going on.

The final product - a live-updating crisis dashboard!

Hope you liked this How-To use-case! You can find more here.

💎
Do you have an excellent Vektor use-case that you'd like to have featured? We'd love to hear from you!

Read more: