adambalaApetimism
Updated 2022-09-02Copy Reference Fork
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 buytable as (
select buyer_address as Buyers,
count (distinct tx_hash),
count (distinct tokenid) as Tokens_Count,
sum (price_usd) as USD_Value,
sum (price) as ETH_Value
FROM optimism.core.ez_nft_sales
where platform_name = 'quixotic' and EVENT_TYPE = 'sale' and CURRENCY_SYMBOL = 'ETH' and NFT_ADDRESS='0x51e5426ede4e2d4c2586371372313b5782387222'and price_usd > 0 and price > 0
group by 1),
selltable as (
select seller_address as Seller,
count (distinct tx_hash),
count (distinct tokenid) as Tokens_Count,
sum (price_usd) as USD_Value,
sum (price) as ETH_Value
FROM optimism.core.ez_nft_sales
where platform_name = 'quixotic' and EVENT_TYPE = 'sale' and CURRENCY_SYMBOL = 'ETH' and NFT_ADDRESS='0x51e5426ede4e2d4c2586371372313b5782387222'and price_usd > 0 and price > 0
group by 1),
maintable as (
select buyers as Trader,
sum (t2.usd_value - t1.usd_value) as USD_Profit,
sum (t2.ETH_Value - t1.ETH_Value) as ETH_Profit
from buytable t1 join selltable t2 on buyers = seller
group by 1)
select case when usd_profit > 0 and usd_profit < 10 then 'Less Than $10 Profit'
when usd_profit >= 10 and usd_profit < 100 then '$10 - $100 Profit'
when usd_profit >= 100 and usd_profit < 1000 then '$100 - $1000 Profit'
when usd_profit >= 1000 and usd_profit < 10000 then '$1000 - $10000 Profit'
when usd_profit >= 10000 then 'More Than $10000 Profit'
when usd_profit < 0 and usd_profit > -10 then 'Less Than $10 Loss'
when usd_profit <= -10 and usd_profit > -100 then '$10 - $100 Loss'
when usd_profit <= -100 and usd_profit > -1000 then '$100 - $1000 Loss'
when usd_profit <= -1000 and usd_profit > -10000 then '$1000 - $10000 Loss'
Run a query to Download Data