Pmisha-bmlMdxTotal_deposits_anchor
Updated 2022-01-05
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
33
34
35
36
›
⌄
--this code contains average borrow and deposit of anchor over 6 month and weekly
with weekly_borrows as
(
select
date_trunc('week', block_timestamp) as week,
sum(amount_usd) as total_borrowed
from
anchor.borrows b
where block_timestamp > CURRENT_DATE - 180
group by
week
),
weekly_deposits as
(
select
date_trunc('week', block_timestamp) as week,
sum(deposit_amount_usd) as total_deposits
from
anchor.deposits
where block_timestamp > CURRENT_DATE - 180
group by week
)
select
weekly_deposits.week as week,
total_deposits,
total_borrowed
from weekly_deposits
inner join weekly_borrows on weekly_deposits.week = weekly_borrows.week
Run a query to Download Data