emirprince95bETH price
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
›
⌄
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
, op.symbol AS target_address_name
, me.event_attributes:price AS Price_of_base
,TO_NUMERIC(op.price_usd, 8) AS price_of_target
, price_of_base/price_of_target as basset_to_asset_ratio,
cast('ETH_PEG' as varchar) as peg_type
FROM terra.msg_events me
JOIN terra.labels ls ON ls.address = me.event_attributes:asset
JOIN terra.oracle_prices op on me.block_timestamp = op.block_timestamp
WHERE me.event_type = 'from_contract' AND
me.event_attributes:action = 'feed_prices' AND
me.event_attributes:contract_address = 'terra1cgg6yef7qcdm070qftghfulaxmllgmvk77nc7t' AND
LOWER(base_address_name) = 'beth token contract' AND
me.tx_status = 'SUCCEEDED'
AND LOWER(target_address_name) = 'meth')
group by half_minute_window