binhachonLiquidity Activity - CVD
Updated 2022-03-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
›
⌄
with BANK_trading as (
select
block_timestamp,
case
when direction = 'IN' then -amount_usd
else amount_usd end
as corrected_amount_usd
from ethereum.dex_swaps
where token_address = '0x2d94aa3e47d9d5024503ca8491fce9a2fb4da198'
),
sum_BANK_trading as (
select
date_trunc('day', block_timestamp) as blocktime,
sum(corrected_amount_usd) as trading_volume
from
BANK_trading
group by blocktime
)
select
blocktime,
sum(trading_volume) over (order by blocktime) as cvd
from
sum_BANK_trading