drone-mostafaUntitled Query
    Updated 2022-08-17
    with
    deposit as ( select block_timestamp::date as daily, sum (velo_amount_usd) as USD_deposit from optimism.velodrome.ez_velo_locks where velo_action = 'deposit' group by daily),

    withdraw as ( select block_timestamp::date as daily, sum (velo_amount_usd) as USD_withdraw from optimism.velodrome.ez_velo_locks where velo_action = 'withdraw' group by daily)

    select n1.daily, USD_deposit - USD_withdraw as Locked, sum(Locked)over (order by n1.daily) as Locked_Value,
    USD_deposit, USD_withdraw * -1 as USD_withdrawn,

    sum(USD_deposit) over (order by n1.daily) as cum_deposit,
    sum(USD_withdraw) over (order by n1.daily) as cum_withdraw

    from deposit n1 join withdraw n2 on n1.daily = n2.daily order by n1.daily

    Run a query to Download Data