MLDZMNALT5
Updated 2022-11-13
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
›
⌄
with tb2 as (select block_timestamp::date as day,
avg (swap_to_amount/swap_from_amount) as price_token
from solana.fact_swaps
where swap_from_mint = 'So11111111111111111111111111111111111111112'
and swap_to_mint in ('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v','Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB')
and swap_to_amount > 0
and swap_from_amount > 0
and succeeded = 'TRUE'
group by 1)
select
date_trunc('{{Time_basis}}',BLOCK_TIMESTAMP) as date,
avg(SALES_AMOUNT) as avg_sale_SOL,
avg(SALES_AMOUNT*price_token) as avg_sale_usd,
min(SALES_AMOUNT) as floor_price_SOL,
min(SALES_AMOUNT*price_token) as floor_price_usd,
max(SALES_AMOUNT) as highest_price_SOL,
max(SALES_AMOUNT*price_token) as highest_price_usd,
median(SALES_AMOUNT) as median_price_SOL,
median(SALES_AMOUNT*price_token) as median_price_usd,
highest_price_algo-floor_price_algo as bond_price_SOL,
highest_price_usd-floor_price_usd as bond_price_usd,
avg(avg_sale_usd) OVER (ORDER BY date ROWS BETWEEN 7 PRECEDING AND CURRENT ROW) as MA_7_Days,
avg(avg_sale_SOL) OVER (ORDER BY date ROWS BETWEEN 7 PRECEDING AND CURRENT ROW) as MA_7_Days_ALGO
from algorand.nft.ez_nft_sales x join tb2 y on x.BLOCK_TIMESTAMP::date=y.day
where BLOCK_TIMESTAMP>=CURRENT_DATE- {{Time_period}}
and NFT_MARKETPLACE = '{{Marketplace}}'
and TOTAL_SALES_AMOUNT>0
group by 1
Run a query to Download Data