AzinOptimism4
    Updated 2022-12-20
    with t1 as
    (select
    sum(case when SYMBOL_IN='OP' then AMOUNT_IN else null end) as inflow,
    sum(case when SYMBOL_OUT='OP' then AMOUNT_OUT else null end) as outflow,
    inflow-outflow as netflow ,
    date_trunc(day,BLOCK_TIMESTAMP) as date
    from optimism.sushi.ez_swaps
    group by date)
    ,
    t2 as
    (select
    sum(netflow) over (order by date) as net_flow , *
    from t1),


    price as

    (
    select

    avg (case when ID='optimism' then CLOSE else null end ) as price,

    date_trunc(day,RECORDED_HOUR) as datee

    from
    crosschain.core.fact_hourly_prices

    group by datee

    )


    select * from t2 a left join price b
    Run a query to Download Data