NineRealmsRUNE Earnings Distribution
    Updated 48 minutes ago
    -- forked from RUNE Earnings Distribution @ https://flipsidecrypto.xyz/edit/queries/46dc4fa4-a362-420e-97ec-d3a58d46b9e7

    WITH rewards AS (SELECT day,
    liquidity_fees, liquidity_fees_usd,
    block_rewards, block_rewards_usd,
    liquidity_fees * 100 / (liquidity_fees + block_rewards) AS pct_of_earnings_from_liq_fees,
    avg(pct_of_earnings_from_liq_fees) OVER(ORDER BY day
    ROWS BETWEEN 29 PRECEDING AND CURRENT ROW )
    as pctday_moving_average_30d,
    total_earnings, total_earnings_usd,
    earnings_to_nodes, earnings_to_nodes_usd,
    earnings_to_pools, earnings_to_pools_usd,
    floor(avg_node_count) as node_count, ROW_NUMBER() OVER(ORDER BY day) AS rownum
    from thorchain.defi.fact_daily_earnings),
    cumulative_rewards AS(SELECT day,
    liquidity_fees, liquidity_fees_usd,
    block_rewards, block_rewards_usd,
    pct_of_earnings_from_liq_fees,
    CASE
    WHEN pctday_moving_average_30d > 0 THEN pctday_moving_average_30d
    ELSE 0
    END AS pct_30d_moving_average,
    total_earnings, total_earnings_usd,
    earnings_to_nodes, earnings_to_nodes_usd,
    earnings_to_pools, earnings_to_pools_usd,
    (SELECT SUM(liquidity_fees_usd) FROM rewards as b WHERE b.rownum <= a.rownum) as liquidity_fees_usd_cumulative,
    (SELECT SUM(block_rewards_usd) FROM rewards as b WHERE b.rownum <= a.rownum) as block_rewards_usd_cumulative,
    (SELECT SUM(total_earnings_usd) FROM rewards as b WHERE b.rownum <= a.rownum) as total_earnings_usd_cumulative,
    (SELECT SUM(earnings_to_nodes_usd) FROM rewards as b WHERE b.rownum <= a.rownum) as earnings_to_nodes_usd_cumulative,
    (SELECT SUM(earnings_to_pools_usd) FROM rewards as b WHERE b.rownum <= a.rownum) as earnings_to_pools_usd_cumulative
    from rewards as a)

    select * from cumulative_rewards order by day DESC

    Last run: about 1 hour agoAuto-refreshes every 6 hours
    DAY
    LIQUIDITY_FEES
    LIQUIDITY_FEES_USD
    BLOCK_REWARDS
    BLOCK_REWARDS_USD
    PCT_OF_EARNINGS_FROM_LIQ_FEES
    PCT_30D_MOVING_AVERAGE
    TOTAL_EARNINGS
    TOTAL_EARNINGS_USD
    EARNINGS_TO_NODES
    EARNINGS_TO_NODES_USD
    EARNINGS_TO_POOLS
    EARNINGS_TO_POOLS_USD
    LIQUIDITY_FEES_USD_CUMULATIVE
    BLOCK_REWARDS_USD_CUMULATIVE
    TOTAL_EARNINGS_USD_CUMULATIVE
    EARNINGS_TO_NODES_USD_CUMULATIVE
    EARNINGS_TO_POOLS_USD_CUMULATIVE
    1
    2025-01-22 00:00:00.00018372.3431090763859.34786867713007.2891585845211.27208843458.54862463846.56848075931379.63226765109070.6199571119621.9693679333444.43794678821757.6628997275626.18201032367077600.9138566150469928.797256217547529.71111299409161.5415331118138368.169579
    2
    2025-01-21 00:00:00.00036843.36406339131032.40722215324642.2826053487639.59783017759.92189406745.93258032261485.64666873218672.00505232919275.875693668554.11978943542209.77097513150117.88526289567013741.5659879150424717.525167217438459.09115599375717.1035863118062741.987569
    3
    2025-01-20 00:00:00.00052221.04695286175395.22432825724974.0470108983880.52008634867.64814222245.18657102177195.09396375259275.74441460524174.6816498481195.68561820453020.41231391178080.05879640166882709.1587657150337077.927337217219787.08610399307162.9837968117912624.102306
    4
    2025-01-19 00:00:00.00042673.34950173144264.14927356325041.443645484656.64416473963.01924220544.3514469667714.79314713228920.79343830220515.4199553269355.69017670247199.37319181159565.103261666707313.9344375150253197.407251216960511.34168899225967.2981786117734544.04351
    5
    2025-01-18 00:00:00.00034728.72150533133920.118530424906.3747716996043.40491127458.23537425744.17196294659635.09627702229963.52344167517506.1460781167506.80866357842128.95019891162456.71477809766563049.7851639150168540.763086216731590.5482599156611.6080019117574978.940248
    6
    2025-01-17 00:00:00.00054714.32758255226959.04046201325047.59418993103899.25627161468.59705278744.13389498279761.92177248330858.29673362624120.94599729100055.45166065355640.97577519230802.84507297466429129.6666335150072497.358175216501627.02480899089104.7993384117412522.22547
    7
    2025-01-16 00:00:00.00043038.50582619154154.01818663225323.7520426890703.84898365862.95653064743.43371254168362.25786887244857.8671702921848.2171932278255.28340018746514.04067565166602.58377010366202170.6261715149968598.101903216170768.72807598989049.3476777117181719.380397
    8
    2025-01-15 00:00:00.00045611.44545034164756.76514215324757.3584010889428.04253085764.81770749842.80728100470368.80385142254184.8076730121984.4155325679411.67290190548384.38831886174773.13477110566048016.6079849149877894.25292215925910.86090598910794.0642775117015116.796627
    9
    2025-01-14 00:00:00.00031553.92551552104036.66583778425196.6466325483076.03770735155.601070342.43956968356750.57214806187112.70354513517027.2677620256140.72218736939723.30438604130971.98135776665883259.8428427149788466.210389215671726.05323298831382.3913756116840343.661856
    10
    2025-01-13 00:00:00.00042402.45333087140421.50481986425288.2689311783745.55004861262.64145500941.66251016467690.72226204224167.05486847620179.7906621766828.12783544247510.93159987157338.92703303465779223.1770049149705390.172681215484613.34968698775241.6691882116709371.680498
    11
    2025-01-12 00:00:00.00016932.5290481158675.03961300225261.146686487535.5818544940.13049053840.61158291642193.67573451146210.62146749212909.3768803244733.90818818629284.29885419101476.71327930665638801.6721851149621644.622633215260446.29481898708413.5413528116552032.753465
    12
    2025-01-11 00:00:00.00024849.1320310588034.8907332425265.9778569589511.6818215549.58411163140.56938897750115.109888177546.5725547915016.5615278753200.30299823535098.54836013124346.26955655565580126.632572149534109.040778215114235.6733598663679.6331646116450556.040186
    13
    2025-01-10 00:00:00.00071974.12616548257738.74955769425265.7266801490476.35793776474.01710724540.45587143397239.85284562348215.10749545827168.565019497290.4062673570071.28782622250924.70122810865492091.7418388149444597.358957214936689.10079698610479.3301664116326209.770629
    14
    2025-01-09 00:00:00.00055758.93940316190877.37200681924772.6503729484803.23426959969.23859265439.35456278280531.5897761275680.60627641722660.0458462977571.23874649557871.54392981198109.36752992265234352.9922811149354121.001019214588473.993398513188.923899116075285.069401
    15
    2025-01-08 00:00:00.00024108.1487779196189.06977715424621.5874570298237.63805944649.47317724438.83465500148729.73623493194426.707836614631.5424926258378.37134386734098.19374231136048.33649273365043475.6202743149269317.766749214312793.38702498435617.6851525115877175.701871
    16
    2025-01-07 00:00:00.00017744.7287045978259.30187009724283.69169712107097.98896805442.22078425739.02967441442028.42040171185357.29083815212199.0166270453801.13388191229829.40377467131556.15695623964947286.5504971149171080.12869214118366.67918798377239.3138087115741127.365378
    17
    2025-01-06 00:00:00.00015985.0757858979385.47429044925085.14555825124578.46334043838.92132855138.76878520841070.22134414203963.93763088711690.2350080958056.33098738329379.98633605145907.60664350464869027.248627149063982.139722213933009.38834998323438.1799268115609571.208422
    18
    2025-01-05 00:00:00.0009619.091127447492.42247951825027.29605993123567.48701677527.76361955338.70185773434646.38718733171059.9094962939712.1039825747951.65566020624934.28320476123108.25383608764789641.7743366148939403.676382213729045.45071898265381.8489394115463663.601779
    19
    2025-01-04 00:00:00.00012057.9743751762403.06742088324618.04474885127404.60863777232.87699882139.18943921336676.01912402189807.67605865510092.5213432952231.35082530426583.49778073137576.32523335164742149.3518571148815836.189365213557985.54122298217430.1932792115340555.347943
    20
    2025-01-03 00:00:00.00011446.2049702158535.72513963924907.96420887127378.9653874831.48526077940.23759885436354.16917908185914.69052711910028.4213723251285.20051513926325.74780676134629.4900119864679746.2844362148688431.580727213368177.86516398165198.8424539115202979.022709
    ...
    1360
    386KB
    3s