binhachonCopy of Gain or Lose? - stETH sellers over the last 90 days
Updated 2022-06-13
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 pool_address as (
select
distinct pool_address
from ethereum.dex_swaps
where token_address = '0xae7ab96520de3a18e5e111b5eaab095312d7fe84'
),
stETH_swap as (
select
block_timestamp,
tx_id,
amount_in,
amount_out,
direction
from ethereum.dex_swaps
where token_address = '0xae7ab96520de3a18e5e111b5eaab095312d7fe84'
),
WETH_swap as (
select
tx_id,
amount_in,
amount_out
from ethereum.dex_swaps
where pool_address in (select * from pool_address)
and token_address = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
),
stETH_WETH_swap as ( --swap from stETH -> WETH => stETH in
select
block_timestamp,
stETH_swap.tx_id,
sum(WETH_swap.amount_out) as s_amount_out,
sum(stETH_swap.amount_in) as s_amount_in,
s_amount_out - s_amount_in as gain_amount,
100 * gain_amount / s_amount_in as gain_perc
from stETH_swap
inner join WETH_swap on (stETH_swap.tx_id = WETH_swap.tx_id)
where direction = 'IN'
Run a query to Download Data