yasmin-n-d-r-hOn-Chain Activities of Trader Users copy
Updated 2023-10-04Copy Reference Fork
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 hess / On-Chain Activities of Trader Users @ https://flipsidecrypto.xyz/hess/q/BMJV-PSZ8PYq/on-chain-activities-of-trader-users
with dex as ( select date(a.block_timestamp) as date, 'Avalanche' as chain, 'WAVAX' as token,
case when amount_in_usd is null then amount_out_usd
when amount_out_usd is null then amount_in_usd
when amount_in_usd>=amount_out_usd then amount_in_usd
when amount_out_usd>amount_in_usd then amount_out_usd end as amount_usd
, a.tx_hash, origin_from_address, concat(symbol_in,'/',symbol_out) as pair, tx_fee
from avalanche.core.fact_transactions a join avalanche.core.ez_dex_swaps b on a.tx_hash = b.tx_hash
where a.block_timestamp::date >= '2023-08-03'
and platform ilike '%trader-joe%'
UNION
select date(a.block_timestamp) as date, 'Arbitrum' as chain, 'WETH' as token,
case when amount_in_usd is null then amount_out_usd
when amount_out_usd is null then amount_in_usd
when amount_in_usd>=amount_out_usd then amount_in_usd
when amount_out_usd>amount_in_usd then amount_out_usd end as amount_usd
, a.tx_hash, origin_from_address, concat(symbol_in,'/',symbol_out) as pair, tx_fee
from arbitrum.core.fact_transactions a join arbitrum.core.ez_dex_swaps b on a.tx_hash = b.tx_hash
where a.block_timestamp::date >= '2023-08-03'
and platform ilike '%trader-joe%'
UNION
select date(a.block_timestamp) as date, 'Ethereum' as chain, 'WETH' as token,
case when amount_in_usd is null then amount_out_usd
when amount_out_usd is null then amount_in_usd
when amount_in_usd>=amount_out_usd then amount_in_usd
when amount_out_usd>amount_in_usd then amount_out_usd end as amount_usd
, a.tx_hash, origin_from_address, concat(symbol_in,'/',symbol_out) as pair, tx_fee
from ethereum.core.fact_transactions a join ethereum.core.ez_dex_swaps b on a.tx_hash = b.tx_hash
where a.block_timestamp::date >= '2023-08-03'
and platform ilike '%trader-joe%'
UNION
select date(a.block_timestamp) as date, 'BSC' as chain, 'WBNB' as token,
case when amount_in_usd is null then amount_out_usd
when amount_out_usd is null then amount_in_usd
when amount_in_usd>=amount_out_usd then amount_in_usd
Run a query to Download Data