Afonso_DiazTop swap tokens
    Updated 2025-05-21
    with

    main as (
    select
    tx_id,
    block_timestamp,
    nvl(from_amount_usd, to_amount_usd) as amount_usd,
    from_address as user,
    from_asset as symbol_in,
    to_asset as symbol_out,
    iff(symbol_in > symbol_out, symbol_in || ' - ' || symbol_out, symbol_out || ' - ' || symbol_in) as pair,
    pool_name as pairs
    from thorchain.defi.fact_swaps
    where block_timestamp::date between '{{ start_date }}' and '{{ end_date }}'
    and amount_usd <= 1e6
    and affiliate_address = 'lifi'
    )

    select
    pairs,
    count(distinct tx_id) as transactions,
    count(distinct user) as users,
    sum(amount_usd) as total_volume_usd,
    avg(amount_usd) as average_amount_usd,
    sum(amount_usd) as platform_fee_volume_usd,
    avg(amount_usd) as average_platform_fee_usd,
    transactions / count(distinct block_timestamp::date) as daily_average_transactions
    from main
    where pair is not null
    group by 1
    order by transactions desc
    limit 10
    Last run: 12 days ago
    PAIRS
    TRANSACTIONS
    USERS
    TOTAL_VOLUME_USD
    AVERAGE_AMOUNT_USD
    PLATFORM_FEE_VOLUME_USD
    AVERAGE_PLATFORM_FEE_USD
    DAILY_AVERAGE_TRANSACTIONS
    1
    ETH.ETH851165658757211.72901661816.7517001518757211.72901661816.75170015136.685345
    2
    BSC.BNB520142844509295.12246538727.7751972994509295.12246538727.77519729921.852941
    3
    BSC.USDT-0X55D398326F99059FF775485246999027B3197955264021721917076.48074733378.0470283471917076.48074733378.04702834712.165899
    4
    AVAX.AVAX188615242169344.617383031025.6948545552169344.617383031025.6948545558.025532
    5
    ETH.USDT-0XDAC17F958D2EE523A2206206994597C13D831EC77726841193708.70954405636.644645091193708.70954405636.644645094.595238
    6
    BTC.BTC7504722989723.904493373668.3728889492989723.904493373668.3728889498.333333
    7
    BSC.USDC-0X8AC76A51CC950D9822D68B83FE1AD97B32CD580D620568324262.703561605289.262001393324262.703561605289.2620013933.115578
    8
    AVAX.USDC-0XB97EF9EF8734C71904D8002F8B6BC66DD9C48A6E394350408344.904331721500.422676877408344.904331721500.4226768772.417178
    9
    ETH.USDC-0XA0B86991C6218B36C1D19D4A2E9EB0CE3606EB48284252708047.3132315987.513686515708047.3132315987.5136865151.893333
    10
    AVAX.USDT-0X9702230A8EA53601F5CD2DC00FDBC13D4DF4A8C7154135123299.313799374145.400134197123299.313799374145.4001341971.524752
    10
    1KB
    4s