superflyUntitled Query
Updated 2022-09-28Copy Reference Fork
9
1
2
3
4
5
6
7
8
9
›
⌄
with min1 as (select
iff(from_currency = 'ibc/903A61A498756EA560B85A85132D3AEE21B5DEDD41213725D22ABF276EA6945E','from','to') as type,
* from osmosis.core.fact_swaps---i us general tabel
where (from_currency = 'ibc/903A61A498756EA560B85A85132D3AEE21B5DEDD41213725D22ABF276EA6945E'
or to_currency = 'ibc/903A61A498756EA560B85A85132D3AEE21B5DEDD41213725D22ABF276EA6945E'))
select date_trunc('{{date_range}}',block_timestamp) as date,
type,count(distinct trader) as number_of_users,
sum(iff(type = 'from',-1 * from_amount/1e6, to_amount/1e6)) as volum_of_swaps
from min1 group by date, type
Run a query to Download Data