drone-mostafaUntitled Query
Updated 2022-11-27Copy Reference Fork
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 tab0 as ( SELECT date_trunc('day', hour) as day1, avg(price) as sol_price
FROM ethereum.core.fact_hourly_token_prices WHERE token_address LIKE lower('0xD31a59c85aE9D8edEFeC411D448f90841571b89c') GROUP BY 1 ),
tb1 as (SELECT date_trunc('week', block_timestamp) as date,
COUNT(DISTINCT tx_id) as mints,
count(DISTINCT purchaser) as minters,
sum(mint_price * sol_price) as avg_nft_mint_price,
avg(mint_price * sol_price) as avg_mint_volume,
COUNT(DISTINCT tx_id)/count(distinct PURCHASER) as avg_minters
FROM solana.core.fact_nft_mints LEFT outer join tab0 ON date_trunc('day', block_timestamp) = day1
where block_timestamp > '2022-01-01'
AND MINT_CURRENCY LIKE 'So11111111111111111111111111111111111111111'
GROUP BY 1),
tb3 as (select
BLOCK_HOUR::date as day,
avg(PRICE_USD) as price_token
from algorand.defi.ez_price_pool_balances
group by 1),
tb4 as (select
date_trunc('week',BLOCK_TIMESTAMP) as date,
count(distinct TX_GROUP_ID) as sale_no,
count(distinct PURCHASER) as buyer_no,
sum(TOTAL_SALES_AMOUNT*price_token) as volume_usd,
avg(TOTAL_SALES_AMOUNT*price_token) as average_volume,
count(distinct TX_GROUP_ID)/count(distinct PURCHASER) as avg_minter
from algorand.nft.ez_nft_sales x join tb3 y on x.BLOCK_TIMESTAMP::date=y.day
where BLOCK_TIMESTAMP>= '2022-01-01'
and TOTAL_SALES_AMOUNT>0
group by 1)
select 'Solana' as type, * from tb1 UNION
select 'Algorand' as type, * from tb4
Run a query to Download Data