nitsCopy of % Change in Transactions vs % change in price of WETH
    Updated 2022-11-23
    with prices as
    (SELECT date(hour) as day, avg(price) as avg_price
    from ethereum.core.fact_hourly_token_prices
    where date(hour) >= CURRENT_DATE - {{n_last_days}} and symbol ilike 'WETH'
    GROUP by 1
    ),
    prices1 as
    (SELECT date(hour) as day_, avg(price) as avg_price_
    from ethereum.core.fact_hourly_token_prices
    where date(hour) >= CURRENT_DATE - {{n_last_days}} and symbol ilike 'WETH'
    GROUP by 1
    ),
    eth as
    (SELECT day, (avg_price-avg_price_)/avg_price_ *100 as percent_change,
    (avg_price-(SELECT avg_price from prices where day= CURRENT_DATE - {{n_last_days}} ))/avg_price_ *100 as percent_change_cumulative
    from prices
    inner join prices1 on day = day_ + 1),
    txs as
    (SELECT date(block_timestamp) as day, count(DISTINCT tx_hash) as total_txs
    from ethereum.core.fact_transactions
    where date(block_timestamp) >= CURRENT_DATE - {{n_last_days}}
    GROUP by 1),
    txs1 as
    (SELECT date(block_timestamp) as day_, count(DISTINCT tx_hash) as total_txs_
    from ethereum.core.fact_transactions
    where date(block_timestamp) >= CURRENT_DATE - {{n_last_days}}
    GROUP by 1) ,
    eth_txs as
    (SELECT day as d , (total_txs-total_txs_)/total_txs_ *100 as percent_change_txs,
    (total_txs-(SELECT total_txs from txs where day= CURRENT_DATE - {{n_last_days}} ))/total_txs_ *100 as percent_change_cumulative_txs
    from txs
    inner join txs1 on day = day_ + 1)

    SELECT * from eth_txs
    inner join eth
    on d = day + 1