drone-mostafaUntitled Query
    Updated 2022-06-15
    with eth_prices as (
    select
    trunc(hour,'day') as date,
    avg(price) as eth_price
    from ethereum.token_prices_hourly
    where symbol = 'WETH'
    and hour::date >= current_date - 180
    group by 1
    ),
    lido_stakes as (
    select
    block_timestamp::date as date,
    count(distinct tx_id) as Total_Stakes,
    sum(amount) as Total_Amount
    from ethereum.udm_events
    where to_address = '0xae7ab96520de3a18e5e111b5eaab095312d7fe84'
    and symbol = 'ETH'
    and block_timestamp::date >= current_date - 180
    and amount is not null
    group by 1
    )
    select
    l.date,
    eth_price as "ETH Price",
    Total_Amount as "Total Staked"
    from eth_prices p , lido_stakes l
    where l.date = p.date
    group by 1,2,3
    Run a query to Download Data