HosseinUntitled Query
Updated 2022-10-25
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
›
⌄
with stake as ( select date_trunc('day', date) as "Date",
sum(balance/ pow(10, 6)) as "Staked"
from osmosis.core.fact_daily_balances
where currency = 'uosmo'
and balance_type = 'staked'
group by "Date"
),
liquid as (
select date_trunc('day', date) as "Date",
sum(balance/ pow(10, 6)) as "Liquid"
from osmosis.core.fact_daily_balances
where balance_type = 'liquid'
and currency = 'uosmo'
group by "Date"
),
osmo_price as (
select date_trunc('day', recorded_at) as "Date",
avg(price) as "Price"
from osmosis.core.dim_prices
where symbol = 'OSMO'
group by "Date"
)
select t1."Date", "Liquid", "Staked", ("Liquid"/ "Staked") as "Liquid to Stake Ratio", "Price" as "OSMO Price"
from liquid t1
join stake t2
join osmo_price
on t1."Date" = osmo_price."Date"
and t1."Date" = t2."Date"
order by "Date"
Run a query to Download Data