tomwanhhDeFi TVL
    Updated 2023-11-15
    select *,round(tvl/sum(tvl) over (order by date)*100,2) as tvl_market_share from (
    SELECT
    date,
    case
    when chain in ('Ethereum','Arbitrum Nova', 'Polygon zkEVM', 'Arbitrum',
    'zkSync','Scroll','Base', 'zkSync Era', 'Mantle', 'Optimism', 'Linea', 'Starknet', 'Polygon' )
    then 'Ethereum Ecosystem'
    when chain in ('Solana', 'Tron') then chain
    when chain = 'Binance' then 'BSC'
    when chain in
    ('Kava', 'Cronos', 'Neutron', 'Osmosis', 'Thorchain', 'Kujira',
    'Cosmoshub', 'Cosmos', 'Canto', 'Injective', 'Evmos', 'Secret', 'Terra2', 'Umee', 'Injective', 'Sei')
    then 'Cosmos Ecosystem'
    else 'Others'
    end as chain,
    sum(tvl_usd) as tvl
    from external.defillama.fact_chain_tvl
    where tvl_usd is not null
    and date>= date('2023-01-01')
    group by 1,2)a

    Run a query to Download Data