winnie-fssmart trader check (3) copy
Updated 2023-03-15
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 smart_trader as (select '{{address}}' as address),
smart_trader_balance as
(select
-- distinct concat(block_timestamp, address, b.symbol, contract_address, token_name, current_bal, curren_bal_usd) as id,
max(b.block_timestamp) over() as max_timestamp,
b.block_timestamp,
s.address,
b.contract_address,
b.symbol,
b.token_name,
b.current_bal,
b.current_bal_usd,
b.prev_bal,
b.prev_bal_usd
from ethereum.core.ez_balance_deltas b
inner join smart_trader s
on b.user_address = s.address
and block_timestamp between dateadd(DAY, -30, current_date) and current_date
-- left join crosschain.core.dim_asset_metadata a
-- on b.contract_address = a.token_address
-- and b.symbol = a.symbol
qualify block_timestamp = max(block_timestamp) over(partition by symbol, token_name, block_timestamp::date)),
date_symbol_mapping AS
(select
t1.date_day,
t3.symbol,
t3.token_name,
t2.contract_address as address
from
(select
date_day
from ethereum.core.dim_dates where date_day between current_date - interval '30 days' and current_date ) t1
cross join
( SELECT
Run a query to Download Data