SalehTime-Stake
    Updated 2025-02-19
    with lst_price as (
    select
    hour::date as price_date
    ,avg(price) as BRRR_Price
    from near.price.ez_prices_hourly
    where symbol = 'BRRR'
    and hour::date>='2022-04-05'
    group by 1
    )
    ,lst_price_last as (
    select top 1
    hour::date as price_date
    ,avg(price) as BRRR_Price
    from near.price.ez_prices_hourly
    where symbol = 'BRRR'
    and hour::date>='2022-04-05'
    group by 1
    order by hour::date desc
    )
    ,lst_BRRR_price as (
    with BRRR_api as (
    select livequery.live.udf_api(
    'GET',
    'https://api.nearblocks.io/v1/fts/token.burrow.near'
    ,{'accept': 'application/json'}, {}) as response
    )
    ,tokens_raw as (
    select
    value:price as BRRR_price
    from
    BRRR_api,
    LATERAL FLATTEN (input => response:data:contracts))
    select * from tokens_raw
    )
    ,lst_stake as (
    select
    QueryRunArchived: QueryRun has been archived