0-MIDday hours poly
Updated 2024-07-12
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 BLOCK_TIMESTAMP::date as date
,TX_HASH
from polygon.core.ez_decoded_event_logs
where ORIGIN_TO_ADDRESS='0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae'
and EVENT_NAME='LiFiGenericSwapCompleted'
and DECODED_LOG:integrator='robinhood'
),
tab2 as (
select BLOCK_TIMESTAMP
,TX_HASH
,TX_FEE
,GAS_USED
,GAS_PRICE/1e9 as GAS_PRICE
,CUMULATIVE_GAS_USED
--,MAX_FEE_PER_GAS/1e9 as max_gas_price
from polygon.core.fact_transactions
where STATUS='SUCCESS'
)
select --dayname(tab2.date) as week_days
DATE_PART(hour,BLOCK_TIMESTAMP) as "Hour"
,avg(TX_FEE) as network_fee
,avg((CUMULATIVE_GAS_USED-GAS_USED)*GAS_PRICE) as protocol_fee
,avg(CUMULATIVE_GAS_USED*GAS_PRICE) as total_fee_paid
from tab1
left join tab2
on tab1.TX_HASH=tab2.TX_HASH
group by 1
QueryRunArchived: QueryRun has been archived