KaskoazulHistorical LUNA minted vs. LUNA burned
    Updated 2022-05-08
    with LUNA_burn as (
    select block_timestamp::date as date, count (tx_id) as burn_swaps, sum(token_0_amount) as burned_LUNA, sum(token_0_amount_usd) as burned_LUNA_USD, sum(swap_fee_amount) as burned_fee_LUNA, sum(swap_fee_amount_USD) as burned_fee_USD
    from terra.swaps
    where offer_currency = 'LUNA'
    and tx_status = 'SUCCEEDED'
    group by 1
    ),

    LUNA_mint as (
    select block_timestamp::date as date, count (tx_id) as mint_swaps, sum(token_1_amount) as minted_LUNA, sum(token_1_amount_usd) as minted_LUNA_USD, sum(swap_fee_amount) as minted_fee_LUNA, sum(swap_fee_amount_USD) as minted_fee_USD
    from terra.swaps
    where ask_currency = 'LUNA'
    and tx_status = 'SUCCEEDED'
    group by 1
    )

    select burn.date as date,
    burn.burned_LUNA as burned,
    sum (burned) over (order by burn.date) as cumulative_burned,
    burn.burned_LUNA_USD as burned_USD,
    sum (burned_USD) over (order by burn.date) as cumulative_burned_USD,
    burn.burn_swaps,
    sum(burn.burn_swaps) over (order by burn.date) as cumulative_burn_swaps,
    mint.minted_LUNA as minted,
    sum (minted) over (order by burn.date) as cumulative_minted,
    mint.minted_LUNA_USD as minted_USD,
    sum (minted_USD) over (order by burn.date) as cumulative_minted_USD,
    mint.mint_swaps,
    sum(burn.burn_swaps) over (order by burn.date) as cumulative_mint_swaps,
    minted - burned as net_LUNA,
    cumulative_minted - cumulative_burned as cumulative_net_LUNA,
    minted_USD - burned_USD as net_LUNA_USD,
    cumulative_minted_USD - cumulative_burned_USD as cumulative_net_LUNA_USD,
    mint.mint_swaps - burn.burn_swaps as net_swaps,
    cumulative_mint_swaps - cumulative_burn_swaps as cumulative_net_swaps
    from LUNA_burn burn
    Run a query to Download Data