Abolfazl_771025hourly swap
Updated 2022-11-05Copy 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
›
⌄
select
date_trunc('hour',block_timestamp) as date,
'swap in' as type,
count(tx_id) as "swap count",
count(distinct trader) as "count of users",
sum(FROM_AMOUNT*price/1e6) as volume
from osmosis.core.fact_swaps ,osmosis.core.dim_labels a join osmosis.core.dim_prices b on a.label=b.symbol
where POOL_IDS[0]=812
and TX_STATUS='SUCCEEDED'
and FROM_CURRENCY = 'ibc/903A61A498756EA560B85A85132D3AEE21B5DEDD41213725D22ABF276EA6945E'
group by 1
union
select
date_trunc('hour',block_timestamp) as date,
'swap out' as type,
count(tx_id) as "swap count",
count(distinct trader) as "count of users",
sum(TO_AMOUNT*price/1e6) as volume
from osmosis.core.fact_swaps ,osmosis.core.dim_labels a join osmosis.core.dim_prices b on a.label=b.symbol
where POOL_IDS[0]=812
and TX_STATUS='SUCCEEDED'
and TO_CURRENCY = 'ibc/903A61A498756EA560B85A85132D3AEE21B5DEDD41213725D22ABF276EA6945E'
group by 1
Run a query to Download Data