HosseinUntitled Query
Updated 2022-12-13
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
›
⌄
with prices as (
select trunc(block_timestamp::date, 'day') as day,
from_currency as currency,
avg ((to_amount / pow(10, to_decimal))/(from_amount/pow(10, from_decimal))) as price_usd
from osmosis.core.fact_swaps
where from_currency in ('uosmo', 'ibc/3FF92D26B407FD61AE95D975712A7C319CDE28DE4D80BDC9978D935932B991D7')
and to_currency in ('ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858', 'ibc/0CD3A0285E1341859B5E86B6AB7682F023D03E97607CCC1DC95706411D866DF7') -- USDC, DAI
and to_amount > 0
and from_amount > 0
and tx_status = 'SUCCEEDED'
group by 1, 2
)
select
case
when (amount * price_usd) /power(10, decimal) < 10 then 'Smaller than $10'
when (amount * price_usd) /power(10, decimal) < 100 then 'Between $10 - $100'
when (amount * price_usd) /power(10, decimal) < 1000 then 'Between $100 - $1000'
when (amount * price_usd) /power(10, decimal) < 1000 then 'Between $1000 - $10k'
else 'More Than $10k' end as type,
count (distinct(tx_id)) as lprovicers_tx_count
from osmosis.core.fact_liquidity_provider_actions a
join prices
on prices.day = a.block_timestamp::date
and prices.currency = a.currency
where action in ('pool_existed')
and pool_id [0] = '773'
and tx_status = 'SUCCEEDED'
group by 1
order by 2 desc
Run a query to Download Data