headitmanagerSynthetics Rate of BUSD and USDC(swap from)
Updated 2022-07-02
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 sum(from_amount_usd),from_asset,block_timestamp::date from thorchain.swaps
where from_asset like '%BUSD%' or from_asset like '%USDC%'
group by from_asset,block_timestamp::date)
,swap_to as (select sum(to_amount_usd),to_asset,block_timestamp::date from thorchain.swaps
where to_asset like '%BUSD%' or to_asset like '%USDC%'
group by to_asset,block_timestamp::date)
,swap_from_temptbl as(select block_timestamp::date as date,
case
when from_asset like '%BUSD%' then 'BUSD'
when from_asset like '%USDC%' then 'USDC'
else 'OTHER'
end as label
from thorchain.swaps)
,swap_rate_from as(select (count(case label when 'BUSD' then 1 else null end)/count(*)*100) as BUSD_swaprate
,(count(case label when 'USDC' then 1 else null end)/count(*)*100) as USDC_swaprate
,date from swap_from_temptbl
group by date)
,swap_to_temptbl as (select block_timestamp::date as date,
case
when to_asset like '%BUSD%' then 'BUSD'
when to_asset like '%USDC%' then 'USDC'
else 'OTHER'
end as label
from thorchain.swaps)
,swap_rate_to as(select (count(case label when 'BUSD' then 1 else null end)/count(*)*100) as BUSD_swaprate
,(count(case label when 'USDC' then 1 else null end)/count(*)*100) as USDC_swaprate
,date from swap_to_temptbl
group by date)
,swap_from_synthetics as (select sum(from_amount_usd),from_asset,block_timestamp::date from thorchain.swaps
where from_asset like '%/BUSD%' or from_asset like '%/USDC%'
group by from_asset,block_timestamp::date)
,swap_to_synthetics as (select sum(to_amount_usd),to_asset,block_timestamp::date from thorchain.swaps
where to_asset like '%/BUSD%' or to_asset like '%/USDC%'
group by to_asset,block_timestamp::date)
Run a query to Download Data