A Day in the Life of a JavaScript Dev: HIVE.TRADING Tweaks & Bag Randomization in the L1 Marketmaker

avatar

Hey fellow JS devs! Today we rolled up our sleeves and shipped out two neat updates across our various HIVE and HIVE-ENGINE trading bots which you can find and use on https://hive.trading:

openart-image_Cjk2YPgi_1751688618875_raw.jpg

1. Hive-Engine Market-Maker (HEMM) Bot Improvements

What We Added:

Order-Price Filters

do_not_buy_equal_and_above

do_not_sell_equal_and_below

These optional settings let you set hard price ceilings/floors so the bot never accidentally buys too high or sells too low. Blank by default, they’re just safety nets you can toggle on when you want extra control.

Why It Matters:
Without these filters, the bot simply undercuts the best bid or ask by one tick—fine for “pure” market-making, but risky if there’s a flash pump or a sudden dump. Now you can say “never buy at or above 0.12 HIVE” or “never sell at or below 0.09 HIVE,” and rest easy.

Implementation Highlights:

We extended our storage JSON schema to include the two new keys in each user’s settings block.

In the trade loop, we parse them as floats and bail early if the computed price violates your thresholds.

Everything else remains… well, the same familiar JS async/await pattern you know and love.

2. Bag Randomization in the L1 Market-Maker Bot

What We Added:
Rather than iterating through users in a fixed order (which can leave late joiners perpetually at the end of the queue), we now:

Shuffle the user list on each run

Process orders in a new random sequence each interval

Why It Matters:
Imagine 100 users, and you always start with user #1. Over time, #1 racks up prime bid/ask spots while #100 is always last to post orders—less chance to capture the spread! Bag randomization is the classic “fair draw” approach: everyone’s equally likely to trade first.

Implementation Highlights:

// Simple Fisher–Yates shuffle
function shuffle(array) {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
}

let users = jsonData.users.filter(u => !expired(u));
shuffle(users);
for (const user of users) {
await processTradesForUser(user);
}

Note: We plan on adding this feature to the Hive-Engine Market Maker bot too, and all other bots ASAP!

Wrapping Up

HEMM Bot got smarter order filters and block-aware timing so you can burn BEED fees without hiccups and enforce price safety rails.

L1 Marketmaker leveled the playing field with bag randomization, so no one is “always last” in the order queue.

All in all, a very productive sprint! ⚙️✌️ Let me know what you think or if you spot any edge cases we should handle next.

Happy coding!
— Follow @hive.trading for more from your friendly neighborhood JS trader bot & maintainer.



0
0
0.000
2 comments
avatar

Congratulations @hive.trading! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s)

You received more than 10 upvotes.
Your next target is to reach 50 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

Check out our last posts:

Our Hive Power Delegations to the June PUM Winners
Feedback from the July Hive Power Up Day
Hive Power Up Month Challenge - June 2025 Winners List
0
0
0.000