bachistETH - 3 months
    Updated 2022-06-11
    with pricedtls as (
    select date(hour) as day, avg(price) as price
    from ethereum.core.fact_hourly_token_prices
    where token_address = '0xae7ab96520de3a18e5e111b5eaab095312d7fe84'
    and symbol = 'stETH' and day >= dateadd(month, -3, getdate())
    group by day order by day desc
    ),

    volumedtls as (
    SELECT
    date(block_timestamp) as day,
    sum(amount) as stake_volume,
    avg(amount) as stake_size,
    count(distinct tx_id) as no_of_txns,
    COUNT(DISTINCT origin_address) as stakers_count
    FROM ethereum.udm_events
    WHERE origin_address = from_address
    AND to_address = '0xae7ab96520de3a18e5e111b5eaab095312d7fe84'
    AND event_type = 'native_eth'
    and day >= dateadd(month, -3, getdate())
    GROUP by day
    ORDER by day desc)

    select a.day, round(b.price, 2) as price_usd, round(a.stake_volume, 2) as total_volume, round((a.stake_volume * b.price), 2) as total_volume_usd
    from volumedtls a join pricedtls b on a.day = b.day order by a.day desc
    Run a query to Download Data