KARTODANCHOR - Deposits, withdrawls, net dep
Updated 2022-01-15
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_trunc('day', block_timestamp) as block_date,
symbol,
avg(price_usd) as avg_price_usd
from terra.oracle_prices
where symbol = 'LUNA'
and block_timestamp < '2021-09-30'
and block_timestamp > '2021-01-01'
group by 1, 2
),
daily_stable_deposits as (
select
date_trunc('day', block_timestamp) as block_date,
sum(m.msg_value:coins[0]:amount) / pow(10, 6) as total_stable_deposits
from terra.msgs m
where m.msg_value:execute_msg:deposit_stable is not null
and tx_status = 'SUCCEEDED'
and block_timestamp < '2021-09-30'
and block_timestamp > '2021-01-01'
group by 1
),
daily_stable_withdrawals as (
select
date_trunc('day', block_timestamp) as block_date,
sum(m.msg_value:execute_msg:send:amount) / pow(10, 6) as total_stable_withdrawals
from terra.msgs m
where m.msg_value:execute_msg:send:msg:redeem_stable is not null
and tx_status = 'SUCCEEDED'
and block_timestamp < '2021-09-30'
and block_timestamp > '2021-01-01'
group by 1
),
daily_net_deposits as (
select
d.block_date,
Run a query to Download Data