hessGene Swaps
Updated 2022-07-20Copy Reference Fork
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
›
⌄
with price as ( select date(block_timestamp) as p_date, (sum(SWAP_TO_AMOUNT)/sum(SWAP_FROM_AMOUNT)) as price
from solana.core.fact_swaps
where SWAP_FROM_MINT = 'GENEtH5amGSi8kHAtQoezp1XEXwZJ8vcuePYnXdKrMYz'
and SWAP_TO_MINT = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
and p_date >= '2022-01-01'
group by 1)
,
gene as ( select date(block_timestamp) as date ,count(DISTINCT(tx_id)) as total_swaps , count(DISTINCT(swapper)) as total_swapper, sum(SWAP_FROM_AMOUNT) as amount,
sum(total_swaps) over ( order by date asc) as cum_swaps , sum(total_swapper) over (order by date asc) as cum_swapper,
sum(amount) over (order by date asc) as cum_amount
from solana.core.fact_swaps
where SWAP_from_MINT = 'GENEtH5amGSi8kHAtQoezp1XEXwZJ8vcuePYnXdKrMYz'
and block_timestamp::date >= '2022-01-01'
group by 1)
select * , price , amount*price as volume
from gene a left outer join price b on a.date = b.p_date
order by 1
Run a query to Download Data