Query editor
WITH time_series AS (SELECT timeFROM unnest(sequence(date('2024-07-22'), date(NOW()), interval '1' day)) AS s(time)), flows AS (SELECT date_trunc('day', t.block_time) AS time, a.issuer, SUM(CASE WHEN a.inverse_values = true THEN -t.amount ELSE t.amount END) AS flowFROM tokens_ethereum.transfers tINNER JOIN dune.hildobby.dataset_ethereum_etf_addresses a ON a.address = t.toAND a.track_inflow = trueWHERE t.token_standard = 'native'AND t.block_time >= date('2024-07-24')GROUP BY 1, 2UNION ALLSELECT date_trunc('day', t.block_time) AS time, a.issuer, -1 * SUM(CASE WHEN a.inverse_values = true THEN -t.amount ELSE t.amount END) AS flowFROM tokens_ethereum.transfers tINNER JOIN dune.hildobby.dataset_ethereum_etf_addresses a ON a.address = t."from"AND a.track_outflow = trueWHERE t.token_standard = 'native'AND t.block_time >= date('2024-07-24')AND t.block_time <= (SELECT CAST(ethereum AS timestamp) FROM dune.hildobby.dataset_etf_update_thresholds)GROUP BY 1, 2UNION ALLSELECT date_trunc('day', CAST("date" AS timestamp)) AS time, 'Fidelity' AS issuer, -amount AS flowFROM dune.hildobby.dataset_ethereum_etf_fidelity_outflowsUNION ALLSELECT t.block_time, et.issuer, 0 AS flowFROM (unnest(sequence(date('2024-07-22'), date(NOW()), interval '1' day)) AS s(block_time)) tCROSS JOIN (SELECT issuer FROM dune.hildobby.dataset_ethereum_etf_metadata) etUNION ALLSELECT date_trunc('day', t.block_time) AS time, a.issuer, SUM(t.amount) AS flowsFROM tokens_ethereum.transfers tINNER JOIN dune.hildobby.dataset_ethereum_etf_addresses a ON a.address = t."from"LEFT JOIN dune.hildobby.dataset_ethereum_etf_addresses a2 ON a2.address = t.toWHERE a2.address IS NULLAND a.track_outflowAND t.block_time >= date('2025-10-06')AND t.block_time <= (SELECT CAST(ethereum AS timestamp) FROM dune.hildobby.dataset_etf_update_thresholds)GROUP BY 1, 2)