hessDaily Swaps
Updated 2022-11-16Copy Reference Fork
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
›
⌄
with swap as ( select date(block_timestamp) as date, tx_id, trader, from_amount/pow(10,from_decimal) as amount, FROM_CURRENCY
from osmosis.core.fact_swaps
where block_timestamp::date >= CURRENT_DATE - 15)
,
label as ( select date, tx_id, trader, amount , PROJECT_NAME
from osmosis.core.dim_labels a join swap b on b.FROM_CURRENCY = a.address)
,
price as ( select date(RECORDED_AT) as date, symbol , avg(price) as avg_price
from osmosis.core.dim_prices
where date >= CURRENT_DATE - 15 and symbol in (select project_name from label)
group by 1,2)
select a.date,case when a.date <= '2022-11-07' then 'Before FTX' else 'After FTX' end as type, count(DISTINCT(tx_id)) as total_tx, count(DISTINCT(trader)) as total_user, sum(amount*avg_price) as volume,
avg(amount*avg_price) as avg_volume
from label a left outer join price b on a.date = b.date and a.project_name = b.symbol
group by 1,2
Run a query to Download Data