ben-wyattoptimism-tx-value-graph
Updated 2025-01-27
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
›
⌄
-- forked from Avalanche-tx-value-graph @ https://flipsidecrypto.xyz/studio/queries/8133a2f0-f254-4096-b62e-2e369ad89ebb
-- grabs transactions, joins on hourly price data
-- "Large" transactions are > $100k
-- Make sure to check what the token of account for the fact_transactions.value column is.
WITH transaction_data AS (
SELECT
value as native_value,
block_timestamp,
DATE_TRUNC('hour', block_timestamp) AS rounded_hour,
from_address
FROM
optimism.core.fact_transactions
WHERE
block_timestamp BETWEEN '2022-01-01' AND '2024-12-31 23:59:59'
),
price_data AS (
SELECT
symbol,
price,
hour
FROM
optimism.price.ez_prices_hourly
WHERE
symbol = 'ETH' and
hour BETWEEN '2022-01-01' AND '2024-12-31 23:59:59'
),
transactions_with_prices AS (
SELECT
t.native_value,
t.rounded_hour,
t.from_address,
p.price,
t.native_value * COALESCE(p.price, 0) AS usd_value,
DATE_TRUNC('month', t.rounded_hour) AS rounded_month,
CASE
QueryRunArchived: QueryRun has been archived