SalehStablecoin Popularity for Swaps-Total volume
Updated 2022-04-04Copy 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
›
⌄
with stablecoin_from as ( select
block_timestamp::date as date ,
case when swap_from_asset_id=31566704 then 'USDC'
when swap_from_asset_id =312769 then 'USDT'
when swap_from_asset_id = 465865291 then 'STBL'
end as Token,
count (DISTINCT tx_group_id) as transactions,
sum (swap_from_amount) as volume
from algorand.swaps
where block_timestamp::date >= '2022-03-01'
group by 1,2 having Token is not null
),
stablecoin_to as ( select
block_timestamp::date as date ,
case when swap_to_asset_id=31566704 then 'USDC'
when swap_to_asset_id =312769 then 'USDT'
when swap_to_asset_id = 465865291 then 'STBL'
end as Token,
count (DISTINCT tx_group_id) as transactions,
sum (swap_to_amount) as volume
from algorand.swaps
where block_timestamp::date >= '2022-03-01'
group by 1,2 having Token is not null
),
all_ as (
select * from stablecoin_from
UNION ALL
select * from stablecoin_to
)
select date , Token , sum(Transactions) as transactions
,sum(volume ) as volume
from all_
group by 1, 2
order by 1
Run a query to Download Data