pietrektTC Aff Fees
    Updated 6 hours ago
    -- Query by @banbannard -- RELEVANT UP TO 01.11.2024
    with base as (select tx_id,
    to_date(block_timestamp) as date,
    affiliate_address, affiliate_fee_basis_points,
    split(from_asset, '-')[0] as from_assets,
    case
    when from_assets ilike '%/%' then split(from_assets, '/')[1]
    else split(from_assets, '.')[1]
    end as from_asset_names,
    split(to_asset, '-')[0] as to_assets,
    case
    when to_assets ilike '%/%' then split(to_assets, '/')[1]
    else split(to_assets, '.')[1]
    end as to_asset_names,
    concat(from_asset_names, ' -> ', to_asset_names) as assets,
    case when assets ilike '%RUNE' then 2
    else 1
    end as numbering,
    sum(from_amount_usd) as swap_volume
    from thorchain.defi.fact_swaps
    where date < '2024-11-01'
    group by tx_id, date,
    affiliate_address, affiliate_fee_basis_points,
    from_asset, to_asset),

    base2 as (select date,
    tx_id,
    affiliate_address, affiliate_fee_basis_points,
    array_agg(distinct assets) within group (order by assets asc) as swap_direction, --merging 2 sep path to 1
    sum(swap_volume) as swap_volume
    from base
    group by 1,2,3,4),

    base3 as (select date,
    tx_id,
    affiliate_address, affiliate_fee_basis_points,
    Last run: about 6 hours agoAuto-refreshes every 24 hours
    DAY
    LABEL
    FEE_USD
    CUMULATIVE_FEE_USD
    TOTAL_CUMULATIVE_FEE_USD
    1
    2025-05-23 00:00:00.000ecx0.3313143144870.25879492135334230.1826488
    2
    2025-05-23 00:00:00.000ShapeShift1836.4051007441040897.7318774335334230.1826488
    3
    2025-05-23 00:00:00.000THORSwap4465.4822835937826815.0545756435334230.1826488
    4
    2025-05-23 00:00:00.000THORWallet17835.6280703132506506.6864790535334230.1826488
    5
    2025-05-23 00:00:00.000rj7.2607197765554.31931876235334230.1826488
    6
    2025-05-23 00:00:00.000krt3.5497729719.61425277335334230.1826488
    7
    2025-05-23 00:00:00.000qaz4.9788243974.97882439735334230.1826488
    8
    2025-05-23 00:00:00.000Others4355.3535488411963898.0445802435334230.1826488
    9
    2025-05-23 00:00:00.000Swapkit1398.731800754899618.94885848435334230.1826488
    10
    2025-05-23 00:00:00.000TrustWallet2663.09645072914553707.53325235334230.1826488
    11
    2025-05-23 00:00:00.000t13.2049675723297.6411160135334230.1826488
    12
    2025-05-23 00:00:00.000leo96.3714446124662.76279596735334230.1826488
    13
    2025-05-23 00:00:00.000Ledger561.7405719684276614.9739892135334230.1826488
    14
    2025-05-23 00:00:00.000Asgardex1928.1915612922106819.8967718135334230.1826488
    15
    2025-05-22 00:00:00.000rj305.5196476085547.05859898535299069.8562169
    16
    2025-05-22 00:00:00.000THORWallet25579.399688762488671.0584087435299069.8562169
    17
    2025-05-22 00:00:00.000Asgardex2775.3594018862104891.7052105235299069.8562169
    18
    2025-05-22 00:00:00.000brt0.19316852281.0692342435299069.8562169
    19
    2025-05-22 00:00:00.000tcb0.14077030573534.86608700235299069.8562169
    20
    2025-05-22 00:00:00.000THORSwap23610.6675894777822349.5722920535299069.8562169
    ...
    10886
    849KB
    12s