saeedmznDUST is in the Air - weekly DUST swaps
Updated 2022-09-09
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 DUST_price as (
select block_timestamp::date daily,
avg(swap_to_amount/swap_from_amount) price
from solana.fact_swaps
where swap_from_mint = 'DUSTawucrTsGU8hcqRdHDCbuYhCPADMLM2VcCb8VnFnQ' --DUST
and swap_to_mint ='EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' --USDR
and swap_from_amount > 0
and succeeded = 'TRUE'
group by daily
),
swap_from as (
select date_trunc(week,block_timestamp) weekly,
count (distinct tx_id) num_swaps,
count (distinct swapper) num_swappers,
sum (swap_from_amount) volume ,
sum (swap_from_amount * price ) volume_usd
from solana.core.fact_swaps join DUST_price on daily = block_timestamp::date
where swap_from_mint = 'DUSTawucrTsGU8hcqRdHDCbuYhCPADMLM2VcCb8VnFnQ'
and swap_from_amount > 0
group by 1
),
swap_to as (
select
date_trunc(week,block_timestamp) weekly,
count (distinct tx_id) num_swaps,
count (distinct swapper) num_swappers,
sum (swap_to_amount) volume ,
sum (swap_to_amount * price ) volume_usd
from solana.core.fact_swaps join DUST_price on daily = block_timestamp::date
where swap_to_mint = 'DUSTawucrTsGU8hcqRdHDCbuYhCPADMLM2VcCb8VnFnQ'
and swap_from_amount > 0
group by 1
),
all_swaps as (
select 'swap_to' type , weekly ,num_swaps, num_swappers , volume , volume_usd from swap_to
UNION
Run a query to Download Data