hessAverage Blance
    Updated 2022-11-24
    with voter as ( select trunc(block_timestamp,'hour') as hourly,voter, TX_ID, proposal_id, vote_option, vote_weight
    from osmosis.core.fact_governance_votes
    where TX_STATUS = 'SUCCEEDED'
    and proposal_id = '362')
    ,
    vote as ( select voter , count(DISTINCT(description)) as votes
    from voter a join osmosis.core.dim_vote_options b on a.vote_option = b.vote_id
    where hourly::date >= CURRENT_DATE - 60
    group by 1
    )

    select avg(balance/pow(10,decimal)) as avg , sum(balance/pow(10,decimal)) as total_balance, median(balance/pow(10,decimal)) as median_balance
    from osmosis.core.fact_daily_balances
    where currency ilike '%osmo%'
    and address in (select voter from vote)
    and DATE = '2022-11-20'

    Run a query to Download Data