binhachonMarket Volatility II - #3
Updated 2022-05-23
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
29
30
31
32
33
34
35
36
›
⌄
with SUSHI_pools as (
select
pool_address,
pool_name
from flipside_prod_db.ethereum_core.dim_dex_liquidity_pools
where pool_address in ('0x795065dcc9f64b5614c407a6efdc400da6221fb0', '0xe06f8d30ac334c857fc8c380c85969c150f38a6a', '0x6cbefa95e42960e579c2a3058c05c6a08e2498e9')
),
liquidity as (
select
date_trunc('day', timestamp) as time,
substr(location, 3, len(location) - 5) as pool_address,
tokenflow_eth.hextoint(value)/1e18 as amount
from flipside_prod_db.tokenflow_eth.storage_reads
where timestamp::date >= '2022-04-01'
and location like '0[%].0'
and pool_address in (select pool_address from SUSHI_pools)
qualify row_number() over (partition by time, pool_address order by timestamp, amount) = 1
),
timetable_1 as (
select
distinct time
from liquidity
),
timetable_2 as (
select
distinct pool_address
from liquidity
),
timetable_3 as (
select
time,
pool_address
from timetable_1
left join timetable_2
),
adjusted_liquidity as (
Run a query to Download Data