Query editor
WITHlighter_fees AS (SELECTDATE(from_unixtime(CAST(json_extract_scalar(item, '$[0]') AS bigint))) AS day,CAST(json_extract_scalar(item, '$[1]') AS double) AS lighterFROM (SELECT json_parse(http_get('https://api.llama.fi/summary/fees/lighter')) AS data)CROSS JOIN UNNEST(CAST(json_extract(data, '$.totalDataChart') AS array(json))) AS t(item)WHERE from_unixtime(CAST(json_extract_scalar(item, '$[0]') AS bigint)) >= current_date - interval '365' day),hyperliquid_fees AS (SELECTDATE(from_unixtime(CAST(json_extract_scalar(item, '$[0]') AS bigint))) AS day,CAST(json_extract_scalar(item, '$[1]') AS double) AS hyperliquidFROM (SELECT json_parse(http_get('https://api.llama.fi/summary/fees/hyperliquid')) AS data)CROSS JOIN UNNEST(CAST(json_extract(data, '$.totalDataChart') AS array(json))) AS t(item)WHERE from_unixtime(CAST(json_extract_scalar(item, '$[0]') AS bigint)) >= current_date - interval '365' day),aster_fees AS (SELECTDATE(from_unixtime(CAST(json_extract_scalar(item, '$[0]') AS bigint))) AS day,CAST(json_extract_scalar(item, '$[1]') AS double) AS asterFROM (SELECT json_parse(http_get('https://api.llama.fi/summary/fees/aster')) AS data)CROSS JOIN UNNEST(CAST(json_extract(data, '$.totalDataChart') AS array(json))) AS t(item)WHERE from_unixtime(CAST(json_extract_scalar(item, '$[0]') AS bigint)) >= current_date - interval '365' day),jupiter_fees AS (SELECTDATE(from_unixtime(CAST(json_extract_scalar(item, '$[0]') AS bigint))) AS day,CAST(json_extract_scalar(item, '$[1]') AS double) AS jupiterFROM (SELECT json_parse(http_get('https://api.llama.fi/summary/fees/jupiter-perpetual-exchange')) AS data)CROSS JOIN UNNEST(CAST(json_extract(data, '$.totalDataChart') AS array(json))) AS t(item)WHERE from_unixtime(CAST(json_extract_scalar(item, '$[0]') AS bigint)) >= current_date - interval '365' day),edgex_fees AS (SELECTDATE(from_unixtime(CAST(json_extract_scalar(item, '$[0]') AS bigint))) AS day,CAST(json_extract_scalar(item, '$[1]') AS double) AS edgexFROM (SELECT json_parse(http_get('https://api.llama.fi/summary/fees/edgex')) AS data)CROSS JOIN UNNEST(CAST(json_extract(data, '$.totalDataChart') AS array(json))) AS t(item)WHERE from_unixtime(CAST(json_extract_scalar(item, '$[0]') AS bigint)) >= current_date - interval '365' day),gmx_fees AS (SELECTDATE(from_unixtime(CAST(json_extract_scalar(item, '$[0]') AS bigint))) AS day,CAST(json_extract_scalar(item, '$[1]') AS double) AS gmxFROM (SELECT json_parse(http_get('https://api.llama.fi/summary/fees/gmx')) AS data)CROSS JOIN UNNEST(CAST(json_extract(data, '$.totalDataChart') AS array(json))) AS t(item)WHERE from_unixtime(CAST(json_extract_scalar(item, '$[0]') AS bigint)) >= current_date - interval '365' day)SELECTCOALESCE(l.day, h.day, a.day, j.day, e.day, g.day) AS day,COALESCE(l.lighter, 0) AS lighter,COALESCE(h.hyperliquid, 0) AS hyperliquid,COALESCE(a.aster, 0) AS aster,