RayyykTC AffiliatesTrader CRM
    Updated 14 hours ago
    with table_1 as (select date_trunc('day', block_timestamp) as day,
    from_address,
    a1.value::string as affiliate_address,
    a2.value::number as affiliate_fee_basis_points,
    tx_id,
    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 concat(from_asset_names, ' -> ', to_asset_names) ilike '%rune' then 2 else 1 end as numbering,
    sum(from_amount_usd / rune_usd) as rune_volume,
    sum(from_amount_usd) as usd_volume
    from thorchain.defi.fact_swaps as t,
    lateral flatten(input => t.affiliate_addresses_array) a1,
    lateral flatten(input => t.affiliate_fee_basis_points_array) a2
    where affiliate_address is not null
    and a1.path = a2.path
    and block_timestamp >= '{{Start_Date}}'
    and block_timestamp <= '{{End_Date}}'
    group by 1,2,3,4,5,6,7,8),

    table_2 as (select day,
    from_address,
    tx_id,
    affiliate_address,
    affiliate_fee_basis_points,
    array_agg(distinct assets) within group (order by assets asc) as swap_direction,
    sum(rune_volume) as swap_volume_rune,
    sum(usd_volume) as swap_volume_usd
    Last run: about 14 hours agoAuto-refreshes every 24 hours
    Address
    Total TX
    TX on Platform
    TX on Others
    % of TX on Platform
    Total $Vol
    $Vol on Platform
    $Vol on Others
    % of Vol on Platform
    Total Fees Paid
    Fees on Platform
    Fees on Others
    % of Fees on Platform
    Total Avg BPS
    Avg BPS on Platform
    Avg BPS on Others
    Lowest Swap
    Highest Swap
    Platform Used
    1
    0x0dc5a54e864b8f7b2b4e5072c57dc3c5ba67bfae101001004027.514027.5101007.727.72010019.1719.170125.031143.61ShapeShift
    2
    0xfb4db0b7f891694273f44ccaf1d75fa4b99cdfe79901009448.819448.81010010.5210.52010011.1311.130980.081557.23ShapeShift
    3
    0x5283a70dad5e0e598d117ba727969ab461c9045266010010640.9710640.97010069.9469.94010065.7365.730284.973929.84ShapeShift
    4
    0xa4a5689f688c0c4c9483497947af46fbd250aa955501002420.732420.7301000000000371.55599.33ShapeShift
    5
    0x36159d2343b992552263bfbcd9185cd04098ac695501002353.612353.610100000000079.89743.28ShapeShift
    6
    0x5daf465a9ccf64deb146eeae9e7bd40d6761c98644010015.0115.01010000000002.014.99ShapeShift
    7
    0x77653e011f44efe752d5e11c959b5ec4fa75a17b4401002752.872752.87010010.6310.63010038.6138.61086.751574.02ShapeShift
    8
    0x402775f7f1dbe266193efadf46ef7c562ba2ca9c440100109.86109.8601000000000569.86ShapeShift
    9
    0xe505e6d69a1c7a374bb63866221c2e390c22981b4401001006.781006.780100000000058.1499.47ShapeShift
    10
    0x52e1ee958b9dccb79c1214932a983bb7479331834401004540.714540.7101000000000607.52051.51ShapeShift
    11
    cosmos1rtppk52z2hxufgtfqkx7dw6p680q473xeangt793633.3337747.6919776.4517971.2452.39182.86133.5749.2973.0448.4467.5427.434238.429516.19SwapKit, THORSwap, ShapeShift
    12
    0xfee73611726fd31a50e297473dff75e2aead8c4d3301009045.159045.15010015.8315.83010017.517.501364.16153.8ShapeShift
    13
    qphgax8jtwn20kvrqfmxcps79n3wyhge7va8hnhngd33010013942.1413942.14010094.1794.17010067.5467.5402648.846564.43ShapeShift
    14
    0xba2cbccf92a726cfc7591119b487f51b4c1b39dc3301001012.861012.8601000000000303.49399ShapeShift
    15
    bc1qmkup25ggxdv5lckj6lgdr07a8cslux4hnwv6y633010020315.2720315.270100135.24135.24010066.5766.5707015215.9ShapeShift
    16
    0x69520fce540bb2a8632d6d2be45efba21d5263cf3301002956.212956.2101000000000973.39992.63ShapeShift
    17
    bc1qzmz6udgq9ytjjwr2aaasejdy4xmpcnj6whawwh3301003618.613618.61010024.4424.44010067.5467.5401004.171606.6ShapeShift
    18
    0x557c61ec8f7a675be03efe11962430ac8cff422933010014.9914.99010000000004.985.01ShapeShift
    19
    thor1ycgzfpcz93qa0xc392xgk75lfee5vdc59hv3r833010021.8921.89010000000005.089.98ShapeShift
    20
    thor1wrsru5klw2pjp7hu52lmt5qadlat44r579muq822010040.0640.060100000000010.0530.01ShapeShift
    ...
    383
    45KB
    5s