pietrektSwap Volume by Dex
    Updated 50 minutes ago

    -- DOUBLE COUNTING
    with init AS ( SELECT
    block_timestamp, tx_id, from_amount_usd,
    affiliate_address,
    array_size(affiliate_addresses_array) as aff_adds_count,
    CASE
    WHEN aff_adds_count >= 2 AND affiliate_address = '-_' THEN affiliate_addresses_array[1]
    ELSE affiliate_address
    END AS fixed_aff_add
    from thorchain.defi.fact_swaps
    ),

    swaps_filtered AS (SELECT min(to_date(block_timestamp)) as day, tx_id, sum(from_amount_usd) as swap_volume_usd,
    fixed_aff_add as aff_add
    FROM init WHERE AFFILIATE_ADDRESS IS NOT NULL AND (tx_id NOT IN (SELECT DISTINCT tx_id FROM thorchain.defi.fact_refund_events))
    group by tx_id, aff_add),

    asgardex_swaps AS (SELECT min(to_date(block_timestamp)) as day, tx_id, sum(from_amount_usd) as swap_volume_usd, max(min_to_amount) as min_to_amount,
    CASE
    WHEN min(affiliate_address) IS NULL THEN 'dx'
    END AS aff_add
    FROM thorchain.defi.fact_swaps group by tx_id),

    asgardex_swaps_filtered AS (SELECT day, tx_id, swap_volume_usd, aff_add from asgardex_swaps WHERE (RIGHT(min_to_amount, 3) = '999')),
    thorswap_swaps_before_aff_address AS (SELECT min(to_date(block_timestamp)) as day, tx_id, sum(from_amount_usd) as swap_volume_usd, max(min_to_amount) as min_to_amount,
    CASE
    WHEN min(affiliate_address) IS NULL THEN 'T'
    END AS aff_add
    FROM thorchain.defi.fact_swaps WHERE (to_date(block_timestamp) < '2022-04-24') group by tx_id),

    thorswap_swaps_before_aff_address_filtered AS (SELECT day, tx_id, swap_volume_usd, aff_add from thorswap_swaps_before_aff_address WHERE RIGHT(min_to_amount, 3) = '111'),
    trust_ios_swap_ids AS (SELECT max(to_date(block_timestamp)) AS day, tx_id FROM thorchain.defi.fact_swaps_events
    WHERE RIGHT(memo,3) like '%::0%' AND memo like '%=:%' AND block_timestamp < '2023-06-14'
    Last run: about 1 hour agoAuto-refreshes every 24 hours
    DAY
    LABEL
    SWAP_VOLUME_USD
    CUMULATIVE_SWAP_VOLUME_USD
    WEEKLY_VOLUME_USD
    MONTHLY_VOLUME_USD
    WEEKLY_TOTAL_VOLUME_USD
    MONTHLY_TOTAL_VOLUME_USD
    WEEKLY_PCT_OF_TOTAL
    MONTHLY_PCT_OF_TOTAL
    1
    2025-05-23 00:00:00.000Trustwallet2088568.564856275240140291.794316051401.627087466563474.1791632303119579.648953671555308.370265.2954024439.91183799
    2
    2025-05-23 00:00:00.000ShapeShift1971392.196883061251766829.475733007497.2255116611690558.5998756303119579.648953671555308.370260.99218177491.740818434
    3
    2025-05-23 00:00:00.000Others4249987.042635351025844663.2172719387224.698816538489151.2619587303119579.648953671555308.370266.3958998365.731344951
    4
    2025-05-23 00:00:00.000THORWallet9695599.623024141338381604.20906125456271.127546216920168.294555303119579.648953671555308.3702641.38837592532.301162033
    5
    2025-05-23 00:00:00.000THORSwap3543525.382604156593817509.68908108016397.22019200208324.676467303119579.648953671555308.3702635.6349125829.812633774
    6
    2025-05-23 00:00:00.000Asgardex3764870.751982922705305157.0379114816533.420507659246217.4098827303119579.648953671555308.370264.8880159568.82223946
    7
    2025-05-23 00:00:00.000Bitget928442.156231402312562208.8283187940056.2179784336056329.5761668303119579.648953671555308.370262.6194468295.369078187
    8
    2025-05-23 00:00:00.000Ledger387496.564617593542237389.8847818444198.1113160842381084.3721907303119579.648953671555308.370262.7857646556.310885171
    9
    2025-05-22 00:00:00.000THORWallet10216933.11299391328686004.58604115760671.504522207224568.671531303119579.648953671555308.3702638.189770430.857409075
    10
    2025-05-22 00:00:00.000Others5496496.13474131021594676.1746315137237.656181134239164.2193234303119579.648953671555308.370264.9938171845.098487614
    11
    2025-05-22 00:00:00.000Trustwallet2853328.72878225238051723.2294413962833.062231164474905.6143069303119579.648953671555308.370264.6063778129.600833291
    12
    2025-05-22 00:00:00.000Asgardex3215899.017315072701540286.2859311051662.668524755481346.6578998303119579.648953671555308.370263.645974538.26161985
    13
    2025-05-22 00:00:00.000Bitget1241244.41399674311633766.6720877011614.0617470335127887.4199354303119579.648953671555308.370262.3131511565.230825664
    14
    2025-05-22 00:00:00.000ShapeShift381668.5065918811249795437.278841036105.02862869719166.40299255303119579.648953671555308.370260.34181395671.447262241
    15
    2025-05-22 00:00:00.000Ledger2097053.15562444541849893.3201638056701.5466984941993587.8075731303119579.648953671555308.370262.6579284516.253183808
    16
    2025-05-22 00:00:00.000THORSwap13698369.95636636590273984.30647104472871.837585196664799.293863303119579.648953671555308.3702634.46589361229.284974274
    17
    2025-05-21 00:00:00.000Trustwallet5805555.321093215235198394.5006611109504.333448961621576.8855247303119579.648953671555308.370263.6650566579.175949638
    18
    2025-05-21 00:00:00.000ShapeShift70424.5570875021249413768.77225654436.5220367189337497.89640067303119579.648953671555308.370260.21590044521.390428723
    19
    2025-05-21 00:00:00.000Ledger885247.338276985539752840.1645395959648.3910740639896534.6519487303119579.648953671555308.370261.9661047295.940915686
    20
    2025-05-21 00:00:00.000Others6835838.141556591016098180.039899640741.5214398228742668.0845821303119579.648953671555308.370263.1805076844.280015023
    ...
    7627
    1MB
    9s