binhachonHODL or Sell? - #2
Updated 2022-06-12
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 stETH_stake as (
select
to_address,
sum(amount) as staked_amount,
sum(amount_usd) / sum(amount) as staked_avg_price
from ethereum.core.ez_token_transfers
where contract_address = '0xae7ab96520de3a18e5e111b5eaab095312d7fe84'
and from_address = '0x0000000000000000000000000000000000000000'
and amount_usd is not null
group by 1
),
current_balance as (
select
user_address,
non_adjusted_balance/1e18 as current_amount,
price
from ethereum.erc20_balances
where balance_date in (select max(balance_date) from ethereum.erc20_balances)
and contract_address = '0xae7ab96520de3a18e5e111b5eaab095312d7fe84'
and user_address in (select to_address from stETH_stake)
),
ETH_price as (
select
max(price) as current_price
from current_balance
),
summary_table as (
select
coalesce(current_amount, 0) as non_null_current_amount,
current_price,
staked_amount,
staked_avg_price,
round(100 * (current_price / staked_avg_price - 1), -1) as increase_from_staked_price,
case
when non_null_current_amount >= staked_amount then staked_amount
else non_null_current_amount
Run a query to Download Data