Query editor
WITH time_series AS (SELECT timeFROM (unnest(sequence(date('2017-12-11'), date(NOW()), interval '1' day)) AS s(time))--WHERE time >= date_trunc('day', NOW() - interval '3' month)), etf_outflows AS (SELECT t.block_number, t.block_time, a.issuer, a.address, t.tx_hash, SUM(t.amount) AS amountFROM 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')GROUP BY 1, 2, 3, 4, 5), 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('2017-10-16')--AND t.block_time <= (SELECT CAST(ethereum AS timestamp) AS time_limit FROM dune.hildobby.dataset_etf_update_thresholds)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('2017-10-16')AND t.block_time <= (SELECT CAST(ethereum AS timestamp) AS time_limit FROM dune.hildobby.dataset_etf_update_thresholds)GROUP BY 1, 2UNION ALLSELECT 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