StangFAST02 : Strategy : part 2
    Updated 2023-03-05
    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 current_date
    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
    , CASE
    when ez.action = 'Repay' then 'Repay'
    when ez.action = 'Borrow' then 'Borrow'
    END
    AS type
    , sum
    (
    CASE
    when type = 'Repay' then ez.amount_usd
    when type = 'Borrow' then ez.amount_usd
    END
    Run a query to Download Data