hessNew Edit - Averages
    Updated 2024-06-03
    with token_bonk as ( Select VALUE:"DECIMAL" as decimal,
    value:"TOKEN_ADDRESS" as token_address,
    value:"TOKEN_NAME" as token_name
    from (
    SELECT livequery.live.udf_api(
    'https://flipsidecrypto.xyz/api/v1/queries/afb49a72-5616-4521-bc64-019467ed698b/data/latest') as resp
    )
    ,LATERAL FLATTEN (input => resp:data))
    ,
    price as ( select hour, case when symbol = 'WETH' then 'ETH' else symbol end as token, avg(price) as avg_price
    from ethereum.price.ez_hourly_token_prices
    where hour::date >= '2023-08-15'
    and symbol in ('WETH','WBTC')
    group by 1,2
    UNION
    select RECORDED_HOUR as hour, symbol as token, avg(price) as avg_price
    from osmosis.price.ez_prices
    where symbol in ('ATOM','OSMO')
    and RECORDED_HOUR::date >= '2023-08-15'
    group by 1,2
    UNION
    Select trunc(TO_TIMESTAMP(value[0]::string),'hour') as hour, 'SEI' as token, avg(value[1]) as avg_price
    from (
    SELECT livequery.live.udf_api(
    'https://api.coingecko.com/api/v3/coins/sei-network/market_chart?vs_currency=usd&days=90') as resp
    )
    ,LATERAL FLATTEN (input => resp:data:prices)
    group by all
    UNION
    Select trunc(TO_TIMESTAMP(value[0]::string),'hour') as hour, 'SEIYAN' as token, avg(value[1]) as avg_price
    from (
    SELECT livequery.live.udf_api(
    'https://api.coingecko.com/api/v3/coins/seiyan/market_chart?vs_currency=usd&days=90') as resp
    )
    ,LATERAL FLATTEN (input => resp:data:prices)
    group by all
    Auto-refreshes every 12 hours
    QueryRunArchived: QueryRun has been archived