adriaparcerisasUNiswap impermanent loss 3 eth
    Updated 2023-07-04
    with
    ethereum_raw as (
    select
    block_timestamp::date as date,
    case when token_in = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' then amount_in/amount_out else amount_out/amount_in end as price,
    row_number() over (partition by block_timestamp::date order by block_timestamp) as nomor_asc,
    row_number() over (partition by block_timestamp::date order by block_timestamp desc) as nomor_dsc
    from
    ethereum.core.ez_dex_swaps
    where
    contract_address = lower('{{Ethereum_Pool_Address}}') --'0x397ff1542f962076d0bfe58ea045ffa2d347aca0'
    and
    amount_in_usd is not null
    and
    amount_out_usd is not null
    and platform ilike '%uniswap-v3%'

    )
    , max_min_eth as (
    select
    date,
    max(price) as max_price,
    min(price) as min_price
    from
    ethereum_raw
    group by 1
    )
    , first_eth as (
    select * from ethereum_raw where nomor_asc = 1
    )
    , last_eth as (
    select * from ethereum_raw where nomor_dsc = 1
    )
    , fix_eth as (
    select
    Run a query to Download Data