Updated 2023-05-10
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
›
⌄
with
prices as (SELECT TIMESTAMP::date as time,t1. SYMBOL,DECIMALS,t1.TOKEN_CONTRACT,avg (PRICE_USD) as USD
from near.core.dim_token_labels t1
left JOIN near.core.fact_prices t2 using (TOKEN_CONTRACT)
WHERE SYMBOL like '%NEAR%' GROUP BY 1,2,3,4),
jambo as (
select
date_trunc('Week', block_timestamp) as date,
sum(AMOUNT_IN * USD) as Jumbo_Swap_Amount,
count(distinct tx_hash) as Jumbo_Swap_Count
from near.core.ez_dex_swaps
left JOIN prices on TOKEN_IN_CONTRACT = TOKEN_CONTRACT AND time::date = BLOCK_TIMESTAMP::date
where platform = 'v1.jumbo_exchange.near'
group by 1 ),
total as (select
date_trunc('Week', block_timestamp) as date,
sum(AMOUNT_IN * USD) as Total_Swap_Amount,
count(distinct tx_hash) as Total_Swap_Count
from near.core.ez_dex_swaps
left JOIN prices on TOKEN_IN_CONTRACT = TOKEN_CONTRACT
AND time::date = BLOCK_TIMESTAMP::date
group by 1
)
select t1.date,Jumbo_Swap_Amount,Jumbo_Swap_Count,Total_Swap_Amount,Total_Swap_Count
from total t1 join jambo using (date)
Run a query to Download Data