hbd1994All Swaps in Details (Sort By: USD Value of Swaps)
Updated 2023-08-06
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 hourly_price as (
select
date_trunc('day',hour) as time,
symbol,
avg(price) as avg_price
from bsc.core.fact_hourly_token_prices
where symbol in ('WBNB','USDT')
and HOUR::date >= '2023-08-04'
group by 1 , 2)
(select
'Sawp For TS' as action,
date_trunc('day',BLOCK_TIMESTAMP::DATE) as date,
SYMBOL_IN as From_token,
AMOUNT_IN as From_Amount,
(From_Amount * avg_price) AS From_Amount_USD,
'TS' as For_token,
case
when PLATFORM = 'pancakeswap-v2' then (AMOUNT_OUT/pow(10,18))
when PLATFORM = 'pancakeswap-v3' then AMOUNT_OUT
end as For_Amount,
null AS For_Amount_USD,
coalesce(From_Amount_USD,For_Amount_USD) as swap_value_usd,
ORIGIN_FROM_ADDRESS,
tx_hash,
PLATFORM
from bsc.core.ez_dex_swaps
inner join hourly_price on date = time and symbol = From_token
where TOKEN_OUT = '0x9879406c2ef6578ceb59009d64151ef3f225830b'
having TOKEN_IN != '0x9879406c2ef6578ceb59009d64151ef3f225830b')
UNION ALL
(select
'Swap From TS' as actoin,
date_trunc('day',BLOCK_TIMESTAMP::DATE) as date,
'TS' as From_token,
case
Run a query to Download Data