matejchianaliza aktivnosti trajanje graf
    Updated 2025-02-10
    with tokens_eth as (
    select address
    from ethereum.core.dim_contracts
    where symbol ilike '%trump%' or name ilike '%trump%'
    ),
    swaps_eth as (
    select
    min(block_timestamp) as first_swap,
    max(block_timestamp) as last_swap,
    from ethereum.defi.ez_dex_swaps SWAPS
    join tokens_eth TOKENS on (TOKENS.address = SWAPS.token_in or TOKENS.address = SWAPS.token_out)
    group by TOKENS.address
    ),
    timespan_eth as (
    select
    case
    when timestampdiff(day, first_swap, last_swap) < 1 then 'Less than a day'
    when timestampdiff(day, first_swap, last_swap) between 1 and 7 then 'Less than a week'
    when timestampdiff(day, first_swap, last_swap) between 8 and 30 then 'Week to a month'
    when timestampdiff(day, first_swap, last_swap) between 31 and 365 then 'Month to a year'
    else 'More than a year'
    end as timespan,
    count(*) as token_count,
    min(timestampdiff(day, first_swap, last_swap)) as min_time_span -- mora bit poseben stolpec, da lahko urediš končni order by
    from swaps_eth
    group by timespan
    )
    select
    timespan,
    token_count,
    round((token_count * 100.0) / sum(token_count) over (), 1) as percent
    from timespan_eth
    order by min_time_span



    Last run: 2 months ago
    TIMESPAN
    TOKEN_COUNT
    PERCENT
    1
    Less than a day10552259.2
    2
    Less than a week3303718.5
    3
    Week to a month131007.4
    4
    Month to a year2642714.8
    5
    More than a year970.1
    5
    154B
    47s