vendettaChanges in the number of holders and price fluctuations as a percentage
    Updated 2024-10-29
    with
    MonthlyPriceData as (
    select
    date_trunc('month', hour) as month,
    avg(price) as monthly_price
    from base.price.ez_prices_hourly
    where token_address = '0x04d5ddf5f3a8939889f11e97f8c4bb48317f1938'
    group by month
    ),
    MonthlyHolderData as (
    select
    date_trunc('month', block_timestamp) as month,
    count(distinct from_address) as monthly_holders
    from base.core.ez_token_transfers
    where contract_address = '0x04d5ddf5f3a8939889f11e97f8c4bb48317f1938'
    group by month
    ),
    PriceChangePercentage as (
    select
    month,
    monthly_price,
    (monthly_price - lag(monthly_price) over(order by month)) / lag(monthly_price) over(order by month) * 100 as price_change_pct
    from MonthlyPriceData
    ),
    HolderChangePercentage as (
    select
    month,
    monthly_holders,
    (monthly_holders - lag(monthly_holders) over(order by month)) / lag(monthly_holders) over(order by month) * 100 as holder_change_pct
    from MonthlyHolderData
    )

    select
    PriceChangePercentage.month,
    PriceChangePercentage.price_change_pct,
    HolderChangePercentage.holder_change_pct
    QueryRunArchived: QueryRun has been archived