elsina✅ DeFi: 8. Weekly top 10 swapping pairs: unique swappers
Updated 2023-03-14
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 price as (
select
date_trunc('day', recorded_at) as day,
symbol as currency,
avg(price) as price
from osmosis.core.dim_prices
group by 1, 2
union all
select
date_trunc('day', hour) as day,
case
when symbol = 'USDC' then 'USDC.axl'
when symbol = 'USDT' then 'USDT.axl'
when symbol = 'aTUSD' then 'USDC.grv'
when symbol = 'sUSD' then 'USDT.grv'
when symbol = 'iUSD' then 'USDX'
when symbol = 'WETH' then 'WETH.axl'
when symbol = 'aWETH' then 'WETH.grv'
when symbol = 'WBTC' then 'WBTC.axl'
when symbol = 'uWBTC' then 'WBTC.grv'
when symbol = 'DAI' then 'DAI.axl'
when symbol = 'aDAI' then 'DAI.grv'
when symbol = 'FRAX' then 'FRAX.axl'
else symbol
end as currency,
avg(price) as price
from ethereum.core.fact_hourly_token_prices
group by 1, 2
)
select
date_trunc('week', block_timestamp) as "Day",
case when lower(l1.project_name) > lower(l2.project_name) then concat(l2.project_name,'/',l1.project_name) else concat(l1.project_name,'/',l2.project_name) end as "Pair",
-- count(distinct tx_id) as "Swap Count",
Run a query to Download Data