John_GaltcLUNA Bid / Ask (Denominated in UST) - think this is good
Updated 2022-04-26
99
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 cluna_bid as (select
block_timestamp as date,
event_attributes:order_id as order_id,
event_attributes:bidder_addr as address,
SPLIT_PART(event_attributes:offer_asset, ':', 3) / pow(10, 6) as ust_offered,
SPLIT_PART(event_attributes:ask_asset, ':', 3) / pow(10, 6) as cluna_asked,
ust_offered / cluna_asked as execute_price
from terra.msg_events
where date(block_timestamp) > '2022-04-23'
and event_attributes:contract_address = 'terra1zctyc83qmcunc5zww7hzgzmrtxhjhsj4kfgvg6'
and event_attributes:action = 'submit_order'
and SPLIT_PART(event_attributes:offer_asset, ':', 2) = 'uusd' -- ust token
and SPLIT_PART(event_attributes:ask_asset, ':', 2) = 'terra13zaagrrrxj47qjwczsczujlvnnntde7fdt0mau' -- cluna token
and event_index = 3
),
cluna_ask as (select
block_timestamp as date,
event_attributes:order_id as order_id,
event_attributes:bidder_addr as address,
SPLIT_PART(event_attributes:offer_asset, ':', 3) / pow(10, 6) as cluna_offered,
SPLIT_PART(event_attributes:ask_asset, ':', 3) / pow(10, 6) as ust_asked,
ust_asked / cluna_offered as execute_price
from terra.msg_events
where date(block_timestamp) > '2022-04-23'
and event_attributes:contract_address = 'terra1zctyc83qmcunc5zww7hzgzmrtxhjhsj4kfgvg6'
and event_attributes:action = 'submit_order'
and SPLIT_PART(event_attributes:offer_asset, ':', 2) = 'terra13zaagrrrxj47qjwczsczujlvnnntde7fdt0mau' -- cluna token
and SPLIT_PART(event_attributes:ask_asset, ':', 2) = 'uusd' -- ust
and event_index = 3
),
order_check as (select
block_timestamp as date,
event_attributes:order_id as order_id,
event_attributes:"0_action" as token_action,
Run a query to Download Data