Saleh8. Impermanent Loss - token name
    Updated 2022-01-12
    -- with list_tx_id_curve as (
    select
    symbol as token_name
    -- pool_name
    ,week(BLOCK_TIMESTAMP) as weekly
    ,sum( iff(direction='IN',amount_usd,0)-iff(direction='OUT',amount_usd,0)) as Impermanent_Loss
    -- ,sum(iff(direction='IN',amount_usd,0)) as amount_in_sum , sum(iff(direction='OUT',amount_usd*-1,0) as amount_in_out
    from ethereum.dex_swaps
    inner join ethereum.token_prices_hourly th on th.token_address = ethereum.dex_swaps.token_address
    where platform like '%curve%'
    and AMOUNT_USD!=0
    and block_timestamp::date > current_date-365
    and pool_name != '0xd81da8d904b52208541bade1bd6595d8a251f8dd'
    and pool_name like '%LP%'
    group by 1,2
    having sum( iff(direction='IN',amount_usd,0)-iff(direction='OUT',amount_usd,0))<0
    -- order by BLOCK_TIMESTAMP
    -- )

    Run a query to Download Data