nitsCorrelation MIM
    Updated 2022-02-11
    with ust_price as (SELECT hour as hr , price as ust_price from ethereum.token_prices_hourly
    where symbol = 'UST' and hour> CURRENT_DATE -60 ),
    mim_price as (SELECT hour, price as mim_price from ethereum.token_prices_hourly
    where symbol = 'MIM' and hour> CURRENT_DATE -60)

    SELECT count(*) as total_sample_space, sum(correlation_count) as same_direction_deviation, same_direction_deviation/total_sample_space *100 AS net_correlation
    from
    (SELECT *, (mim_price-1)*100 as price_diff_mim,
    (ust_price-1)*100 as price_diff_ust,
    case when (price_diff_mim > '0' and price_diff_ust > '0') or (price_diff_mim < '0' and price_diff_ust < '0') then '1' else '0' end as correlation_count
    from mim_price
    inner join ust_price
    on hour = hr )
    limit 10000


    --0xa693b19d2931d498c5b318df961919bb4aee87a5 = ust wormhole
    --0xa47c8bf37f92abed4a126bda807a7b7498661acd = ust wrapped
    Run a query to Download Data