WETH Volume in Sushi WBTC-WETH POOL
THE TASK We are interested in visualizing the amount of WETH swapped and count of swaps by day in the WBTC-WETH pool. To do this, we will need to count trades by day, as well as aggregate both the WETH traded in and out of the pool. In order to do this, we will need to determine the direction of each trade. Since we know which token is token0 and which is token1, we can refer to the amounts to understand the trade direction. In this case, token0 is WETH and token1 is WBTC. If we look at the amount0in_adj and amount1in_adj columns we can easily determine the trade direction. If amount0in_adj is greater than 0, the user swapped from USDC to WETH, and amount1out_adj will be greater than 0. The opposite is the case for swaps from WBTC to WETH. APPROACH We goin to query the pool details, token details, and swap details, and analyze the data. Since we are interested in the WETH volume, we can look at the amount of WETH in and out of the pool. To count trades we can look at the number of transaction hashes in our swaps query. To aggregate our data by day, we will need to change the granularity of our block_timestamp date dimension. We can do this by using the date_trunc() function. EVALUATION. As we see from the graph, the month of May saw a great peak in the number of WETH swap in the Sushi WBTC-WETH pool. Various factors could account to this activity such as the decrease in the minimum amount which will therefore make the number of swaps and volume go higher.