maybeyonasosmo_stable_sell_daily
Updated 2022-06-27Copy 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
stable_swaps as (
select
block_timestamp,
tx_id,
trader,
case when from_currency = 'ibc/0CD3A0285E1341859B5E86B6AB7682F023D03E97607CCC1DC95706411D866DF7' then 'DAI'
when from_currency = 'ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858' then 'USDC'
else 'other' end as from_asset,
case when to_currency = 'ibc/0CD3A0285E1341859B5E86B6AB7682F023D03E97607CCC1DC95706411D866DF7' then 'DAI'
when to_currency = 'ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858' then 'USDC'
else 'other' end as to_asset,
case when from_currency = 'ibc/0CD3A0285E1341859B5E86B6AB7682F023D03E97607CCC1DC95706411D866DF7' then from_amount/pow(10,from_decimal)
when from_currency = 'ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858' then from_amount/pow(10,from_decimal)
else 0 end as from_amt,
case when to_currency = 'ibc/0CD3A0285E1341859B5E86B6AB7682F023D03E97607CCC1DC95706411D866DF7' then to_amount/pow(10,to_decimal)
when to_currency = 'ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858' then to_amount/pow(10,to_decimal)
else 0 end as to_amt
from osmosis.core.fact_swaps
where from_currency in (
'ibc/0CD3A0285E1341859B5E86B6AB7682F023D03E97607CCC1DC95706411D866DF7', -- dai
'ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858' -- usdc
)
or to_currency in (
'ibc/0CD3A0285E1341859B5E86B6AB7682F023D03E97607CCC1DC95706411D866DF7', -- dai
'ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858' -- usdc
)
)
select
date(block_timestamp) as date,
from_asset,
count(tx_id) as txs,
count(distinct trader) as users,
sum(from_amt) as vol
from stable_swaps
Run a query to Download Data