boomer77perc rune swap
    Updated 2022-01-23
    with torune as (select date(block_timestamp) as dt, from_asset, to_amount, tx_id -- in rune
    from thorchain.swaps
    where to_asset = 'THOR.RUNE'
    ),

    fromrune as (select date(block_timestamp) as dt, to_asset, from_amount, tx_id --in rune
    from thorchain.swaps
    where from_asset = 'THOR.RUNE'
    ),

    final as (select a.dt, a.tx_id, a.from_asset, a.to_amount, b.to_asset, b.from_amount
    from torune a
    left outer join fromrune b on a.tx_id = b.tx_id),

    perc as (select dt, count(tx_id) as to_rune_count
    from final
    where to_asset is null
    group by 1)

    select a.dt, count(a.tx_id) as total_tx, b.to_rune_count, round(((b.to_rune_count/total_tx)*100),2) as perc_to_rune
    from torune a
    left outer join perc b on a.dt = b.dt
    group by 1,3
    Run a query to Download Data