SocioCryptoNOTE Swaps
Updated 2023-06-01
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 price as
(
SELECT
date_Trunc('day',hour) as date,
median(price) as price
FROM
ethereum.core.fact_hourly_token_prices
WHERE
token_address = '0xcfeaead4947f0705a14ec42ac3d44129e1ef3ed5'
GROUP BY date
)
SELECT 'swap in' as title,
b.date as date,
sum(amount_in/pow(10,8)) as vol,
sum(b.price*amount_in/pow(10,8)) as vol_usd,
count(DISTINCT origin_from_ADDRESS) as senders
FROM
ethereum.core.ez_dex_swaps a
LEFT JOIN price b
on date_trunc('day',block_timestamp) = b.date
WHERE a.token_in = '0xcfeaead4947f0705a14ec42ac3d44129e1ef3ed5'
AND date between '2023-01-01' AND current_date -1
GROUP by date
UNION
SELECT 'swap out' as title,
b.date as date,
sum(amount_out/pow(10,8)) as vol,
sum(b.price*amount_out/pow(10,8)) as vol_usd,
count(DISTINCT origin_from_ADDRESS) as senders
FROM
ethereum.core.ez_dex_swaps a
LEFT JOIN price b
on date_trunc('day',block_timestamp) = b.date
WHERE a.token_out = '0xcfeaead4947f0705a14ec42ac3d44129e1ef3ed5'
AND date between '2023-01-01' AND current_date -1
GROUP by date
Run a query to Download Data