CartanGroupAptos 1
Updated 2024-10-14
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 pdate,
value[1] as 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)),
newt as (
select
date_trunc('day', min_date) as fdate,
count(distinct new_user) as new_users
from(
select
distinct sender as new_user,
min(block_timestamp::date) as min_date
from aptos.core.fact_transactions
where
--tx_type = 'user_transaction'
--and
success = 'true'
group by 1
)
group by 1
order by 1 asc
),
txt AS (
SELECT
date_trunc('day', block_timestamp) AS date,
count(distinct TX_HASH) AS txs,
count(distinct sender) AS users,
sum((gas_used * gas_unit_price) / pow(10, 8)) AS fee_apt,
sum((gas_used * gas_unit_price * price) / pow(10, 8)) AS fee_usd,