strawbettyUSDT, USDC, STBL swap count
Updated 2022-04-12
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
36
›
⌄
with swap_from as (
Select
block_timestamp::date as date,
case
when swap_from_asset_id = '31566704' then 'USDC'
when swap_from_asset_id = '465865291' then 'STBL'
when swap_from_asset_id = '312769' then 'USDT'
end as asset,
sum(swap_from_amount) as swap_from,
count(*) as swap_count
FROM algorand.swaps
WHERE
date >= '2022-03-01'
and date < '2022-04-01'
and asset is not NULL
GROUP by 1,2
), swap_to as (
Select
block_timestamp::date as date,
case
when swap_to_asset_id = '31566704' then 'USDC'
when swap_to_asset_id = '465865291' then 'STBL'
when swap_to_asset_id = '312769' then 'USDT'
end as asset,
sum(swap_to_amount) as swap_to,
count(*) as swap_count
FROM algorand.swaps
WHERE
date >= '2022-03-01'
and date < '2022-04-01'
and asset is not NULL
GROUP by 1,2
)
Select swap_from.date, swap_from.asset, swap_from, swap_to, swap_from+swap_to as total_swap, swap_from.swap_count+swap_to.swap_count as swap_count
FROM swap_from LEFT JOIN swap_to ON swap_from.date = swap_to.date AND swap_from.asset = swap_to.asset
Run a query to Download Data