mattkstewPolygon Fees 4
Updated 2022-07-07Copy 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
›
⌄
with tab1 as (
select
date_trunc('day', block_timestamp) as date1,
avg(tx_fee) as poly_fee
from polygon.core.fact_transactions
where block_timestamp > '2022-07-01'
group by 1 )
, tab_MATIC_PRICE as (
select
date_trunc('day', hour) as date2,
avg(price) as MATIC_Price
from ethereum.core.fact_hourly_token_prices
where symbol like 'MATIC'
and hour > '2022-07-01'
group by 1 )
, tab_ETH_PRICE as (
select
date_trunc('day', hour) as date11,
avg(price) as ETH_Price
from ethereum.core.fact_hourly_token_prices
where symbol like 'WETH'
and hour > '2022-07-01'
group by 1 )
, tab_Poly_Fees as (
select
date1,
MATIC_Price * poly_fee as Polygon_Fees
from tab1 left outer join tab_MATIC_PRICE on date1 = date2 )
, tab2 as (
select
Run a query to Download Data