anomoneAverage gas fee per day
Updated 2022-02-03
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
›
⌄
⌄
/*SELECT c.symbol as "main symbol", a.* , b.function_name , avg(gas_limit), avg(gas_price)/1e9, avg(gas_limit)* avg(gas_price)/1e18 as calc_fee_in_eth , b.gas_price, b.gas_used, avg(b.fee_usd) ,b.symbol, b.tx_fee FROM ethereum.dex_swaps a
INNER JOIN ethereum.transactions b
ON a.tx_id = b.tx_id
LEFT JOIN (SELECT DISTINCT TOKEN_ADDRESS , SYMBOL FROM ethereum.token_prices_hourly ) c
ON a.TOKEN_ADDRESS = c.TOKEN_ADDRESS
WHERE platform = 'uniswap-v3'
AND a.TOKEN_ADDRESS = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
*/
SELECT date_trunc('day',block_timestamp) as day,
CASE WHEN (TO_LABEL= 'sushiswap' or FROM_LABEL = 'sushiswap' )THEN 'Suhiswap' ELSE 'Uniswap' END as "Platform",
avg(tx_fee) as "Avg Gas Fee in ETH" , avg(fee_usd) as "Avg Gas Fee in USD" FROM ethereum.transactions
where --tx_id = '0x477628c71e27abee051ac19b7e3d4bda87797f1bd843d21ae1c90221ceb9011e'
(TO_LABEL= 'sushiswap' or FROM_LABEL = 'sushiswap' or TO_LABEL= 'uniswap' or FROM_LABEL = 'uniswap' )
AND block_timestamp >= getdate() - interval'60 days'
GROUP BY
date_trunc('day',block_timestamp) ,
CASE WHEN (TO_LABEL= 'sushiswap' or FROM_LABEL = 'sushiswap' )THEN 'Suhiswap' ELSE 'Uniswap' END