sakineh5021-nIQRzBUntitled Query
Updated 2022-04-11
99
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
›
⌄
with pool as (
SELECT POOL_ADDRESS , POOL_NAME
FROM ethereum.dex_liquidity_pools
where platform ='sushiswap'
) ,
per as (
SELECT POOL_NAME , balance_date , max(balance) as max_LP ,sum(balance) as total , max_LP/total*100 as percent
from ethereum.erc20_balances
left outer join pool P on POOL_ADDRESS = contract_address
where POOL_NAME is not NULL
and balance is not null
and balance_date >'2021-01-01'
group by 1 , 2
),
more as (
SELECT balance_date , count(POOL_NAME) as more_pools
from per
where percent >50
group by 1 )
, tot as (
SELECT balance_date , count(POOL_NAME) as total_pools
from per
group by 1
)
SELECT T.balance_date , more_pools/total_pools*100 as percent ,more_pools/total_pools as ratio
from tot T , more M
where T.balance_date = M.balance_date
Run a query to Download Data