CryptoLionTerra fees n swaps
    Updated 2021-08-09
    WITH a as (
    SELECT
    date_trunc('day',block_timestamp) as day,
    sum(offer_amount_usd) as swap_volume,
    sum(swap_fee_amount_usd) as swap_fees,
    count(tx_id) as swaps
    FROM terra.swaps
    WHERE block_timestamp >= getdate() - interval '90 days'
    AND tx_status = 'SUCCEEDED'
    GROUP BY 1
    ORDER BY 1 DESC
    )
    SELECT
    day,
    swap_fees/swap_volume,
    swap_fees,
    swap_volume,
    swaps,
    swap_fees/swaps
    FROM a
    ORDER BY 1 DESC
    Run a query to Download Data