Ali3NRUNE CEX Transfers vs. Price Correlation Over Time (THORChain)
    Updated 2024-11-07
    with pricet as (
    select hour::date as day,
    avg (price) as RUNE_Price
    from thorchain.price.ez_prices_hourly
    where symbol = 'RUNE'
    and hour >= '{{From_Date}}' and hour <= '{{To_Date}}'
    group by 1)

    select date_Trunc ('{{Time_Interval}}',block_timestamp) as date,
    avg (rune_price) as RUNE_Price,
    sum (case when from_address = address then rune_amount_usd end) as Inflow_Volume,
    sum (case when to_address = address then rune_amount_usd*-1 end) as outflow_volume,
    sum (case when from_address = address then rune_amount_usd when to_address = address then rune_amount_usd*-1 end) as Net_Volume,
    from thorchain.core.fact_transfers t1 join thorchain.core.dim_labels t2 on t1.from_address = t2.address or t1.to_address = t2.address
    join pricet t3 on t1.block_timestamp::date = t3.day
    where block_timestamp >= '{{From_Date}}' and block_timestamp <= '{{To_Date}}'
    and label_type = 'cex'
    group by 1
    order by 1 desc



    QueryRunArchived: QueryRun has been archived