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:
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!
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:
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
Hereās how ROI is now being calculated (for the past 30 days):
Fetch all bot trades and deposits for past rolling month
We pull every BUY in OrderHistory with createdAt ā„ oneMonthAgo and sum
buyTotal = Σ(order.amount * order.price)
We pull every SELL in the same time window and sum
sellTotal = Σ(order.amount * order.price)
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)
We treat your deposits plus what the bot spent as the total money you āput inā:
totalInvested = buyTotal + depositTotal
Thatās simply what you got back via sells:
totalReturned = sellTotal
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.
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.
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