keshanCopy of sold POEPLE
    Updated 2022-01-25
    select from_address as address, sum(amount) as amount_sold, sum(usd_value) as usd_sold
    from
    (select from_address, amount, (ethereum.udm_events.amount * ethereum.token_prices_hourly.price) as usd_value
    from ethereum.udm_events
    inner join ethereum.token_prices_hourly
    on ethereum.token_prices_hourly.hour = date_trunc('hour', ethereum.udm_events.block_timestamp)
    and ethereum.token_prices_hourly.token_address = '0x7a58c0be72be218b41c608b7fe7c5bb630736c71'
    where contract_address = '0x7a58c0be72be218b41c608b7fe7c5bb630736c71'
    and to_address != '0x0000000000000000000000000000000000000000'
    and from_address != '0x0000000000000000000000000000000000000000'
    and event_name = 'transfer')
    group by 1
    --order by 2 desc

    select distinct origin_address, block_timestamp,
    coalesce( sum(dr_amt - cr_amt) over (partition by origin_address order by block_timestamp
    range between unbounded preceding and 1 preceding), 0 ) as op_bal,
    sum(dr_amt) over (partition by origin_address, block_timestamp) as daily_dr,
    sum(cr_amt) over (partition by origin_address, block_timestamp) as daily_cr,
    sum(dr_amt - cr_amt) over (partition by origin_address order by block_timestamp) as cl_bal
    from pj_test_cr_dr
    order by origin_address, block_timestamp


    select
    origin_address,
    debit,
    credit,
    lag(closing,1,0) over (partition by origin_address order by block_timestamp) opening,
    closing
    from (
    select
    origin_address,
    txn_dt,
    sum(dr_amt) debit,
    sum(cr_amt) credit,
    Run a query to Download Data