John_GaltPrism - yLuna Daily Vol
    Updated 2022-04-12
    with prism_price as (select
    date_trunc('hour', block_timestamp) as Day_Hour,
    sum(event_attributes:offer_amount) / pow(10, 6) as Prism_Sold,
    sum(event_attributes:return_amount) / pow(10, 6) as UST_Returned,
    UST_Returned / Prism_Sold as Prism_Price
    from terra.msg_events
    where date(block_timestamp) > '2022-02-01'
    and event_attributes:"0_contract_address" = 'terra1dh9478k2qvqhqeajhn75a2a7dsnf74y5ukregw'
    and event_attributes:"1_contract_address" = 'terra19d2alknajcngdezrdhq40h6362k92kz23sz62u'
    and event_index = 3
    group by Day_Hour
    order by Day_Hour
    ),
    sell_prism_yluna as (select
    date_trunc('hour', block_timestamp) as day_hour,
    event_attributes:offer_amount / pow(10, 6) as blank_offer,
    event_attributes:"0_offer_amount" / pow(10, 6) zero_offer,
    event_attributes:"1_offer_amount" / pow(10, 6) one_offer,
    tx_id as tx,
    event_attributes:receiver as blank_receiver,
    event_attributes:"1_receiver" as one_receiver,
    case
    when event_attributes:offer_asset = 'cw20:terra1dh9478k2qvqhqeajhn75a2a7dsnf74y5ukregw' then 'prism_blank'
    when event_attributes:"0_offer_asset" = 'cw20:terra1dh9478k2qvqhqeajhn75a2a7dsnf74y5ukregw' then 'prism_zero'
    when event_attributes:"1_offer_asset" = 'cw20:terra1dh9478k2qvqhqeajhn75a2a7dsnf74y5ukregw' then 'prism_one'
    end as which_offer_asset_prism
    from terra.msg_events
    where date(block_timestamp) > '2022-02-01'
    and event_index = 3
    and (event_attributes:"0_contract_address" = 'terra1kqc65n5060rtvcgcktsxycdt2a4r67q2zlvhce' or
    event_attributes:"1_contract_address" = 'terra1kqc65n5060rtvcgcktsxycdt2a4r67q2zlvhce' or
    event_attributes:"2_contract_address" = 'terra1kqc65n5060rtvcgcktsxycdt2a4r67q2zlvhce' or
    event_attributes:"3_contract_address" = 'terra1kqc65n5060rtvcgcktsxycdt2a4r67q2zlvhce' or
    event_attributes:"4_contract_address" = 'terra1kqc65n5060rtvcgcktsxycdt2a4r67q2zlvhce' or
    event_attributes:"5_contract_address" = 'terra1kqc65n5060rtvcgcktsxycdt2a4r67q2zlvhce' or
    Run a query to Download Data