Skip to content

Instantly share code, notes, and snippets.

@askeluv
Created August 27, 2021 02:43
Show Gist options
  • Save askeluv/0db353340222c05dad0a3424514662e0 to your computer and use it in GitHub Desktop.
Save askeluv/0db353340222c05dad0a3424514662e0 to your computer and use it in GitHub Desktop.
WITH
aggregated as (
SELECT
TIMESTAMP_SECONDS(300 * DIV(UNIX_SECONDS(block_timestamp) + 150, 300)) AS dt,
CASE
WHEN transaction_type = 2 THEN 1.0
ELSE 0.0
END as pct_1559
from `bigquery-public-data.crypto_ethereum.transactions`
where block_timestamp >= timestamp_sub(current_timestamp(), INTERVAL 24 HOUR)
)
select
dt,
AVG(pct_1559) AS pct_1559
from aggregated
group by 1
order by 1 DESC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment