ArioAVAX_CEX Stablecoins Flows
Updated 2023-04-20
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 cex_address as (
select
address,
Project_name as CEX_Name
from avalanche.core.dim_labels
where label_type = 'cex'
),
ez_transfer as (
select
BLOCK_TIMESTAMP,
TX_HASH,
ORIGIN_FROM_ADDRESS,
ORIGIN_TO_ADDRESS,
TO_ADDRESS,
SYMBOL,
AMOUNT_USD
from avalanche.core.ez_token_transfers
where BLOCK_TIMESTAMP >= current_date - 30
and amount_usd is not null
and SYMBOL in ('USDC', 'USDT')
),
Inflow as (
select
date_trunc(day, BLOCK_TIMESTAMP)::date as date,
sum(amount_usd) as "Inflow Volume (USD)"
from ez_transfer a join cex_address b on a.TO_ADDRESS = b.address
where block_timestamp < current_date
group by 1
),
outflow as (
select
date_trunc(day, BLOCK_TIMESTAMP)::date as date,
sum(amount_usd) as "Outflow Volume (USD)"
from ez_transfer a join cex_address b on a.ORIGIN_FROM_ADDRESS = b.address
where block_timestamp < current_date
group by 1
Run a query to Download Data