Good evening HIVE and Dogecoin community !
Here I am, back on Hive writting mode ! After few coding evenings discovering the world of trading bots on Hive Engine !
So to sum up my previous achievements :
- my First Trading Hive Dogecoin (part 1) : https://hive.blog/trade/@onlydoge/my-first-trading-hive-dogecoin-part-1
- my First Trading Hive Dogecoin (part 2) : https://hive.blog/hiveengine/@onlydoge/my-first-trading-hive-dogecoin-part-2
I built a Dogecoin / Hive trading bot using those following helpful Hive Engine open source tools and ressources :
- https://hiveengine.readthedocs.io/en/latest/cli.html to get hiveengine CLI commands and Python libs
- https://hive.ausbit.dev/ to understand HB consumption at each transaction
- https://hive-engine.com/ as the exchange of course
- https://www.coingecko.com/ for external market data
The bot is coded with PHP for the trade logic and with Python to interact with Hive Engine.
Producing green code (clean, evolutive and reusable)
I made great step refactoring all of my code. Cleaning and consolidating the algorithm. Defining and settings constants in config files.
Optimizing the trade data trable storing each bot orders in MySQL (https://dev.mysql.com/doc/refman/8.0/en/).
Even if this represents few hundred lines of code, I constantly rewrit the current code work to ensure it is clean, evolutive and programmaticaly up to date. My personal choice, I like PHP (https://www.php.net/manual/fr/langref.php) as programming language and Symfony (https://symfony.com/en) as the core coding framework, because it ensures good practices are applied (coding guidelines, security, performance, patterns) and has a great open source community.
Improving bot decisions and analytics
Anyway, at first, the bot was only focused on the 1rst concurrent best bid and on risk guarantees (i.e: to try avoid to lose precious HIVE). Now, it is parsing the entire Hive Engine tokens list (currently focusing on SWAP ones) and it is analyzing all concurrents bids, positions, prices and live market price of each token and of each broker order. I think there are approximatively 500 hundreds concurrent placed orders on those tokens but some are staying open during a long time. The bot is processing orders in a near realtime frequency (approx. 2min to avoid consuming all my HB too fast).
It evaluates the most interesting / best bid orders to place on each token to ensure the best price for the buyer or seller and while reducing risks of loss for the bot bids. It also stores each bid order and decision data into database (for later use).
I'm still in evaluation mode of this bot prototype and as I'm just a reasonable developer, I don't bet too much, only 1 Hive per bid. I give me few days to evaluate if actual strategy is paying.
There are many concurrents bots in the HIVE exchange and on those SWAP tokens ... Thus, a passive bid strategy may not be effective to close the maximum orders in minimum time. It seems inevitable to start working on strategies focused on disrupting concurrents. Few axis of improvements like placing fake bids of low quantity to push concurrent bid at their lowest bids or using brokers orders histories to search for their strategy holes.
Independently, I may have to use also this HIVE API which looks very nice https://developers.hive.io/tutorials-recipes/calculate_rc_recipe.html to caculate the available HB resources credits. Like it is probably done here https://hive.ausbit.dev/. This data will allow the bot calibrating and optimizing its frequency automaticaly.
Also, I will have to work with tokens which are not SWAP ones, for example like LEO token as there is a huge amount of orders placed in realtime on Hive Engine.
And of course I still have some refactoring and code rewriting !
That's all for today folks ! Have a good night all !
The bot is still in test phase be sure I will provide feedbacks on its earning in coming days.
I hope you all enjoyed reading my explanations about my first Dogecoin Hive trading bot.