0-MIDnew users
Updated 2024-10-07
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
›
⌄
with tab1 as (
select date_trunc('minute',BLOCK_TIMESTAMP) as time
,FROM_ADDRESS
,FROM_AMOUNT_USD
from thorchain.defi.fact_swaps
where AFFILIATE_ADDRESS='lifi'
and BLOCK_TIMESTAMP::date>=current_date-60
),
tab2 as (
select date_trunc('day',time) as day
,FROM_ADDRESS
,FROM_AMOUNT_USD
,row_number()over(partition by FROM_ADDRESS order by day) as time_row
from tab1
)
select day
,sum(FROM_AMOUNT_USD) as volume
,sum(volume)over(order by day) as total
from tab2
where time_row=1
group by 1
QueryRunArchived: QueryRun has been archived