MLDZMNToken Flow- TVL
    Updated 2024-03-21
    WITH
    base AS (
    SELECT
    livequery.live.udf_api (
    'https://api.llama.fi/v2/historicalChainTvl/Ethereum'
    ) AS response
    ),

    base2 as (
    select
    to_date(tvl.value:date::string) as date,
    tvl.value:tvl as TVL -- This TVL excluding liquid staking according to Defillama
    from base
    join lateral flatten (input => response:data) tvl
    ),

    TVL2 as (select
    DATE,
    TVL_USD -- This TVL contains liquid staking too
    from external.defillama.fact_chain_tvl
    where CHAIN= 'Ethereum'
    and DATE>='{{Start_date}}')

    select
    base2.date as day,
    TVL, -- This TVL excluding liquid staking according to Defillama
    TVL_USD -- This TVL contains liquid staking too

    from base2
    left join tvl2 on base2.date=tvl2.DATE
    where base2.date >='{{Start_date}}'

    QueryRunArchived: QueryRun has been archived