elenahooExample 30 day efficiency of Top 5 v3 Pools (vs v2 efficiency)
Updated 2021-06-17
999
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
with raw_balances as (select
distinct
balance_date,
address_name,
user_address,
symbol,
last_value(balance) over (partition by balance_date, user_address,address_name,symbol order by balance_date) balance,
last_value(price) over (partition by balance_date,user_address, address_name,symbol order by balance_date) price,
last_value(amount_usd) over (partition by balance_date,user_address, address_name,symbol order by balance_date) amount_usd
from ethereum.erc20_balances
where user_address = '0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc'
or user_address = '0x3041cbd36888becc7bbcbc0045e3b1f144466f5f'
or user_address = '0xbb2b8038a1640196fbe3e38816f3e67cba72d940'
or user_address = '0x0d4a11d5eeaac28ec3f61d100daf4d40471f1852'
or user_address = '0xd3d2e2692501a5c9ca623199d38826e513033a17'
and symbol <> ''
order by balance_date),
tvl as (select
date_trunc('day',balance_date) as balance_date,
address_name,
user_address,
sum(amount_usd) as tvl
from raw_balances
group by 1,2,3),
raw_volume as (select
amount_usd,
date_trunc('day',block_timestamp) as volume_date,
pool_address,
pool_name
from ethereum.dex_swaps
where platform like '%uniswap-v2%'
and (pool_address = '0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc'
or pool_address = '0x3041cbd36888becc7bbcbc0045e3b1f144466f5f'
or pool_address = '0xbb2b8038a1640196fbe3e38816f3e67cba72d940'
Run a query to Download Data