HosseinUntitled Query
Updated 2022-11-22
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
prices as (
select
block_timestamp::date as day,
avg(swap_to_amount/swap_from_amount) as sol_price_usd
from solana.fact_swaps
where
swap_from_mint = 'So11111111111111111111111111111111111111112'
and swap_to_mint in (
'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB',
'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
)
and succeeded = true
and swap_to_amount > 0
and swap_from_amount > 0
group by day
)
select
prices.day,
iff(day >= '2022-11-08', 'After FTX News', 'Before FTX News') as timespan,
count(distinct(tx_id)) as sales_count,
sum(sales_amount) as sales_amount_total,
sum(sales_amount * sol_price_usd) as sales_amount_usd_total,
count(distinct(purchaser)) as purchasers_count,
(sales_count / purchasers_count) as tx_per_purchaser,
(sales_amount_total / purchasers_count) as sales_amount_per_purchaser,
(sales_amount_usd_total / purchasers_count) as sales_amount_per_purchaser,
avg(sales_amount) as sales_amount_avg,
median(sales_amount) as sales_amount_median,
avg(sales_amount * sol_price_usd) as sales_amount_usd_avg,
median(sales_amount * sol_price_usd) as sales_amount_usd_median,
sum(sales_count) over (order by prices.day asc) as sales_count_cum,
sum(sales_amount_total) over (order by prices.day asc) as sales_amount_total_cum,
sum(sales_amount_usd_total) over (order by prices.day asc) as sales_amount_usd_total_cum,
sum(purchasers_count) over (order by prices.day asc) as purchasers_count_cum
Run a query to Download Data