Query editor
-- https://api.superstate.com/v1/funds/2/nav-dailywith uscc_daily_nav as (SELECTCAST(json_extract_scalar(nav_data, '$.fund_id') AS INTEGER) AS fund_id,date_format(date_parse(json_extract_scalar(nav_data, '$.net_asset_value_date'),'%m/%d/%Y'),'%Y-%m-%d') AS nav_date,CAST(json_extract_scalar(nav_data, '$.net_asset_value') AS DECIMAL(15, 6)) AS nav,CAST(json_extract_scalar(nav_data, '$.assets_under_management') AS DECIMAL(26, 8)) AS aum,CAST(json_extract_scalar(nav_data, '$.outstanding_shares') AS DECIMAL(30, 12)) AS sahres,CAST(json_extract_scalar(nav_data, '$.net_income_expenses') AS DECIMAL(20, 6)) AS net_income_expensesFROM UNNEST(CAST(json_parse(http_get('https://api.superstate.com/v1/funds/2/nav-daily')) AS array(json))) t(nav_data)ORDER BY nav_date DESC),historical_data as (select nav_date, nav, nav - lag(nav, 1) over (order by nav_date) as nav_change_day, nav - lag(nav, 5) over (order by nav_date) as nav_change_week, nav - lag(nav, 30) over (order by nav_date) as nav_change_month, lag(nav, 1) over (order by nav_date) as last_day, lag(nav, 5) over (order by nav_date) as last_week, lag(nav, 30) over (order by nav_date) as last_monthfrom uscc_daily_nav)select nav_date, (nav_change_day / last_day) * 365 as daily, (nav_change_week / last_week) * (365 / 7) as seven_day, (nav_change_month / last_month) * (365 / 30) as thirty_dayfrom historical_data