🛠️ What’s New at hive.trading: ROI Calculation Upgrade!
Hello traders! Today we rolled out an important update to our ROI calculator on hive.trading — here’s what we tackled and how it benefits you:
🐛 The Issue
Some community members noticed wildly inflated ROI numbers after depositing large amounts of HIVE into their trading bots (hive accounts). Our previous formula only accounted for on-chain trades (“BUY” vs. “SELL”), but ignored any HIVE (or HBD) you manually top up which can skew the results. That meant your “initial investment” was under-counted, making your returns look enormous!
🔧 The Fix
On-Chain Deposit Scan
We now query your last month of Hive blockchain transfers (via getAccountHistoryAsync) to pick up every inbound transfer to your account.
Manual Deposit Events
If you’ve ever funded your bot with off-chain logic (e.g. rewards or “bonus” HIVE/HBD), our new DepositHistory collection captures those top-ups.True Initial Investment
Both on-chain + manual deposits roll into a new depositTotal, which seeds the “initial investment” in the ROI formula:
initialInvestment = depositTotal
+ sum(tradeBuys) // BUY orders × price
finalValue = sum(tradeSells) // SELL orders × price
roi = (finalValue - initialInvestment) / initialInvestment * 100
Now after running a curl we can confirm that the deposits are properly accounted for:
🧑💻 Under the Hood
We added a DepositHistory schema alongside OrderHistory in our Node.js/Express service.
The /order-api/calculate-roi endpoint now:
Pulls your last 30 days of trades
Scans on-chain transfer ops for HIVE/HBD deposits
Loads any bonus or manual deposits you recorded
Combines everything into a fair ROI
To summarize:
Here’s how ROI is now being calculated (for the past 30 days):
Fetch all bot trades and deposits for past rolling month
Buy orders:
We pull every BUY in OrderHistory with createdAt ≥ oneMonthAgo and sum
buyTotal = Σ(order.amount * order.price)
Sell orders:
We pull every SELL in the same time window and sum
sellTotal = Σ(order.amount * order.price)
Manual Hive top-ups:
We now also pull every on-chain deposit you made to the bot (hive account) (from our DepositHistory collection) with createdAt ≥ oneMonthAgo and sum
depositTotal = Σ(deposit.amount)
Compute net investment
We treat your deposits plus what the bot spent as the total money you “put in”:
totalInvested = buyTotal + depositTotal
Compute net returns
That’s simply what you got back via sells:
totalReturned = sellTotal
ROI formula
Finally we report:
ROI (%) = (totalReturned − totalInvested) / totalInvested × 100
By including depositTotal in the denominator, we’ll get rid of inflated ROIs after making manual deposits — everything you put in gets counted, not just the bot’s buys.
UPDATE July 10, 2025
Also added power-up and power-down's to the mix. HIVE accounts have so many features that we must account for, investing and divesting are some important edge cases that we now account for. Hopefully this will encompass all the different scenarios, except I still need to look into adding and subtracting from HIVE savings if my memory serves me right. This might not be a widely used feature, but we need to cross all our t's and dot our i's.
✅ What This Means for You
Accurate Returns: Your ROI will now factor in every HIVE/HBD you add along the way. (on supported bots only, ROI calcs still need to be implemented on the hive-engine bots)
Transparent Breakdown: We return counts of buys, sells, HIVE deposits, HBD deposits, and both investment & final values.
Edge-Case Proof: Community testing caught everything from tiny bonuses (0.004 HIVE) to large top-ups — all now counted properly.
Thanks to everyone in our Hive community for spotting this and helping us refine the bot. Happy trading, and stay tuned for more updates!
Thank you very much.
So far I have just been testing one SMA bot and I expect to create a few more bots.
I did notice the ROI showing some crazy percentage but that did not concern me that much. I have to do up my own spreadsheet as part of my evaluation.
Thanks again for the update.
!PIMP
Congratulations @hive.trading! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s)
Your next target is to reach 100 upvotes.
You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word
STOP
$WINE