djebril2023-08-25 06:40 PM
Updated 2023-08-25
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
hour::date as date,
token_address,
avg(price) as usdprice
from ethereum.core.fact_hourly_token_prices
group by 1,2
)
,
main as (
select
tX_hash,
block_timestamp,
symbol,
amount_paid*usdprice as usd_amount,
payer as user
from ethereum.maker.ez_repayments
join pricet on trunc(block_timestamp,'day')=pricet.date and token_paid=token_address
where TX_STATUS = 'SUCCESS'
),
main2 as (
select
user,
count(distinct block_timestamp::date) as active_days,
datediff('day',min(block_timestamp),to_date(current_date)) as age,
count(distinct tx_hash) as transactions,
sum(usd_amount) as volume_usd
from main
group by 1
)
select
Run a query to Download Data