boomer77daily new users-borrow n deposit
Updated 2021-12-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
›
⌄
with borrow as (select msg_value:sender::string as users, block_timestamp, ROW_NUMBER() OVER (partition by users Order by block_timestamp asc) as rank
from terra.msgs
where msg_value:execute_msg:borrow_stable::string is not null and msg_value:contract::string = 'terra1sepfj7s0aeg5967uxnfk4thzlerrsktkpelm5s' and tx_status = 'SUCCEEDED'
),
borrowers as (select date(block_timestamp) as dates, count(distinct users) as borrower_count
from borrow
where rank = 1 and dates >= CURRENT_DATE - 90
group by 1),
deposit as (select msg_value:sender::string as users, block_timestamp, ROW_NUMBER() OVER (partition by users Order by block_timestamp asc) as rank
from terra.msgs
where msg_value:execute_msg::string like '%deposit_stable%' and tx_status = 'SUCCEEDED'
),
depositor as (select date(block_timestamp) as dates, count(distinct users) as depositor_count
from deposit
where rank = 1 and dates >= CURRENT_DATE - 90
group by 1)
select a.dates, a.borrower_count, b.depositor_count
from borrowers a
left join depositor b on a.dates = b.dates
Run a query to Download Data