iboo-jbj2MVgoBTC swap volume based - on type of swap
Updated 2022-05-21
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 goBTC_swap_from as (
select BLOCK_TIMESTAMP::date as date ,
sum (SWAP_FROM_AMOUNT) as volume ,
count (DISTINCT tx_group_id) as num_swaps
from flipside_prod_db.algorand.swaps
where year(BLOCK_TIMESTAMP) = '2022'
and SWAP_FROM_AMOUNT>0
and SWAP_FROM_ASSET_ID = 386192725
group by 1
),
goBTC_swap_to as (
select BLOCK_TIMESTAMP::date as date ,
sum (SWAP_to_AMOUNT) as volume ,
count (DISTINCT tx_group_id) as num_swaps
from flipside_prod_db.algorand.swaps
where year(BLOCK_TIMESTAMP) = '2022'
and SWAP_FROM_AMOUNT>0
and SWAP_to_ASSET_ID = 386192725
group by 1
),
all_goBTC as (
select 'sell' as type , * from goBTC_swap_from
UNION all
select 'buy' as type, * from goBTC_swap_to
),
final_goBTC as (
select date ,type , sum (volume) as goBTC_volume ,
sum (num_swaps) as goBTC_swaps
from all_goBTC
group by 1,2
),
goETH_swap_from as (
select BLOCK_TIMESTAMP::date as date ,
sum (SWAP_FROM_AMOUNT) as volume ,
count (DISTINCT tx_group_id) as num_swaps
Run a query to Download Data