mucrypto2023-08-26 01:55 AM test
    Updated 2023-08-26
    with resps as
    (select defillama.get('/protocols', {}) as resp),

    cex as (
    select
    value:category::string as category,
    value:tvl::number as tvl
    from resps,
    lateral flatten (input => resp:data))

    select
    sum(tvl)
    from cex
    where category in ('Lending', 'Dexes', 'CDP', 'Derivatives', 'Launchpad', 'Cross Chain'
    , 'Synthetics', 'Indexes', 'Privacy', 'Insurance', 'Payments', 'NFT Lending',
    'Algo-Stables', 'Leveraged Farming', 'NFT Marketplace', 'Options', 'Services',
    'Uncollateralized Lending', 'Prediction Market', 'Options Vault', 'Farm', 'Yield',
    'Reserve Currency', 'RWA Lending', 'Gaming', 'Liquidity Manager', 'Oracle')
    Run a query to Download Data