John_GaltpLuna Price on PS and A
Updated 2022-06-03Copy Reference Fork
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 table1 as (select -- this is for simple swaps where pluna is buying prism --First we start out with buys and sells on Prism Swap
date_trunc('hour', block_timestamp) as day_hour,
event_attributes:"offer_amount" / pow(10, 6) as pluna,
event_attributes:"return_amount" / pow(10,6) as prism,
prism / pluna as pluna_in_prism
from terra.msg_events
where date(block_timestamp) > '2022-03-30'
and event_attributes:"0_to" = 'terra1persuahr6f8fm6nyup0xjc7aveaur89nwgs5vs'
and event_attributes:"1_action" = 'swap'
and event_index = 3
and event_attributes:"ask_asset" = 'cw20:terra1dh9478k2qvqhqeajhn75a2a7dsnf74y5ukregw' --prism
and event_attributes:"offer_asset" = 'cw20:terra1tlgelulz9pdkhls6uglfn5lmxarx7f2gxtdzh2' --pluna
union all
select -- this is for simple swaps where prism is buying pluna
date_trunc('hour', block_timestamp) as day_hour,
event_attributes:"return_amount" / pow(10,6) as pluna,
event_attributes:"offer_amount" / pow(10, 6) as prism,
prism / pluna as pluna_in_prism
from terra.msg_events
where date(block_timestamp) > '2022-03-30'
and event_attributes:"0_to" = 'terra1persuahr6f8fm6nyup0xjc7aveaur89nwgs5vs'
and event_attributes:"1_action" = 'swap'
and event_index = 3
and event_attributes:"ask_asset" = 'cw20:terra1tlgelulz9pdkhls6uglfn5lmxarx7f2gxtdzh2' --pluna
and event_attributes:"offer_asset" = 'cw20:terra1dh9478k2qvqhqeajhn75a2a7dsnf74y5ukregw' --prism
union all
select
date_trunc('hour', block_timestamp) as day_hour, -- this is for a routed transaction where pluna is buying prism
event_attributes:"0_offer_amount" / pow(10, 6) as pluna,
event_attributes:"0_return_amount" / pow(10,6) as prism,
prism / pluna as pluna_in_prism
from terra.msg_events
Run a query to Download Data