boomer77stt-ust
    Updated 2021-10-03
    with stt_price as (select date_trunc('day', block_timestamp) as block_day, avg(msg_value:execute_msg:swap:belief_price) as STT_price
    from terra.msgs
    where msg_value:contract::string = 'terra19pg6d7rrndg4z4t0jhcd7z9nhl3p5ygqttxjll'
    and msg_value:execute_msg:swap:belief_price between 4 and 10
    group by 1),

    stt_claim as (select date_trunc('day', block_timestamp) as block_day, count (distinct tx_id) as Claim_count
    from terra.msgs
    where msg_value:contract::string = 'terra1q2qprmuva3m93vhjmc7vakhs0h2lelxzlt675p'
    group by 1)

    select a.block_day, a.stt_price, case when b.claim_count is null then 0 else b.claim_count end as claim_tx_count
    from stt_price a
    left outer join stt_claim b on a.block_day = b.block_day
    order by 1 desc
    Run a query to Download Data