shadabwif dist copy
    Updated 2024-03-13
    -- forked from Moe / wif dist @ https://flipsidecrypto.xyz/Moe/q/MsIo8Jhk5pu3/wif-dist

    with prc as (
    select
    RECORDED_HOUR::date days ,
    avg(close) as price
    from solana.price.ez_token_prices_hourly
    where
    token_address ilike 'EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm'
    group by 1
    ),
    middle as (
    select
    tx_id,
    swapper,
    (swap_to_amount)*price as USD_Volume

    from solana.defi.fact_swaps sw
    inner join prc pr on sw.block_timestamp::date = pr.days
    where
    SWAP_TO_MINT = 'EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm'

    and
    swap_to_amount is not null
    and
    swap_to_amount > 0
    and block_timestamp::date >= CURRENT_DATE - 90
    )
    select
    case
    when USD_Volume < 10 then ' less than 10 USD'
    when USD_Volume between 10
    and 99.99 then ' 10 - 100 USD'
    when USD_Volume between 100
    and 499.99 then ' 100 - 500 USD'
    QueryRunArchived: QueryRun has been archived