mmdrezaFLOW - 1 - Total sales
Updated 2022-10-26Copy 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
›
⌄
with flow_price_tb as (
select
timestamp::date as date,
avg (price_usd) as average_flow_price
from flow.core.fact_prices
where symbol like 'FLOW'
and source like 'coinmarketcap'
group by date
)
select
count(DISTINCT tx_id) as sales,
count(DISTINCT buyer ) as unique_buyers,
count(DISTINCT seller ) as unique_sellers,
sum(case
when currency = 'A.1654653399040a61.FlowToken' then price * fp.average_flow_price
else s.price
end) as total_usd_amount,
avg(case
when currency = 'A.1654653399040a61.FlowToken' then price * fp.average_flow_price
else s.price
end) as average_usd,
nft_collection
from flow.core.ez_nft_sales s join flow_price_tb fp on s.block_timestamp::date = fp.date
where nft_collection like '%{{project}}'
and tx_succeeded = 'TRUE'
group by nft_collection
Run a query to Download Data