misaghlbGain or Lose - distribution wallets LIDO Swaps ETH => stETH - in 2022
    Updated 2022-06-11
    with wallets as (
    SELECT ORIGIN_FROM_ADDRESS as wallet,
    sum(AMOUNT_OUT) - sum(AMOUNT_IN) as total_profit_loss
    FROM ethereum.core.ez_dex_swaps
    where date(BLOCK_TIMESTAMP) >= '2022-01-01'
    and SYMBOL_IN = 'WETH'
    and SYMBOL_OUT = 'stETH'
    GROUP BY wallet
    ORDER BY total_profit_loss DESC
    ),
    total_profit_losss_dist as (
    SELECT
    case
    when total_profit_loss >=5 then 'Profit above 5 ETH'
    when total_profit_loss <5 and total_profit_loss >= 3 then 'Profit 3 - 5 ETH'
    when total_profit_loss <3 and total_profit_loss >= 1 then 'Profit 1 - 3 ETH'
    when total_profit_loss <1 and total_profit_loss >= 0.5 then 'Profit 0.5 - 1 ETH'
    when total_profit_loss <0.5 and total_profit_loss >= 0.1 then 'Profit 0.1 - 0.5 ETH'
    when total_profit_loss <0.1 and total_profit_loss>0 then 'Profit below 0.1 ETH'
    when total_profit_loss=0 then 'No Profit/Loss'
    when total_profit_loss<0 then 'Loss'
    end as bal_dist
    from wallets
    )
    SELECT bal_dist, count(bal_dist) as counts from total_profit_losss_dist
    group by bal_dist

    Run a query to Download Data