John_GaltTotal Prism Swap Vol
Updated 2022-04-13
999
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
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_ust 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" = 'terra19d2alknajcngdezrdhq40h6362k92kz23sz62u' or
event_attributes:"1_contract_address" = 'terra19d2alknajcngdezrdhq40h6362k92kz23sz62u' or
event_attributes:"2_contract_address" = 'terra19d2alknajcngdezrdhq40h6362k92kz23sz62u' or
event_attributes:"3_contract_address" = 'terra19d2alknajcngdezrdhq40h6362k92kz23sz62u' or
event_attributes:"4_contract_address" = 'terra19d2alknajcngdezrdhq40h6362k92kz23sz62u' or
event_attributes:"5_contract_address" = 'terra19d2alknajcngdezrdhq40h6362k92kz23sz62u' or
Run a query to Download Data