libruaryFloor price
Updated 2024-10-04
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 WeeklySales AS (
SELECT
block_timestamp,
nft_id,
price AS sale_price
FROM
flow.nft.ez_nft_sales
WHERE
nft_collection = 'A.0b2a3299cc857e29.TopShot' -- Only include TopShot NFT sales
AND price <= 20.0 -- Only include sales of $20 or less
AND tx_succeeded = TRUE -- Only include successful transactions
)
-- Ranking sales per week and excluding the bottom 2%
, RankedSales AS (
SELECT
block_timestamp,
nft_id,
sale_price,
PERCENT_RANK() OVER (PARTITION BY DATE_TRUNC('week', block_timestamp) ORDER BY sale_price ASC) AS price_rank
FROM
WeeklySales
)
-- Exclude bottom 2% of sales and find the floor price
, FilteredSales AS (
SELECT
block_timestamp,
sale_price
FROM
RankedSales
WHERE
price_rank > 0.02 -- Exclude the lowest 2% of sales (outliers)
)
-- Select the weekly floor price
QueryRunArchived: QueryRun has been archived