mattkstewPRI Transfers 2
Updated 2023-01-17Copy Reference Fork
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
›
⌄
with tab1 as (
select
date_trunc('day', RECORDED_HOUR) as date1,
avg(close) as LUNA_PRICE
from crosschain.core.fact_hourly_prices
where id like 'terra-luna-2'
and RECORDED_HOUR > '2023-01-01'
group by 1 )
, tab2 as (
select
date_trunc('day', block_timestamp) as date2,
case when transfer_type like 'IBC_Transfer_Off' then 'Transfer Off'
else 'Transfer In'
end as Transfer_direction,
sum(amount/1e6) as amount
from terra.core.ez_transfers
where currency like 'uluna'
and block_timestamp > '2023-01-01'
group by 1,2 )
select
date1,
Transfer_direction,
amount * LUNA_PRICE as Volume
from tab1 left outer join tab2 on date1 = date2
Run a query to Download Data