StangFAST02 : Strategy : part 1
    Updated 2023-03-10
    with prices AS
    (
    SELECT
    date( fp.hour ) AS date
    , avg( fp.price ) AS avg_sushi_price
    FROM
    ethereum.core.fact_hourly_token_prices fp

    WHERE
    date BETWEEN '2022-06-01' AND '2023-02-28'
    AND fp.symbol = 'SUSHI'

    GROUP BY
    date
    )

    , arbitrum_chain AS
    (

    SELECT
    'arbitrum' AS chain
    , date_trunc( 'month' , ez.block_timestamp ) AS date
    , count( DISTINCT ez.tx_hash ) AS tx_count
    , count( DISTINCT ez.origin_from_address ) AS unique_user
    , -sum( CASE when ez.action = 'Repay' then ez.amount_usd END ) AS total_repay
    , sum( CASE when ez.action = 'Borrow' then ez.amount_usd END ) AS total_borrow
    , total_repay + total_borrow as net_liquidity
    , sum( net_liquidity ) over ( ORDER BY date ASC ) AS net_cumu

    FROM
    arbitrum.sushi.ez_borrowing ez
    WHERE
    ez.block_timestamp::date >= '2022-06-01'
    AND ez.block_timestamp::date < '2023-02-28'
    Run a query to Download Data