tomingtop 10 trader with most profit copy
Updated 2024-07-22
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
›
⌄
-- forked from saber-jl / top 10 trader with most profit @ https://flipsidecrypto.xyz/saber-jl/q/Ha01iUHBkDYH/top-10-trader-with-most-profit
with buyers as (
select
ORIGIN_FROM_ADDRESS as buyer,
AMOUNT_OUT as Buy_Volume,
AMOUNT_IN as Buy_Cost,
from ethereum.defi.ez_dex_swaps
where TOKEN_OUT = '0x38e382f74dfb84608f3c1f10187f6bef5951de93'
and SYMBOL_IN = 'WETH'
and EVENT_NAME = 'Swap'
and BLOCK_NUMBER < 19020778
),
sellers as (
select
ORIGIN_FROM_ADDRESS as seller,
AMOUNT_IN as Sell_Volume,
AMOUNT_OUT as Sell_Income
from ethereum.defi.ez_dex_swaps
where TOKEN_IN = '0x38e382f74dfb84608f3c1f10187f6bef5951de93'
and SYMBOL_OUT = 'WETH'
and EVENT_NAME = 'Swap'
and BLOCK_NUMBER < 19020778
)
SELECT
buyer,
sum(Sell_Income) - sum(Buy_Cost) as trade_Profit,
(sum(Sell_Income) - sum(Buy_Cost))/sum(Buy_Cost) as profit_rate,
sum(Sell_Volume)/sum(Buy_Volume) as selled_rate
from buyers b left outer join sellers s on buyer = seller
group by 1
having trade_Profit > 0
QueryRunArchived: QueryRun has been archived