MasiTOTAL DAILY SWAPS LAST 7 DAYS from and to Osmo
Updated 2022-11-02Copy Reference Fork
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 from_osmo_swap as ( select 'From_Osmo' as status,
trunc(block_timestamp,'day') as day,
count(DISTINCT tx_id) as count_tx,
count(DISTINCT trader) as swappers,
sum(from_amount/pow(10,6)) as amounts,
avg(from_amount/pow(10,6)) as avg_amount
from osmosis.core.fact_swaps
where from_currency = 'uosmo'
and TX_STATUS = 'SUCCEEDED'
group by 1,2)
,
to_osmo_swap as (select 'To_Osmo' as status,
trunc(block_timestamp,'day') as day,
count(DISTINCT tx_id) as count_tx,
count(DISTINCT trader) as swappers,
sum(to_amount/pow(10,6)) as amounts,
avg(to_amount/pow(10,6)) as avg_amount
from osmosis.core.fact_swaps
where to_currency = 'uosmo'
and TX_STATUS = 'SUCCEEDED'
group by 1,2)
,
osmo_price as ( select trunc(RECORDED_AT,'day') as day,
symbol,
avg(price) as osmo_price
from osmosis.core.dim_prices
where symbol = 'OSMO'
group by 1,2)
,
tb1 as ( select *
from from_osmo_swap
UNION
select *
from to_osmo_swap)
select status,
Run a query to Download Data