binhachonHODL or Sell (that is the question)
Updated 2022-04-02
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
from_address,
sum(amount) as staked_amount,
sum(amount_usd) / sum(amount) as staked_avg_price
from ethereum.udm_events
where block_timestamp > getdate() - interval'180 days' --tx_id = '0xee0915eb747cb1eb85f8ebfe8c77154a694d03a061e235c30c1c70c4ee2c9517'
and origin_function_signature = '0xa1903eab'
and symbol = 'ETH'
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 from_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
Run a query to Download Data