binhachonLUNA & Drawdowns - Liquidation histogram
Updated 2022-04-11
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 max_price as (
select
date_trunc('day', block_timestamp) as time,
block_timestamp,
price_usd as max_price,
avg(price_usd) over (partition by time) as avg_price,
row_number() over (partition by time order by price_usd desc) as rank
from terra.oracle_prices
where symbol = 'LUNA'
qualify rank = 1
),
min_price as (
select
time,
max_price,
avg_price,
price_usd as min_price,
100 * (max_price - min_price) / max_price as "% drop from the day's high"
from (
select
time,
max_price,
avg_price,
price_usd
from terra.oracle_prices
inner join max_price on (time = date_trunc('day', terra.oracle_prices.block_timestamp) and terra.oracle_prices.block_timestamp >= max_price.block_timestamp)
where symbol = 'LUNA'
)
qualify row_number() over (partition by time order by price_usd) = 1
),
LUNA_price as (
select
date_trunc('day', block_timestamp) as time,
100 * (max(price_usd) - min(price_usd)) / max(price_usd) as "% drop from the week's high"
from terra.oracle_prices
where symbol = 'LUNA'
Run a query to Download Data