How to Calculate Tether USDT Liquidity on Compound

Question: How much $USDT (Tether stable coin) is provided and redeemed globally in Compound.Finance daily?

We can answer this question by leveraging Flipside’s `compound.mints` and  ‘compound.redemptions’ tables. 

Let’s compose our query. Here’s the first part of the query.

First, we’ll organize the data and then prepare the supplied output. For the total supplied Tether liquidity on Compound, we’ll sum the total amount of the token ‘USDT’ that is supplied in $USD from the‘compound.mints’table over a 30 day period. 

We’ll do the same for the redemptions by organizing the date first. Then we’ll sum the total amount of the token ‘USDT’ that is received in $USD from the ‘compound.redemptions’ table over a 30 day period. 

Now with the Compound tables summarized and dates entered, we’ll select the data to display in the table. 

We now include a Coalesce function to turn those days with a null value into zeros. For graphing purposes we transformed redeemed amounts into negatives, so we could see the comparison between the two over a bar chart.

We now must join the daily redemptions and liquidity provided (supply) based on the date column being equal across tables. We are using a Left Outer Join here between the two tables so we don’t miss any days where there could be no new redemptions or no new supply. 

Here’s the resulting table from the query:

Let’s graph these results to visualize them over time:

These results can also be exported via CSV, accessed via an auto-updating API endpoint, or in a dashboard. 

View the full results here:

Signup for free and answer your own questions here.

Share This Post on Social Media
Share on facebook
Share on twitter
Share on linkedin