RayyykRUNE Price vs Loan Closed 1
    Updated 2025-02-04
    with table_1 as (select date_trunc('day', block_timestamp) as day,
    avg(rune_usd) as rune_price,
    avg(asset_usd) as btc_price
    from thorchain.price.fact_prices
    where block_timestamp >= '2023-08-21'
    and pool_name in ('BTC.BTC')
    group by 1),

    table_2 as (select date_trunc('day', block_timestamp) as day,
    avg(rune_usd) as rune_price,
    avg(asset_usd) as eth_price
    from thorchain.price.fact_prices
    where block_timestamp >= '2023-08-21'
    and pool_name in ('ETH.ETH')
    group by 1)

    select a.day,
    a.rune_price as "RUNE",
    btc_price as "BTC",
    eth_price as "ETH",
    (select corr(rune_price, btc_price) from table_1) as btc_correlation,
    (select corr(rune_price, eth_price) from table_2) as eth_correlation
    from table_1 a
    join table_2 b on a.day = b.day
    order by 1 desc
    QueryRunArchived: QueryRun has been archived