alessio9567$LLM Metrics
    Updated 2025-01-24
    -- forked from ahkek76 / pengu price @ https://flipsidecrypto.xyz/ahkek76/q/CUGWjZSWN7Sm/pengu-price

    with api_price AS (
    select response:data:prices as response
    from (
    -- SELECT live.udf_api('https://api.llama.fi/protocol/uniswap-v2') as response
    SELECT livequery.live.udf_api('https://api.coingecko.com/api/v3/coins/large-language-model/market_chart?vs_currency=usd&days=180') as response
    )
    ),
    flatten_cmc_data_price AS (
    SELECT
    *
    FROM api_price, table(flatten(response, ''))),


    final_api_price as (
    select *, TO_TIMESTAMP(CAST(value[0] AS BIGINT) / 1000) AS dt
    from flatten_cmc_data_price
    ),

    api_volume AS (
    select response:data:total_volumes as response
    from (
    -- SELECT live.udf_api('https://api.llama.fi/protocol/uniswap-v2') as response
    SELECT livequery.live.udf_api('https://api.coingecko.com/api/v3/coins/large-language-model/market_chart?vs_currency=usd&days=180') as response
    )
    ),
    flatten_cmc_data_volume AS (
    SELECT
    *
    FROM api_volume, table(flatten(response, ''))),


    final_api_volume as (
    select *, TO_TIMESTAMP(CAST(value[0] AS BIGINT) / 1000) AS dt
    from flatten_cmc_data_volume
    QueryRunArchived: QueryRun has been archived