The KE Ratio on PeakD with Tampermonkey - Just a Prototype
development·@louis88·
102.997 HBDThe KE Ratio on PeakD with Tampermonkey - Just a Prototype
Maybe some of you on HIVE have seen it before, there’s something called a KE Ratio for every account. It shows how much a user has earned from author rewards plus curation rewards over time. If you divide this total by the user's current Hive Power, you get the KE Ratio. It’s a small but interesting number that shows how efficiently someone is using their stake. Some more details about this were shared by @azircon a while ago, and there’s even a cool tool where you can check your own value at: https://beebalanced.streamlit.app. Today I saw someone asking about it in the Hive Chat, so I thought why not build a small prototype? And that’s what this is. A simple Tampermonkey script that shows the KE Ratio directly on PeakD.com, next to the reputation number of each user in your feed. It works like this: for every user shown in the post list, the script makes a request to the API by @techcoderx, gets the author rewards, curation rewards, and Hive Power, calculates the ratio, and then shows it nicely beside the reputation. ### Current Trending - Some Screenshots of the Result <div class="pull-left"><div class="text-justify">  </div></div> <div class="pull-right"><div class="text-justify">  </div></div> --- <div class="pull-left"><div class="text-justify">  </div></div> <div class="pull-right"><div class="text-justify">  </div></div> --- ### The Tampermonkey Script ``` // ==UserScript== // @name PeakD KE-Ratio Viewer (Styled) // @namespace http://tampermonkey.net/ // @version 1.1 // @description Display KE-Ratio on PeakD next to user reputation label with consistent styling and tooltip // @author louis88 // @match https://peakd.com/* // @grant GM_xmlhttpRequest // @connect techcoderx.com // @run-at document-end // ==/UserScript== (function () { 'use strict'; const KE_CACHE = {}; function getUsernameFromHref(href) { const match = href.match(/\/@([\w\-.]+)/); return match ? match[1] : null; } function calculateKERatio(data) { const posting = parseFloat(data.posting_rewards) / 1000; const curation = parseFloat(data.curation_rewards) / 1000; const vesting = parseFloat(data.vesting_balance) / 1000; if (vesting === 0) return null; return ((posting + curation) / vesting).toFixed(2); } function fetchKE(username, callback) { if (KE_CACHE[username]) { callback(KE_CACHE[username]); return; } GM_xmlhttpRequest({ method: 'GET', url: `https://techcoderx.com/hafbe-api/accounts/${username}`, onload: function (response) { try { const json = JSON.parse(response.responseText); const ke = calculateKERatio(json); KE_CACHE[username] = ke; callback(ke); } catch (e) { console.error("KE parse error", e); callback(null); } }, onerror: function () { console.error("Failed to fetch KE data for", username); callback(null); } }); } function insertKELabel(container, keRatio) { if (!keRatio) return; const label = document.createElement("span"); label.textContent = `KE: ${keRatio}`; label.classList.add("label"); label.title = "KE Ratio = (Author Rewards + Curation Rewards) / HP"; // Match PeakD visual style a bit label.style.display = "inline-block"; label.style.padding = "4px 6px 4px 6px"; label.style.fontSize = "95%"; label.style.fontWeight = "500"; label.style.color = "#fff"; label.style.backgroundColor = "#313437"; // Muted dark gray label.style.borderRadius = "0.25em"; label.style.marginLeft = "6px"; label.style.lineHeight = "1"; label.style.verticalAlign = "baseline"; label.style.whiteSpace = "nowrap"; label.style.textAlign = "center"; label.style.textTransform = "uppercase"; label.style.letterSpacing = ".1px"; container.appendChild(label); } function processUsers() { const userLinks = document.querySelectorAll('a[href^="/@"]'); userLinks.forEach(link => { const username = getUsernameFromHref(link.getAttribute("href")); if (!username) return; const repLabel = link.parentElement?.querySelector(".reputation-label"); if (!repLabel || repLabel.dataset.keInjected) return; repLabel.dataset.keInjected = "true"; fetchKE(username, (ke) => { insertKELabel(repLabel.parentElement, ke); }); }); } // Initial run processUsers(); // Run again on DOM changes (dynamic content) const observer = new MutationObserver(() => { processUsers(); }); observer.observe(document.body, { childList: true, subtree: true }); })(); ``` To try it yourself, just install Tampermonkey on https://www.tampermonkey.net, copy the script into a new userscript, and visit PeakD. It will load automatically for each user you see in the normal Feeds. That’s all for now. It’s just a prototype, but it works. Maybe I’ll add more features later like color coding or sorting, but for now, it does exactly what it needs to: show the KE Ratio live on PeakD. More Reads about the KE-Ratio: https://peakd.com/@azircon/ke-ratio-as-a-guide --- <div class="pull-left"><div class="text-justify"> [](https://vote.hive.uno/@louis.witness) ##### Vote for my Hive Witness U can vote for my Witness using Hive Keychain here: https://vote.hive.uno/@louis.witness </div></div> <div class="pull-right"><div class="text-justify"> [](https://primersion.com/he-witnesses) ##### Vote for my Hive Engine Witness Vote for my Witness on Hive-Engine using Primersion Tool: https://primersion.com/he-witnesses <sup>Enter your Username and search for louis.witness</sup> </div></div>
👍 simba, photobook, ivan-jz4, cst90, dml28, minas-glory, joeyarnoldvn, decepticons, louis.pay, netaterra, sunsea, primersion, melvin7, hungryharish, zaddyboy, ridwant, netaterra.leo, drricksanchez, steemindian, zirochka, hungryanu, detlev, rivalzzz, kind.network, kesonaichi, ganjafarmer, ganjafrmer, rezfit, dandegrischdine, elderson, zeusflatsak, martial.media, woodathegsd, greenunion, vaporrhino, caelum1infernum, monzo, bhr-curation, coolsurfer, mv-curacion, midnight-studio, galaxiavtuber, summertooth, freed99, cryptoferyel, familiadare, chechostreet, alicia2022, hk-curation, gornat, sbi3, hashkings, pleo1542, s3rg4, d1785, satren, nerdtopiade, sbi-tokens, t-nil, sneakyninja, thedailysneak, legendarydragons, city-of-dresden, ro-witness, germansailor, broxi, ripperone, therealwolf, sabine-reichert, sparschwein, dachcolony, driveforkids, szf, cocaaladioxine, roomservice, smartsteem, unpopular, hiveonboard, ausbit.dev, udabeu, webhoster, matschi, properfraction, dreimaldad, helpyou, monster.oo7, alexvan, kobold-djawa, sourovafrin, racibo, epicdice, tinyhousecryptos, meins0815, tokenindustry, jeffjagoe, muscara, kakakk, victor-alexander, blue.rabbit, logic, hanshotfirst, freiheit50, jeanpi1908, themightyvolcano, flores39, riyuuhi, hatoto, a1004, blackmedschn, cryptoriddler, mapetoke, reconnectnature, etblink, sportschain, jagoe, backinblackdevil, mrhoofman, megstarbies, techslut, j-p-bs, scylla1, ctf, rmp, heteroclite, tebesc, odessamama, solarwarrior, lauchmelder, crimo, meanbees, shebe, davidtron, monsterchiller, foodiefrens, besheda, abcor, cards4rent, mballesteros, obvious, michaelreischer, uwelang, k3ldo, cryptomonica, visionarystudios, naters, leprechaun, keepinitsteem, bellscoin, doodleman, calimeatwagon, silasvogt, rcshad0w, sonius94, iamtom, gerusan, nujzzmc, reinhard-schmid, letsplaywhatelse, emitste, steemcartel, northmen, gameexx, beerlover, retard-gamer-de, voxmortis, vikisecrets, penguinpablo, cryptonized, hungrybear, funnyman, alphacore, juanmcar, jacuzzi, kissi, careassaktart, naylet, sorin.cristescu, powpow420, tixinhacapitinha, makney, daudmuhammad2022, jedigeiss, grider123, c0wtschpotato, steemmonsterking, techcoderx, onelovedtube, hive-134220, gaborockstar, bishoppeter1, happymichael, originalmrspice, mrchef111, darkfuseion, gisi, illuminationst8, joeytechtalks, brettblue, toddmck, melor9, icepee, dlike, cowboysblog, iamangierose, zeruxanime, aletoalonewolf, gabbyg86, humanearl, neeqi, neopatriarch, crowbarmama, brainpod, smacommunity, crazy.men, st3llar, adventuroussoul, jeronimorubio, raoufwilly, shermanedwards, gray00, amymya, camuel, openmind3000, jlufer, tonysayers33, aperterikk, bil.prag, bravetofu, dexy50, miloshpro, marjanko, steemulant, steemtelly, flummi97, usainvote, buttcoins, karizma, slobberchops, liz.writes, ernestopg, arc7icwolf, learn2code, almi, preparedwombat, leaky20, azircon, tarazkp, gogreenbuddy, babytarazkp, jelly13, bgmoha, mhm-philippines, michupa, aiuna, elderdark, beffeater, abreusplinter, acidyo, dejan.vuckovic, xves, juanvegetarian, ghaazi, rendrianarma, gloriaolar, okarun, freedomring, dantrin, sudeon, avataroflife, diannever, meltysquid, godfish, petrvl, espoem, photoparadise, nikdo, zihadlo, actifit-godfish, belahejna, maajaanaa, djccdigital, no-advice, ogfox, tonyz, ph1102, cryptofiloz, papilloncharity, abouttodie, leslierevales, stayoutoftherz, tehox, dividendencheck, asgarth, ryanaa, coinjoe, revisesociology, bpcvoter3, ninnu, cookaiss, marsupia, revise.spk, oflyhigh, wherein, cnstm, likuang007, lianjingmedia, meesterboom, chisomdamian, zerofive, wisbeech, starrouge, unclefunker, b00m, citizensmith, bluerobo, blue-witness, ynwa.andree, jasonwaterfalls, berlinrebels, sazbird, ourfadedglory, dstampede, kaminchan, incublus, finpulse, masterswatch, bagpuss, geom, cryptoreforma, photographercr, myfreebtc, sofathana, santigs, softworld, evildeathcore, lisfabian, bozz, chinito, pompeylad, galenkp, hive-168869, farpetrad, franzpaulie, springlining, celestegray, gollumkp, fw206, woelfchen, miosha, wiseagent, lrekt01, aftersound, thejedo, spectrumecons, vegoutt-travel, captainhive, unitmaster, aequi, jorge234nv, artlover, rmach, trafalgar, kaykunoichi, raindrop, traf, kattycrochet, atongis, peak.open, riseofthepixels, peakmonsters, peakd, gezellig, pixels.vault, dreamon, kingkinslow, steempeak, bilpcoin.pay, mozzie5, acantoni, kstop1, condeas, el-dee-are-es, linuxbot, trcommunity, deathwing, emrebeyler, sudefteri, hykss.leo, bilgin70, dusunenkalpp, ipexito, mukadder, hive-188753, qurat-ul-ain, akifane, bdvoter, zaku, bdvoter.cur, anhdaden146, rehan12, dogancankilment, kadoshmenorah, ifeoluwa88, hmetu, zayedsakib, titopx, marianaemilia, rana2423, zaku-spt, zaku-ag, minhajulmredol, cescajove, jessicaossom, rosmiapure, dirego1, xykorlz, lincemarrom, djrockx, jeffqt, kalkulus, dhoangphat1, pero82, rogerlabanane, muhammadakash, valchiz, blog-beginner, catharsis, xawi, deepu7, tomlee, magin.pintor, cryptosimplify, bitri, jdike, chrysanthemum, iamgem005, nozem01, kid.miniatures, arveno, vickyanne, hugo4u, blind-spot, alg-nftgaming, hivedeb, stefanialexis, gabrielrr17, gomster, synergized, anjanida, bastter, diego1306, goliathus, brucolac, vitoragnelli, adulruna, emd012, hkinuvaime, kojiri, lobaobh, jpleron, elfino28, bteim, highfist, dub-c, deggial, janetohiri, passion-fruit, joanstewart, fortune-master, floatinglin, ericpso, hyper.speed, gadrian, imbartley, michelleeeeys, m1alsan, farm1, willmington-w, olaunlimited, garute, mein-senf-dazu, patchwork, freegifts, hive-coding, hivegadgets, hivetycoon, v-36, enira, votebetting, rufruf, rus-lifestyle, hivebuilder, yuli05, onezetty, grindle, loading, alexcas, coldbeetrootsoup, minigunner, hive-132595, dovycola, like2cbrs, cbrsphilanthropy, setpiece, mirroredspork, titusfrost, ssekulji, hivebuzz, lizanomadsoul, pinmapple, roelandp, itchyfeetdonica, tikki00taffi, discovereurovelo, musicandreview, kimzwarch, gabrielatravels, crimsonclad, anarcist69, clayboyn, bigdizzle91, blarchive, anarcist, kesilgonzalez, alex-rourke, darkflame, memepress, tzae, minerspost, kachy2022, arcange, achimmertens, laruche, walterjay, felt.buzz, aidefr, robotics101, dragibusss, fighter4-freedom, twoitguys, roozeec, imcore, nicolebanilad, gaposchkin, oasiskp2, chris-chris92, gameonn, josemalavem, jarvie, jarv-ai, softa, reidenling90, elevator09, sirsmokesalot96, guest4test, rubelynmacion, jane1289, dkkfrodo, szejq, hivelife-pl, hive-lu, lolz.byte, sniki003, lxsxl, urun,