binhachonCopy of Firecharts: WBTC
Updated 2021-12-28
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 BTC_trading as (
select
block_timestamp,
case
when amount_usd < 1000 then '0-1000'
when 10000 > amount_usd >= 1000 then '1000 - 10000'
when 100000 > amount_usd >= 10000 then '10000 - 100000'
when 1000000 > amount_usd >= 100000 then '100,000 - 1,000,000'
when 10000000 > amount_usd >= 1000000 then '1,000,000 - 10,000,000'
else 'Over 10,000,000' end
as category,
case
when direction = 'IN' then -amount_usd
else amount_usd end
as corrected_amount_usd
from ethereum.dex_swaps
where token_address = '0xc18360217d8f7ab5e7c516566761ea12ce7f9d72'
),
sum_BTC_trading as (
select
date_trunc('day', block_timestamp) as blocktime,
category,
sum(corrected_amount_usd) as trading_volume
from
BTC_trading
group by blocktime, category
)
select
blocktime,
category,
sum(trading_volume) over (partition by category order by blocktime) as cvd
from
sum_BTC_trading
Run a query to Download Data