theericstoneunique new nfts copy
Updated 2023-04-19
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
›
⌄
-- forked from takamori / unique new nfts @ https://flipsidecrypto.xyz/takamori/q/2023-04-17-12-42-pm-A_f5W8
select count(distinct case when last_date < {{start_date}}
and block_timestamp > current_timestamp() - interval {{time_stretch}}
and price < {{price_thresh}} then tokenid end) as new_nfts,
count(distinct case when last_date < {{start_date}}
and block_timestamp > current_timestamp() - interval {{time_stretch}}
and price < {{price_thresh}} and event_type = 'bid_won' then tokenid end) as new_nfts,
count(distinct case when last_date < current_timestamp()
and block_timestamp > current_timestamp() - interval {{time_stretch}}
and price < {{price_thresh}}
then tokenid end) as all_nfts,
sum(case when platform_name = 'blur' and event_type = 'bid_won'
and block_timestamp > current_timestamp() - interval {{time_stretch}}
and price <= {{price_thresh}}
then 1 end) as bid_trades,
sum(case when platform_name != 'xxblur'
and block_timestamp > current_timestamp() - interval {{time_stretch}}
then 1 end) as total_trades
from
(select block_timestamp, buyer_address, price, tokenid, platform_name, event_type,
lag(price,1) over (partition by concat(nft_address, tokenid) order by block_timestamp) as last,
lag(block_timestamp,1) over (partition by concat(nft_address, tokenid) order by block_timestamp) as last_date,
rank() over (partition by concat(nft_address, tokenid) order by block_timestamp) as rank,
rank() over (partition by concat(nft_address, tokenid) order by block_timestamp desc) as rank_back
from ethereum.core.ez_nft_sales
where
lower(nft_address) = {{nft}}) as A
Run a query to Download Data