boomer77il historical
Updated 2022-05-20
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
›
⌄
with raw as (select date_trunc('day', block_timestamp) as dt, pool_name, sum(il_protection_usd) as il_paid,
SUM(il_paid) OVER(partition by pool_name ORDER BY dt asc ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS il_paid_cumulative
from thorchain.liquidity_actions
where lp_action = 'remove_liquidity'
group by 1,2),
price as (select date_trunc('day', block_timestamp) as dt, pool_name, avg(asset_usd) as price_usd
from thorchain.prices
group by 1,2)
select a.dt, a.pool_name, a.il_paid, b.price_usd, a.il_paid_cumulative, case
when a.dt >= '2022-05-11' then 'past 7 days'
when a.dt between '2022-04-18' and '2022-05-10' then 'past 30 days'
else 'historical' end as xxx
from raw a
left join price b on a.dt = b.dt and a.pool_name = b.pool_name
where a.dt >= '2021-11-01'
Run a query to Download Data