Popex404$Matic price per hour - cryptokevo
Updated 2022-07-09Copy 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
34
35
36
›
⌄
-- table provided by cryptokevo, thanks n-n
With Matic_In as (select date_trunc('hour', block_timestamp) AS date, avg(Amount_Out/Amount_In) as Matic_Price
from ethereum.core.ez_dex_swaps
Where Symbol_in = 'MATIC'
and (symbol_out ='USDT' or symbol_out ='USDC' ) AND
Block_Timestamp between '2022-07-01 00:00:00.000' and CURRENT_Timestamp
group By date
order by date DESC),
Matic_Out as (
select date_trunc('hour', block_timestamp) AS date, avg(Amount_in/Amount_out) as Matic_Price
from ethereum.core.ez_dex_swaps
Where Symbol_out = 'MATIC'
and (symbol_in ='USDT' or symbol_in ='USDC' ) AND
Block_Timestamp between '2022-07-01 00:00:00.000' and CURRENT_Timestamp
group By date
order by date DESC
),
all_chart as (
select * from Matic_In
union
select * from Matic_out
), working as (
select date, Avg(Matic_Price)
from All_chart
group by date
order by date),
ez_matic as (
select date_trunc('hour', block_timestamp) AS date, avg(Amount_USD/Amount) as Matic_Price
from polygon.core.ez_matic_transfers
where Amount > 0 and Amount_USD >0 and
Block_Timestamp between '2022-07-01 00:00:00.000' and CURRENT_Timestamp
group by DATE
order by date)
,merge as (
select * from ez_matic
Run a query to Download Data