wanlinUST On Chain Swaps [2] copy
    -- forked from forgash / UST On Chain Swaps [2] @ https://flipsidecrypto.xyz/forgash/q/untitled-query-6zsD_b

    with
    ust_ask as (
    select
    block_timestamp,
    offer_amount,
    offer_currency,
    token_1_amount, -- token 1 is ask
    (token_0_amount * price0_usd) / token_1_amount as ust_p,
    token_0_amount, -- token 0 is offer
    price0_usd,
    price1_usd as ust_oracle
    from terra.swaps
    where ask_currency = 'UST'
    and price0_usd is not null
    and offer_currency = 'LUNA'
    ),

    ask_agg as (
    select
    -- time_slice(block_timestamp, 10, 'minute') as _date,
    date_trunc('m', block_timestamp) as _date,
    avg(ust_p) as ust_ask_swap_price,
    avg(ust_oracle) as avg_ust_oracle
    from ust_ask
    where block_timestamp >= '2022-05-07'
    group by 1
    ),

    ust_offer as (
    select
    block_timestamp,
    ask_currency,
    token_1_amount, -- token 1 is ask
    Run a query to Download Data