LittlerDataUntitled Query
Updated 2022-10-20
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 stole from misaghlb and refurbished by me
with eth_price_tbl as (
select
date(hour) as pdate
,avg(price) as eth_price
from ethereum.core.fact_hourly_token_prices
where symbol = 'WETH'
group by pdate
),
matic_price_tbl as (
select
date(hour) as pdate
,avg(price) as matic_price
from ethereum.core.fact_hourly_token_prices
where symbol = 'MATIC'
group by pdate
),
dai_price_tbl as (
select
date(hour) as pdate
,avg(price) as dai_price
from ethereum.core.fact_hourly_token_prices
where symbol = 'DAI'
group by pdate
)
select
date_trunc('day', block_timestamp) as mdate
,sum(tx_fee*matic_price) as usd_fee
,avg(tx_fee*matic_price) as usd_avg_fee
,'Polygon' as type
from polygon.core.fact_transactions join matic_price_tbl on date(block_timestamp) = pdate
where date(block_timestamp) >= '2022-07-01'
group by mdate
Run a query to Download Data