granadohoRune Price vs Swap Volume
    Updated 2022-01-23
    with rune_price as (
    select
    date(block_timestamp) as date,
    avg(rune_usd) as daily_average_rune_price
    from thorchain.prices
    group by date(block_timestamp)
    order by date(block_timestamp) asc
    ), swap_to_rune as (
    select
    date(block_timestamp) as date,
    sum(to_amount) as amount_of_rune
    from thorchain.swaps
    where to_asset = 'THOR.RUNE' and from_asset != 'THOR.RUNE'
    group by date(block_timestamp)
    order by date(block_timestamp) asc
    ), swap_from_rune as (
    select
    date(block_timestamp) as date,
    sum(to_amount) as amount_of_rune
    from thorchain.swaps
    where from_asset = 'THOR.RUNE' and to_asset != 'THOR.RUNE'
    group by date(block_timestamp)
    order by date(block_timestamp) asc
    )

    SELECT
    a.date,
    a.daily_average_rune_price,
    b.amount_of_rune as buy_volume,
    c.amount_of_rune as sell_volume
    FROM rune_price a
    JOIN swap_to_rune b ON a.date = b.date
    JOIN swap_from_rune c ON a.date = c.date
    WHERE a.date >= '2021-11-01'



    Run a query to Download Data