Spot-WiggumSammy query
    Updated 2025-02-07
    WITH get_query AS (
    SELECT
    value[0]::timestamp_ntz AS week,
    value[4]::real AS weekly_affiliate_fees
    FROM (
    SELECT
    livequery.live.udf_api('https://flipsidecrypto.xyz/api/queries/7b114a42-14ef-46d5-837f-cc2dbd3ca0a3/latest-run') as response
    ), lateral FLATTEN (input => response:data:result:rows)
    ),
    fees AS (
    SELECT
    DATE_TRUNC('week', day) AS week,
    CASE
    WHEN week < '2024-07-26' THEN 'Pre-5bps Min'
    WHEN week >= '2024-07-26' AND week <= '2024-08-15' THEN '5bps min'
    WHEN week > '2024-08-15' AND week <= '2024-10-15' THEN '15bps min'
    ELSE '8bps Min'
    END AS "Min Fee",
    SUM(liquidity_fees_usd) AS liquidity_fees_usd,
    SUM(block_rewards_usd) AS block_rewards_usd,
    SUM(earnings_to_nodes_usd) AS earnings_to_nodes_usd,
    SUM(earnings_to_pools_usd) AS earnings_to_pools_usd,
    FROM thorchain.defi.fact_daily_earnings
    WHERE day >= '2024-01-01'
    GROUP BY week
    )
    SELECT
    DISTINCT f.week,
    f."Min Fee",
    ROUND(f.liquidity_fees_usd) AS liquidity_fees_usd,
    ROUND(f.block_rewards_usd) AS block_rewards_usd,
    ROUND(f.earnings_to_nodes_usd) AS earnings_to_nodes_usd,
    ROUND(f.earnings_to_pools_usd) AS earnings_to_pools_usd,
    gq.weekly_affiliate_fees,
    ROUND(f.liquidity_fees_usd + f.block_rewards_usd) AS "Protocol Earnings",
    ROUND(f.liquidity_fees_usd + f.block_rewards_usd + gq.weekly_affiliate_fees) AS "Ecosystem Revenue",
    Last run: 3 months ago
    WEEK
    Min Fee
    LIQUIDITY_FEES_USD
    BLOCK_REWARDS_USD
    EARNINGS_TO_NODES_USD
    EARNINGS_TO_POOLS_USD
    WEEKLY_AFFILIATE_FEES
    Protocol Earnings
    Ecosystem Revenue
    Earnings from Fees
    Earnings from Block Rewards
    FIFTY_PERCENT_LINE
    Node Earnings from Fees
    Node Earnings from Block Rewards
    1
    2025-02-03 00:00:00.0008bps Min5066171641833823042884956118967079973198875.524.55028873393571
    2
    2025-01-27 00:00:00.0008bps Min13530113462388150438842067261901699249242543979.620.450648970166073
    3
    2025-01-20 00:00:00.0008bps Min145373552021362370113502477811521973948275510073.626.450459331164370
    4
    2025-01-13 00:00:00.0008bps Min106851263155351755411825118624291700065256249462.937.150325289192265
    5
    2025-01-06 00:00:00.0008bps Min84916068224144303210883694841041531401201550555.444.650245661197371
    6
    2024-12-30 00:00:00.0008bps Min3792968358323376498774793254631215128154059131.268.850105396232254
    7
    2024-12-23 00:00:00.0008bps Min4260608421753462959219403562781268235162451333.666.450116337229958
    8
    2024-12-16 00:00:00.0008bps Min94848096167848941114207476942081910158260436649.750.350243015246396
    9
    2024-12-09 00:00:00.0008bps Min8412671069464468750144198162580019107322536532445650206384262366
    10
    2024-12-02 00:00:00.0008bps Min1281481124626760450119232479342212527747346196850.749.350306461298040
    11
    2024-11-25 00:00:00.0008bps Min856798103054247895314083867739141887339266125345.454.650217431261522
    12
    2024-11-18 00:00:00.0008bps Min1126790967895542889155179610604312094685315511653.846.250292035250854
    13
    2024-11-11 00:00:00.0008bps Min14840381028375611318190109512081702512413372058359.140.950361095250223
    14
    2024-11-04 00:00:00.0008bps Min98833695996645381114944917231391948302267144150.749.350230209223601
    15
    2024-10-28 00:00:00.0008bps Min72632910177317749499691114543401744060219840041.658.450322734452214
    16
    2024-10-21 00:00:00.0008bps Min4951279407828000516358582523121435909168822134.565.550275872524179
    17
    2024-10-14 00:00:00.00015bps min6825649276359343226758772880221610199189822142.457.650396059538263
    18
    2024-10-07 00:00:00.00015bps min55070189914982960362024717753914498501627389386250315111514493
    19
    2024-09-30 00:00:00.00015bps min5122258856058082695895611804241397830157825436.663.450296184512084
    20
    2024-09-23 00:00:00.00015bps min91790495867610558588207222185181876580209509848.951.150516459539399
    58
    7KB
    2s