maybeyonasthorchain_fee_xmas
    Updated 2021-12-24
    with swap_from as (
    select
    block_timestamp,
    tx_id,
    from_address as address,
    liq_fee_rune as fee
    from thorchain.swaps
    ),
    swap_to as (
    select
    block_timestamp,
    tx_id,
    to_address,
    liq_fee_rune as fee
    from thorchain.swaps
    ),
    swaps as (
    select * from swap_from
    where block_timestamp > current_date - interval '30 days'
    union all
    select * from swap_to
    where block_timestamp > current_date - interval '30 days'
    ),
    last_30 as (
    select
    address,
    count(tx_id) as swaps,
    sum(fee) as fee_vol
    from swaps
    group by 1
    ),
    all_swaps as (
    select sum(liq_fee_rune) as total_fee from thorchain.swaps
    where block_timestamp > current_date - interval '30 days'
    )

    Run a query to Download Data