sherrydUntitled Query
    Updated 2022-07-20
    select
    nf_token_id, pool_address, pool_name, liquidity_provider,
    case
    when last_value(liquidity_adjusted) over
    (partition by nf_token_id, pool_address, pool_name order by block_id asc) = 0
    then block_id end closed_block,
    last_value(block_id) over
    (partition by nf_token_id, pool_address, pool_name order by block_id desc) opened_block,
    tick_lower, tick_upper,
    row_number() over (partition by nf_token_id, pool_address, pool_name order by block_id desc) row_number
    from uniswapv3.positions
    where BLOCK_TIMESTAMP>'2022-07-20'
    and NF_TOKEN_ID = '271787'

    select *
    , last_value(liquidity_adjusted) over
    (partition by nf_token_id, pool_address, pool_name order by block_id desc) number
    from uniswapv3.positions where NF_TOKEN_ID = '271787'


    select * from uniswapv3.pool_stats limit 100

    select pool_address, date(block_timestamp) as day, max(block_id) block_id, avg(tick) tick
    from uniswapv3.pool_stats
    where BLOCK_TIMESTAMP > '2022-07-18'
    group by 1,2

    select * from uniswapv3.positions where BLOCK_TIMESTAMP>'2022-07-20' and nf_token_id = '203092'