Updated 2024-07-22
    with near AS (
    select
    livequery.live.udf_api(
    'GET',
    'https://api.llama.fi/v2/historicalChainTvl/near',
    { 'content-type': 'application/json;charset=utf-8' },
    { }
    ) as response
    ),

    aptos AS (
    select
    livequery.live.udf_api(
    'GET',
    'https://api.llama.fi/v2/historicalChainTvl/aptos',
    { 'content-type': 'application/json;charset=utf-8' },
    { }
    ) as response
    )



    SELECT
    to_timestamp(value:date) AS day,
    value:tvl AS tvl,
    'Near' AS chain_name
    FROM
    near,
    LATERAL FLATTEN (input => response:data)
    WHERE to_timestamp(value:date) >= '2024-01-01'

    UNION

    SELECT
    to_timestamp(value:date) AS day,
    value:tvl AS tvl,
    Auto-refreshes every 1 hour
    QueryRunArchived: QueryRun has been archived