Afonso_DiazOvertime
    Updated 1 day ago
    with

    main as (
    select
    tx_hash,
    block_timestamp,
    origin_from_address as swapper,
    nvl(amount_in_usd, amount_out_usd) as amount_usd,
    symbol_in,
    symbol_out,
    token_in,
    token_out
    from
    base.defi.ez_dex_swaps
    where
    platform = 'alienbase'
    )
    ,

    overtime as (
    select
    date_trunc('{{ period }}', block_timestamp) as date,
    count(distinct tx_hash) as swaps,
    count(distinct swapper) as swappers,
    sum(amount_usd) as volume_usd,
    avg(amount_usd) as average_amount_usd,
    median(amount_usd) as median_amount_usd
    from main
    group by 1
    ),

    new_swappers as (
    select
    date_trunc('{{ period }}', min_date) as date,
    count(distinct swapper) as new_swapper
    from (
    Last run: 1 day ago
    DATE
    SWAPS
    SWAPPERS
    VOLUME_USD
    AVERAGE_AMOUNT_USD
    MEDIAN_AMOUNT_USD
    NEW_SWAPPERS
    RETURNING_SWAPPERS
    CUMULATIVE_SWAPS
    CUMULATIVE_VOLUME_USD
    1
    2023-08-01 00:00:00.00044000681119375791.68361.79239436185.02681104400019375791.68
    2
    2023-09-01 00:00:00.00028807100075884173.74158.45358125827.4833316747280725259965.42
    3
    2023-10-01 00:00:00.00031167126833812292.5572.5819158866.9810853183010397429072257.97
    4
    2023-11-01 00:00:00.00020950104041156492.2236.0783721733.978705169912492430228750.19
    5
    2023-12-01 00:00:00.0002710012011842693.2320.8959836845.6810226178515202431071443.42
    6
    2024-01-01 00:00:00.0002819710803526131.6512.1086200552.58197260618022131597575.07
    7
    2024-02-01 00:00:00.0002848512508835734.2621.9301020765.329568294020870632433309.33
    8
    2024-03-01 00:00:00.00082086307414135442.5146.66173030514.9625348539329079236568751.84
    9
    2024-04-01 00:00:00.0001635495630719418207.72108.81961691110.37452431106445434155986959.56
    10
    2024-05-01 00:00:00.0001237374185912430869.4393.17165793511.04274031445657807868417828.99
    11
    2024-06-01 00:00:00.000134247370745523843.5537.543199354.78268541022071232573941672.54
    12
    2024-07-01 00:00:00.000123587233578351228.9660.0298233156.4513745961283591282292901.5
    13
    2024-08-01 00:00:00.000110608194996043317.4748.14586778312.0110949855094652088336218.97
    14
    2024-09-01 00:00:00.00099497211103588057.5532.117094384.1133917719104601791924276.52
    15
    2024-10-01 00:00:00.000908411934510110449.6795.34652033717.291130780381136858102034726.19
    16
    2024-11-01 00:00:00.0002022842993541323530.37170.25255694941.2318405115301339142143358256.56
    17
    2024-12-01 00:00:00.0001621513910925499714.36143.09764621439.13524205149041501293168857970.92
    18
    2025-01-01 00:00:00.0001329883168913568553.4695.90100335721.5919091125981634281182426524.38
    19
    2025-02-01 00:00:00.0002686394895311691521.3641.4778282510.1336872120811902920194118045.74
    20
    2025-03-01 00:00:00.000205079257124322027.7420.0978741593.4915276104362107999198440073.48
    22
    2KB
    18s