mamad-5XN3k3Aptos CEX 4
Updated 2024-08-06
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 pricet as (
SELECT
TO_TIMESTAMP(value[0]::string) as p_date,
'APT' as symbol,
value[1] as usd_price
from (
SELECT livequery.live.udf_api(
'https://api.coingecko.com/api/v3/coins/aptos/market_chart?vs_currency=usd&days=90&interval=daily&precision=3') as resp)
,LATERAL FLATTEN (input => resp:data:prices)
WHERE p_date >= Current_date() - 90
),
cext as (
SELECT
DISTINCT ADDRESS ,
ADDRESS_NAME
FROM aptos.core.dim_labels
where LABEL_TYPE = 'cex'
and LABEL_SUBTYPE = 'hot_wallet'
)
select
--distinct ADDRESS_NAME,
count(DISTINCT TX_HASH) as txs,
count(DISTINCT user) as users,
sum(case when type = 'OutFlow' then vol else 0 end) as outflows,
sum(case when type = 'InFlow' then vol else 0 end) as InFlows,
sum(vol) as amount,
sum(usd_vol) as usd_amount
from(
SELECT
'OutFlow' as type,
--rtrim(BLOCK_TIMESTAMP::date) as date,
ADDRESS_NAME,
TX_HASH,
QueryRunArchived: QueryRun has been archived