0xaiman2023-02-20 11:42 PM
Updated 2023-02-20
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
›
⌄
--optimism mc
with a as (select dc.symbol, dc.name, count(distinct ens.tokenid) as n_nft,
avg(price_usd) as avg_price
from optimism.core.ez_nft_sales ens
inner join optimism.core.dim_contracts dc
on ens.nft_address = dc.address
group by 1,2),
b as (select name, n_nft, avg_price, n_nft*avg_price as market_cap
from a ),
c as (select sum(market_cap) from b),
--optimism end mc
f_sales as (select date(block_timestamp) as day, NFT_COLLECTION, currency, sum(price) as sales, avg(price_usd) as avp
from flow.core.ez_nft_sales ens
inner join flow.core.fact_prices fp
on fp.token_contract=ens.currency
group by 1,2,3)
select * from f_sales
limit 100
Run a query to Download Data