rezarwz2023-07-08 09:49 AM
Updated 2023-07-08
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
›
⌄
with eth_pr as(
SELECT
date_trunc('day',hour) as date,
TOKEN_ADDRESS,
avg(price)as price
FROM ethereum.core.fact_hourly_token_prices
GROUP BY 1,2
),
all_tx as (
SELECT
ez.tx_hash,
ez.block_timestamp::date as date,
ez.ORIGIN_FROM_ADDRESS as wallet_address,
case
when AMOUNT_IN_USD is not null then AMOUNT_IN_USD
when amount_out_usd is not null and AMOUNT_IN_USD is null then amount_out_usd
when amount_out_usd is null and AMOUNT_IN_USD is null then tr.AMOUNT_USD
end as amount_usd
FROM
ethereum.core.ez_dex_swaps ez left JOIN ethereum.core.ez_token_transfers tr
on ez.tx_hash=tr.tx_hash
WHERE
ez.ORIGIN_TO_ADDRESS = '0x881d40237659c251811cec9c364ef91dc08d300c'
and event_name like '%Swap%'
and ez.BLOCK_NUMBER>=11042542
and tr.has_price='true'
)
SELECT
* from all_tx where wallet_address='0x983a185bb3fc31801dd9f508e9778bc1b40212c3'
Run a query to Download Data