mattkstew1 FLOW OA
Updated 2023-06-03Copy 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 tab1 as (
select
buyer,
nft_collection,
nft_ID,
price as buy_price,
1 AS is_buyer
FROM flow.core.ez_nft_sales
where block_timestamp > current_date - 90
)
, tab2 as (
select
seller,
nft_collection,
nft_ID,
price as sell_price,
0 AS is_buyer
FROM flow.core.ez_nft_sales
where block_timestamp > current_date - 90
)
, tab3 as (
select
buyer,
sum(sell_price - buy_price) as net_profit
from tab1 left outer join tab2
on buyer = seller and tab1.nft_id = tab2.nft_id
group by 1
)
select
COUNT_IF(Net_Profit > 0) AS "Profitable Traders",
COUNT_IF(Net_Profit < 0) AS "Non-Profitable Traders",
Run a query to Download Data