mariyaFTX Vs other tokens balance
Updated 2022-11-09
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
›
⌄
--CREDIT: CarlowsOs https://app.flipsidecrypto.com/velocity/queries/23b11286-fbb5-4c3b-8925-2a35fab3ef0c
WITH ftx AS (--mirar crosschain
SELECT address
FROM ethereum.core.dim_labels
WHERE address_name ilike '%ftx%'
AND label_subtype = 'hot_wallet'
--'0xC098B2a3Aa256D2140208C3de6543aAEf5cd3A94', '0x2faf487a4414fe77e2327f0bf4ae2a264a776ad2'
),
last_date_change AS ( SELECT block_timestamp::DATE AS balance_date, user_address,
CASE
WHEN symbol = 'ETH' THEN 'ETH'
ELSE contract_address
END AS contract_address, MAX(block_timestamp) AS last_change
FROM ethereum.core.ez_balance_deltas
WHERE block_timestamp::DATE >= CURRENT_DATE-30
AND user_address IN (SELECT address FROM ftx)
GROUP BY 1, 2, 3
),
base_table AS ( SELECT block_timestamp::DATE AS balance_date,
CASE
WHEN b.symbol = 'ETH' THEN 'ETH'
ELSE b.contract_address END AS contract_address, b.user_address, b.symbol, current_bal, current_bal_usd
FROM ethereum.core.ez_balance_deltas b
JOIN last_date_change l
ON block_timestamp = last_change
AND b.user_address = l.user_address
AND b.contract_address = l.contract_address
), all_days AS (
SELECT date_day AS balance_date
FROM ethereum.core.dim_dates
), address_ranges AS (
SELECT user_address, contract_address, symbol, MIN( balance_date::DATE
) AS min_block_date,
CURRENT_DATE()::DATE AS max_block_date
FROM base_table
GROUP BY user_address, contract_address, symbol, max_block_date
Run a query to Download Data