staderWeekly revenue by product
    Updated 2022-07-07
    with liquid as (
    select
    date(date_trunc('WEEK',block_timestamp)) as date,
    sum(event_attributes:"1_amount"[0]:amount::float/pow(10,6)) as rev_liq
    from terra.msg_events
    where
    event_type in ('coin_received')
    and tx_status in ('SUCCEEDED')
    and event_attributes:"1_receiver"::string in ('terra1dykk536s6yvtek4hjyst6tflu5r7jf4ycvy4r5')
    and date(block_timestamp) >= date('2021-11-20')
    --and date(block_timestamp) >= current_date - INTERVAL '30 days'
    and tx_id in (
    select tx_id from terra.msgs
    where
    msg_value:execute_msg:reinvest is not null
    and tx_status in ('SUCCEEDED')
    )
    group by 1
    ),

    plus as (
    select
    date(date_trunc('WEEK',block_timestamp)) as date,
    sum(event_attributes:"1_amount"[0]:amount::float/pow(10,6)) as rev_plus
    from terra.msg_events
    where
    event_type in ('coin_received')
    and tx_status in ('SUCCEEDED')
    and event_attributes:"1_receiver"::string in ('terra16xcytyuaatus8xlgl7fxascvshhn9h8cfq6p08')
    and date(block_timestamp) >= date('2022-02-16')
    --and date(block_timestamp) >= current_date - INTERVAL '30 days'
    and tx_id in (
    select tx_id from terra.msgs
    where
    msg_value:execute_msg:reinvest is not null
    and tx_status in ('SUCCEEDED')
    Run a query to Download Data