theericstone⚡️ Get Historical MCAP + Price Snapshots via LiveQuery
    Updated 2024-08-12
    -- forked from ⚡️ Get Current MCAP + Price Snapshots via LiveQuery
    -- @ https://flipsidecrypto.xyz/edit/queries/dff633bc-4eae-46fe-80a3-47d27e1f8b72

    -- Coingecko 🤝 Flipside LiveQuery Function
    -------------------------------------------------------------------------

    with response as (
    SELECT live.udf_api(
    'GET',
    'https://api.coingecko.com/api/v3/coins/list',
    {'x-cg-demo-api-key':'{apikey}'},
    {},
    'coingecko') as resp
    ),
    tokens as (
    select
    value:id::string as id,
    value:name::string as name,
    value:symbol::string as symbol
    from response,
    lateral flatten (input => resp:data)
    )
    select * from tokens
    where name ilike any (
    'bitcoin','ethereum','solana',
    'avalanche','axelar','sei',
    'aptos','arbitrum','base',
    'blast','cosmos','flow',
    'near protocol','optimism','polygon',
    'sui','thorchain','klaytn'
    )


    QueryRunArchived: QueryRun has been archived