MLDZMNSwaps retention
    Updated 2025-05-10
    with pools as (select
    *
    from $query('ea03a1b6-f263-4068-a664-4b66a50adef9')
    ),
    ---------------------------------------------------
    price_tab as (select
    HOUR::date as day,
    TOKEN_ADDRESS,
    SYMBOL,
    avg(PRICE) as price
    from ethereum.price.ez_prices_hourly
    where HOUR >= '2024-06-10'
    group by 1,2,3
    ),
    ---------------------------------------------------
    swaps as (select
    *
    from ethereum.core.fact_event_logs
    where TOPICS[0]= '0x103ed084e94a44c8f5f6ba8e3011507c41063177e29949083c439777d8d63f60'
    and CONTRACT_ADDRESS in (select POOL from pools)
    ),


    swaps1 as (select
    s.BLOCK_TIMESTAMP,
    s.tx_hash,
    t.ORIGIN_FROM_ADDRESS,
    s.CONTRACT_ADDRESS as pool,
    max(case when TO_ADDRESS = s.CONTRACT_ADDRESS then t.FROM_ADDRESS end) as taker,
    max(case when FROM_ADDRESS = s.CONTRACT_ADDRESS then t.CONTRACT_ADDRESS end) as token_bought,
    max(case when FROM_ADDRESS = s.CONTRACT_ADDRESS then RAW_AMOUNT end) as token_bought_raw,
    max(case when TO_ADDRESS = s.CONTRACT_ADDRESS then t.CONTRACT_ADDRESS end) as token_sold,
    max(case when TO_ADDRESS = s.CONTRACT_ADDRESS then RAW_AMOUNT end) as token_sold_raw
    from ethereum.core.fact_token_transfers t
    left join swaps s on t.tx_hash = s.tx_hash
    --where t.tx_hash = '0xcd8eed2631df876a851206eedbd929c645e1de41d79512944928219bed517939'
    Last run: 20 days ago
    COHORT_DATE
    MONTHS
    RETENTION_RATE
    1
    2025-0413.43
    2
    2025-03110.39
    3
    2025-0322.17
    4
    2025-02114.68
    5
    2025-0227.37
    6
    2025-0231.91
    7
    2025-01110.49
    8
    2025-0128.21
    9
    2025-0135.32
    10
    2025-0141.45
    11
    2024-12111.3
    12
    2024-1228.99
    13
    2024-1237.8
    14
    2024-1245.87
    15
    2024-1251.69
    16
    2024-11110.12
    17
    2024-11210.03
    18
    2024-11310.22
    19
    2024-1149.24
    20
    2024-1157.24
    66
    1KB
    166s