adambalatp11
Updated 2022-10-03
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 buytable1 as (
select NFT_TO_ADDRESS ,TOKENID ,MINT_PRICE_ETH ,MINT_PRICE_USD ,tx_hash ,BLOCK_TIMESTAMP::DATE AS MINT_TIME
from ethereum.core.ez_nft_mints
where NFT_ADDRESS='0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d'
and EVENT_TYPE ='nft_mint'
and PROJECT_NAME='boredapeyachtclub'
and NFT_FROM_ADDRESS='0x0000000000000000000000000000000000000000'
and MINT_PRICE_ETH > 0 and MINT_PRICE_USD > 0),
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('0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d')
and price_usd > 0 and price > 0 GROUP BY 2,3,4,5,6 ORDER BY DATE )
,table1 AS (select
NFT_TO_ADDRESS,
t1.tokenid,
sum (t2.price_usd - t1.MINT_PRICE_USD) as USD_Profit,
sum (t2.price - t1.MINT_PRICE_ETH) as ETH_Profit
from buytable1 t1 join selltable1 t2 on NFT_TO_ADDRESS = seller_address and t1.tokenid = t2.tokenid
WHERE MINT_TIME < (SELECT MIN(DATE) FROM selltable1 ) AND NFT_TO_ADDRESS !='0xd387a6e4e84a6c86bd90c158c6028a58cc8ac459'
group by 1,2
order by 3 DESC
)
select case when ETH_Profit > 0 and ETH_Profit < 0.01 then 'Less Than 0.01 ETH Profit'
when ETH_Profit >= 0.01 and ETH_Profit < 0.1 then '0.01 - 0.1 ETH Profit'
when ETH_Profit >= 0.1 and ETH_Profit < 1 then '0.1 - 1 ETH Profit'
when ETH_Profit >= 1 and ETH_Profit < 2 then '1 - 2 ETH Profit'
when ETH_Profit >= 2 then 'More Than 2 ETH Profit'
when ETH_Profit < 0 and ETH_Profit > 0.01 then 'Less Than 0.01 ETH Loss'
when ETH_Profit <= -0.01 and ETH_Profit > -0.1 then '0.01 - 0.1 ETH Loss'
when ETH_Profit <= -0.1 and ETH_Profit > -1 then '0.1 - 1 ETH Loss'
Run a query to Download Data