pietrektTC Aff Fees
    Updated 1 hour 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 1 hour agoAuto-refreshes every 24 hours
    DAY
    LABEL
    FEE_USD
    CUMULATIVE_FEE_USD
    TOTAL_CUMULATIVE_FEE_USD
    1
    2025-04-01 00:00:00.000Asgardex309.1828791481941711.0300109432342032.3749169
    2
    2025-04-01 00:00:00.000CS66.18891524319.35521487432342032.3749169
    3
    2025-04-01 00:00:00.000TrustWallet7466.94236670713937441.984961932342032.3749169
    4
    2025-04-01 00:00:00.000THORSwap5518.3779264867407362.8710520332342032.3749169
    5
    2025-04-01 00:00:00.000Ledger8775.4217953663483028.6243296732342032.3749169
    6
    2025-04-01 00:00:00.000Swapkit2023.662122335768301.26930998432342032.3749169
    7
    2025-04-01 00:00:00.000THORWallet36.4742435541881050.0782932632342032.3749169
    8
    2025-04-01 00:00:00.000Others5002.0322127441760397.053238632342032.3749169
    9
    2025-03-31 00:00:00.000Swapkit3268.287094798766277.60718764932312834.0924553
    10
    2025-03-31 00:00:00.000CS2.29686667253.16629963432312834.0924553
    11
    2025-03-31 00:00:00.000-10.493116091472.5786872232312834.0924553
    12
    2025-03-31 00:00:00.000TrustWallet19626.85811912613929975.042595132312834.0924553
    13
    2025-03-31 00:00:00.000Asgardex4282.9491705011941401.8471317932312834.0924553
    14
    2025-03-31 00:00:00.000Ledger73993.214840733474253.202534332312834.0924553
    15
    2025-03-31 00:00:00.000Others8325.5844935861755395.0210258632312834.0924553
    16
    2025-03-31 00:00:00.000THORWallet24.9268462411881013.6040497132312834.0924553
    17
    2025-03-31 00:00:00.000eld0.12738556562344.23902184732312834.0924553
    18
    2025-03-31 00:00:00.000ShapeShift168.3535235081016771.9410175332312834.0924553
    19
    2025-03-31 00:00:00.000THORSwap9227.3836927777401844.4931255432312834.0924553
    20
    2025-03-30 00:00:00.000giddy0.520438108926.31994133332193903.6173057
    ...
    10327
    803KB
    16s