HadisehQuixotic NFT 1
Updated 2022-10-06Copy 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 t1 as ( select
trunc(hour,'day') as day,
symbol ,
avg(price) as average_price
from optimism.core.fact_hourly_token_prices
where symbol in ('WETH','OP') and hour >= CURRENT_DATE - 60
group by day, symbol
),
price_usd as ( select
day,
case when symbol = 'WETH' then 'ETH' else symbol end as token, average_price
from t1)
,
nft_sales as ( select
trunc(block_timestamp,'day') as day ,
tx_hash,
seller_address,
nft_address,
CURRENCY_SYMBOL,
price,
buyer_address,
price*average_price as price_usd
from optimism.core.ez_nft_sales x left outer join price_usd y on x.block_timestamp::date = y.day
where CURRENCY_SYMBOL = token)
select 'Seller' as kind,
day,
count(DISTINCT buyer_address) as total
from nft_sales
group by 1,2
UNION
select 'Buyer' as kind,
day,
count (buyer_address) as total
from nft_sales
Run a query to Download Data