adambalah22
Updated 2023-05-16
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 buytable1 as (
select NFT_TO_ADDRESS ,TOKENID ,(MINT_PRICE_ETH)/NFT_COUNT as MINT_PRICE_ETH ,(MINT_PRICE_USD)/NFT_COUNT as MINT_PRICE_USD ,tx_hash ,BLOCK_TIMESTAMP::DATE AS MINT_TIME
from ethereum.core.ez_nft_mints
where NFT_ADDRESS='0x960b7a6bcd451c9968473f7bbfd9be826efd549a'
),
selltable1 as (
select MIN(BLOCK_TIMESTAMP) AS DATE ,seller_address, tx_hash, tokenid, price_usd,price
FROM ethereum.core.ez_nft_sales
WHERE EVENT_TYPE = 'sale' and CURRENCY_SYMBOL = 'ETH'
and lower(NFT_ADDRESS)=lower('0x960b7a6bcd451c9968473f7bbfd9be826efd549a')
and price_usd > 0 and price > 0 GROUP BY 2,3,4,5,6 ORDER BY DATE )
select avg("hold time ") as "average hold time for traders in day"
from (select
'https://www.nftscan.com/' || NFT_TO_ADDRESS as trader,
'https://www.nftscan.com/0x960b7a6bcd451c9968473f7bbfd9be826efd549a/' ||t1.tokenid as "token id",
datediff('day',MINT_TIME,date) as "hold time "
--T2.price || ' - '||T1.price || ' = ' as "Sale PRICE - bought PRICE (ETH)" ,
--sum (t2.price_usd - t1.price_usd) as USD_Profit
--sum (t2.price - t1.price) as ETH_Profit
from buytable1 t1 join selltable1 t2 on NFT_TO_ADDRESS = seller_address and t1.tokenid = t2.tokenid
WHERE MINT_TIME < DATE
order by 3 asc
)
Run a query to Download Data