Sbhn_NPDaily volume sales buyers average price by chains
Updated 2022-09-17Copy Reference Fork
999
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
›
⌄
--inspired by cristinatinto
with
flow_price as (
SELECT
date_trunc('day',timestamp) as days,
avg(price_usd) as flow_price
from flow.core.fact_prices
group by 1
),
t1 as (
SELECT
block_timestamp,
tx_id,
buyer,
case when currency like '%Flow%' then price*flow_price
else price end as price
from flow.core.ez_nft_sales x
join flow_price y on date_trunc('day',x.block_timestamp)=y.days
),
t12 as (
select
date_trunc('day',block_timestamp) as days,
'Flow' as chain,
count(distinct buyer) as buyers,
count(DISTINCT tx_id) as sales,
sum(price) as volume,
avg(price) as avg_price
from flow.core.ez_nft_sales
where block_timestamp >= '2022-01-01'
and price != 0
and tx_succeeded = TRUE
group by 1,2
),
t2 as (
select
date_trunc('day',block_timestamp) as days,
Run a query to Download Data