Avalanche DeFiAvalanche TVL Over Time
    Updated 2024-06-27
    /* select date,
    tvl_usd
    from external.defillama.fact_chain_tvl
    where chain ilike 'Avalanche'
    order by 1 desc */

    WITH api AS (
    SELECT
    livequery.live.udf_api('https://api.llama.fi/v2/historicalChainTvl/Avalanche') AS response
    )
    SELECT


    IFNULL(VALUE:"tvl", 0) AS tvl,
    TO_VARCHAR(TO_TIMESTAMP(VALUE:"date"), 'YYYY-MM-DD') AS date
    FROM
    api,
    LATERAL FLATTEN(response:data)
    order by 2 desc

    Auto-refreshes every 6 hours
    QueryRunArchived: QueryRun has been archived