binhachonForefront Treasury
Updated 2022-03-27
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 treasury_transaction as (
select
block_timestamp,
symbol,
amount
from ethereum.udm_events
where to_address = lower('0x2Fb9F0ef424b24a8D293999298F392a33Fe6A8b5')
and block_timestamp::date > '2021-03-01'
and symbol in ('USDC', 'FF', 'ETH')
and amount is not null
union all
select
block_timestamp,
symbol,
-amount
from ethereum.udm_events
where from_address = lower('0x2Fb9F0ef424b24a8D293999298F392a33Fe6A8b5')
and block_timestamp::date > '2021-03-01'
and symbol in ('USDC', 'FF', 'ETH')
and amount is not null
),
treasury_balance as (
select
date_trunc('week', block_timestamp) as time,
symbol,
sum(amount) as weekly_inflow,
sum(case when amount < 0 then -amount else 0 end) as weekly_payment_from_treasury
from treasury_transaction
group by time, symbol
),
price_list as (
select
date_trunc('week', hour) as time,
symbol,
avg(price) as price
from ethereum.token_prices_hourly
Run a query to Download Data