adambalatp22
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
›
⌄
with buytable1 as (
select (BLOCK_TIMESTAMP) AS MINT_DATE ,BUYER_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('0x8a90CAb2b38dba80c64b7734e58Ee1dB38B8992e')
and price_usd > 0 and price > 0 ),
selltable1 as (
select (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('0x8a90CAb2b38dba80c64b7734e58Ee1dB38B8992e')
and price_usd > 0 and price > 0 )
, c as(select
sum (t2.price_usd - t1.price_usd) as USD_Profit ,
sum (t2.price - t1.price) as ETH_Profit ,
t1.tokenid ,
BUYER_address as trader
from buytable1 t1 join selltable1 t2 on BUYER_address = seller_address and t1.tokenid = t2.tokenid
WHERE MINT_date < DATE
group by 3,4)
select avg (USD_Profit),
avg (ETH_Profit)
from c
Run a query to Download Data