ArioVertex - Weekly trading volume and traders by type
Updated 2024-09-27
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 main as (
SELECT
'Spot' as Type,
block_timestamp,
TRADER,
tx_hash,
AMOUNT_USD,
FEE_AMOUNT
from arbitrum.vertex.ez_spot_trades
where IS_TAKER = 'TRUE'
union all
SELECT
'Perp' as Type,
block_timestamp,
TRADER,
tx_hash,
AMOUNT_USD,
FEE_AMOUNT
from arbitrum.vertex.ez_perp_trades
where IS_TAKER = 'TRUE'
)
select
date_trunc(week, block_timestamp) as date,
count(DISTINCT case when Type = 'Spot' then TRADER end) as "Spot Trader",
count(DISTINCT case when Type = 'Perp' then TRADER end) as "Perp Trader",
"Spot Trader" + "Perp Trader" as "Total # Traders",
count(DISTINCT case when Type = 'Spot' then tx_hash end) as "Spot Trade",
count(DISTINCT case when Type = 'Perp' then tx_hash end) as "Perp Trade",
"Spot Trade" + "Perp Trade" as "Total # Trades",
sum(case when Type = 'Spot' then zeroifnull(AMOUNT_USD) end) as "Spot Volume",
sum(case when Type = 'Perp' then zeroifnull(AMOUNT_USD) end) as "Perp Volume",
sum(zeroifnull(AMOUNT_USD)) as "Total Trading Volume",
sum(case when Type = 'Spot' then zeroifnull(FEE_AMOUNT) end) as "Spot Fee",
sum(case when Type = 'Perp' then zeroifnull(FEE_AMOUNT) end) as "Perp Fee",
QueryRunArchived: QueryRun has been archived