boomer77terraswap wd bluna-luna
Updated 2022-02-02
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
›
⌄
--terra1j66jatn3k50hjtg2xemnjm8s7y8dws9xqa5y8w bluna-luna AP ulp
--terra1nuy34nwnsh53ygpc4xprlj263cztw7vc99leh2 bluna-luna TS ulp
with prov as (select date_trunc('day', block_timestamp) as dt, sum(event_attributes:refund_assets[0]:amount/1e6) as bluna, sum(event_attributes:refund_assets[1]:amount/1e6) as luna
from terra.msg_events
WHERE event_attributes:"0_contract_address" = 'terra1nuy34nwnsh53ygpc4xprlj263cztw7vc99leh2' AND event_attributes:"1_action" = 'withdraw_liquidity'
and event_type = 'from_contract' and block_timestamp >= '2021-12-27'
group by 1
order by dt desc),
price_bl as (select date_trunc('day', block_timestamp) as dt, symbol, avg(price_usd) as bluna_p
from terra.oracle_prices
where currency = 'terra1kc87mu460fwkqte29rquh4hc20m54fxwtsx7gp'
group by 1,2),
price_l as (select date_trunc('day', block_timestamp) as dt, symbol, avg(price_usd) as luna_p
from terra.oracle_prices
where currency = 'uluna'
group by 1,2)
select a.dt, a.bluna, a.luna, b.bluna_p, c.luna_p, (a.bluna*b.bluna_p) as bluna_vol, (a.luna*c.luna_p) as luna_vol, round((bluna_vol+luna_vol),2) as TVL_withdrew
from prov a
left join price_bl b on a.dt = b.dt
left join price_l c on a.dt = c.dt
Run a query to Download Data