Query editor
WITH json_data AS (SELECT json_parse(http_get('https://api.llama.fi/overview/derivatives')) AS parsed_data),total_data_chart_breakdown AS (SELECT json_extract(parsed_data, '$.totalDataChartBreakdown') AS breakdown_arrayFROM json_data),unnested_data AS (SELECTfrom_unixtime(CAST(json_extract_scalar(item, '$[0]') AS bigint)) AS day,json_extract(item, '$[1]') AS product_volumes_jsonFROM total_data_chart_breakdownCROSS JOIN UNNEST(CAST(json_extract(breakdown_array, '$') AS array(json))) AS t(item)),expanded_data AS (SELECTdate_trunc('day', day) AS day_date,key AS product_name,CAST(value AS double) AS volumeFROM unnested_dataCROSS JOIN UNNEST(CAST(product_volumes_json AS map(varchar, double))) AS t(key, value)WHERE key IN ('Hyperliquid Perps', 'Aster Perps')),filtered_data AS (SELECTday_date AS day,product_name,volumeFROM expanded_dataWHERE day_date >= CURRENT_DATE - INTERVAL '90' DAYAND day_date < CURRENT_DATEAND volume > 0)SELECTday,product_name,volumeFROM filtered_dataORDER BY day DESC, product_name;