Query editor
with a as(SELECTfrom_unixtime(CAST(item['date'] AS double)) AS date,CAST(item['tvl'] AS double) AS tvlFROM UNNEST(CAST(json_parse(HTTP_GET('https://api.llama.fi/v2/historicalChainTvl/KAIA')) AS ARRAY(MAP(VARCHAR, JSON)))) AS t (item)WHERE from_unixtime(CAST(item['date'] AS double)) >= TIMESTAMP '2024-08-29'),b as (select date_trunc('day', minute) as date, avg(price) as pricefrom prices.usdwhere symbol = 'KAIA' and blockchain is null -- replace here to identify your chain's tokenand minute < date_trunc('day', now()) -- today is not done yetand minute > date_trunc('day', date('2024-08-29'))group by 1)select a.*, b.pricefrom aleft join b on a.date = b.date