ArioGas Guzzlers - MATIC - 3
Updated 2022-11-16Copy 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
›
⌄
with MATIC_Price as (
select
hour::date as date,
avg(price) as MATIC_Price
from ethereum.core.fact_hourly_token_prices
where symbol = 'MATIC'
group by 1
),
Transfer as (
select
block_timestamp::date as date,
sum(amount_usd) as Transfer
from polygon.core.ez_matic_transfers
where block_timestamp >= CURRENT_DATE - 30
group by 1
),
tab3 as (
select
block_timestamp::date as date,
sum(tx_fee * MATIC_Price) as USD_Gas
from polygon.core.fact_transactions a join MATIC_Price b on a.block_timestamp::Date = b.date
where block_timestamp >= CURRENT_DATE - 30
and status = 'SUCCESS'
group by 1
)
select
a.date,
a.USD_Gas/b.Transfer * 1e6 as average_per_1M
from tab3 a join Transfer b on a.date = b.date
Run a query to Download Data