h4wkCEX breakdown
Updated 2023-04-17
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
›
⌄
-- forked from AVAX inflow and outflow @ https://flipsidecrypto.xyz/edit/queries/f3a52f4d-26f3-4b39-9e0c-654ac98dcd06
with cex_address as (
select address, initcap(project_name) as project_name
from crosschain.core.address_labels
where blockchain = 'avalanche'
and label_type = 'cex'
),
avax_price as (
select hour::date as price_date,
avg(price) as avax_price
from avalanche.core.fact_hourly_token_prices
where symbol = 'WAVAX'
group by 1
),
inflow as (
select * from avalanche.core.ez_avax_transfers
join cex_address on eth_from_address = address
),
outflow as (
select * from avalanche.core.ez_avax_transfers
join cex_address on eth_to_address = address
)
, base as (
select *, 'Inflow' as type from inflow
UNION
select *, 'Outflow' as type from outflow
)
select
date_trunc('week', block_timestamp) as date,
project_name,
Run a query to Download Data