theericstonenet deposits
Updated 2022-07-07
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
›
⌄
with luna_prices as (
select
date(block_timestamp) as block_date,
avg(price_usd) as avg_price_usd
from terra.oracle_prices
where symbol = 'LUNA'
and block_timestamp > current_date - 180
group by 1
),
daily_stable_deposits as (
select
date(block_timestamp) as block_date,
sum(deposit_amount) as total_stable_deposits
from anchor.deposits where block_timestamp > current_date - 180
group by 1
),
daily_stable_withdrawals as (
select
date(block_timestamp) as block_date,
sum(amount) as total_stable_withdrawals
from anchor.redeem m
where m.block_timestamp > current_date - 180
group by 1),
daily_net_deposits as (
select
d.block_date,
sum(total_stable_deposits) over (order by d.block_date) as deposits_usd,
sum(total_stable_withdrawals) over (order by d.block_date) as withdraws_usd,
sum(total_stable_deposits-total_stable_withdrawals) over (order by d.block_date) as net_deposits_usd
from daily_stable_deposits d
inner join daily_stable_withdrawals w
on d.block_date = w.block_date)
select * from daily_net_deposits d;
Run a query to Download Data