Arashhwrap 5
Updated 2023-02-21Copy 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
30
31
32
33
›
⌄
with price as
(select
case
when id='moonbeam' then 'wglmr-wei'
when id='wmatic' then 'wmatic-wei'
when id='avalanche-2' then 'wavax-wei'
when id='bitcoin' then 'wbtc-satoshi'
when id='fantom' then 'wftm-wei'
when id='oec-binance-coin' then 'wbnb-wei'
when id='ethereum' then 'weth-wei'
end as token , avg(CLOSE) as price ,
date_trunc('day',RECORDED_HOUR ) as date
from
crosschain.core.fact_hourly_prices
where
ID in ('moonbeam','wmatic','avalanche-2','bitcoin','fantom','oec-binance-coin','ethereum')
group by 1,3
)
select
sum ((AMOUNT/pow(10,DECIMAL))*price ) as volume ,
date_trunc(day,BLOCK_TIMESTAMP) as date, CURRENCY
from axelar.core.fact_transfers a inner join price b on a.CURRENCY=b.token
where
((AMOUNT/pow(10,DECIMAL))*price)<2000000 AND substr(CURRENCY,1,1)='w' and TRANSFER_TYPE='IBC_TRANSFER_OUT'
group by 2,3
Run a query to Download Data