nitsAstroPort TVL over time
Updated 2022-02-03
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
›
⌄
-- select *, event_attributes:assets[0]:amount from terra.msg_events
-- where event_index = '3' and event_attributes:"0_contract_address" = 'terra1j66jatn3k50hjtg2xemnjm8s7y8dws9xqa5y8w' AND event_attributes:"0_action" = 'provide_liquidity'
with tvl_provided as
(select date(block_timestamp) as day , sum(event_attributes:assets[0]:amount/pow(10,6)*2) as total_amt_provided from terra.msg_events
where event_index = '3' and event_attributes:"0_contract_address" = 'terra1j66jatn3k50hjtg2xemnjm8s7y8dws9xqa5y8w' AND event_attributes:"0_action" = 'provide_liquidity'
GROUP by 1 )
select *, sum(total_amt_provided) over (order by day ) as tvl_provided_cumulative from
(select day, total_amt_provided * avg_price as total_amt_provided_in_USd,total_amt_provided from
(select date(block_timestamp) as day_, avg(luna_exchange_rate) as avg_price from terra.oracle_prices
where symbol = 'UST'
GROUP by day_ )
inner join tvl_provided
on day = day_ )
ORDER by day
Run a query to Download Data