emirprince95bLUNA Price May
Updated 2021-10-15
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
›
⌄
select half_minute_window, min(price_of_base) as minimum_usd_value_in_window from (
SELECT me.block_id, me.block_timestamp AS time_of_pricing, TIME_SLICE(me.block_timestamp, 30, 'sec') as half_minute_window,
me.event_attributes:asset AS address_of_bToken,
ls.address_name AS base_address_name
, swp.ask_currency AS target_address_name
, me.event_attributes:price AS Price_of_base
, swp.price_of_target
, price_of_base/price_of_target as basset_to_asset_ratio,
cast('LUNA_PEG' as varchar) as peg_type --
FROM terra.msg_events me
JOIN terra.labels ls ON ls.address = me.event_attributes:asset
JOIN (select block_id, block_timestamp, ask_currency, avg(price1_USD) as price_of_target from terra.swaps
where ask_currency = 'LUNA' and offer_currency = 'UST'
group by block_id, block_timestamp, ask_currency) swp on me.block_timestamp = swp.block_timestamp and swp.block_id = me.block_id --
WHERE me.event_type = 'from_contract' AND
me.event_attributes:action = 'feed_prices' AND
me.event_attributes:contract_address = 'terra1cgg6yef7qcdm070qftghfulaxmllgmvk77nc7t' AND
base_address_name = 'bLUNA' AND --
me.tx_status = 'SUCCEEDED'
AND swp.ask_currency = 'LUNA'
AND (time_of_pricing > '2021-04-01T15:35:31Z' AND time_of_pricing <='2021-07-15T00:00:00Z'))
group by half_minute_window
Run a query to Download Data