superflyUntitled Query
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
›
⌄
with
txns as (
select
iff(from_currency = 'ibc/903A61A498756EA560B85A85132D3AEE21B5DEDD41213725D22ABF276EA6945E','from','to') as category,
*
from osmosis.core.fact_swaps
where (
from_currency = 'ibc/903A61A498756EA560B85A85132D3AEE21B5DEDD41213725D22ABF276EA6945E'
or to_currency = 'ibc/903A61A498756EA560B85A85132D3AEE21B5DEDD41213725D22ABF276EA6945E'
)
)
select
date_trunc('{{date_range}}',block_timestamp) as date,
category,
count(distinct trader) as n_wallets,
sum(iff(category = 'from',-1 * from_amount/1e6, to_amount/1e6)) as swap_amount
from txns
group by date, category
Run a query to Download Data