New Tool: `liquidityBot.py` (And a `nectarengine` Update!)
hive-186392·@thecrazygm·
0.000 HBDNew Tool: `liquidityBot.py` (And a `nectarengine` Update!)
Hey everyone, You know how sometimes you start working on one project, and it forces you to go back and fix up another? That’s exactly what happened this week. I started tinkering with a new script for managing liquidity on Hive-Engine, but in the process, I discovered some things in `nectarengine` that weren't working quite right. So, today's post is twofold: a new release for `nectarengine` and the new tool that prompted it! --- ### `nectarengine` v0.0.9 is Live!  First things first, `nectarengine` version 0.0.9 has been released and is now live on PyPI! This update fixes a handful of issues I ran into with the liquidity pool and token object handling. As I was building the new bot, I realized some of the underlying functions needed to be more robust. Thanks to this new project, the library is now a little bit better for everyone. You can grab the latest version from the usual places: - **PyPI:** `pip install nectarengine --upgrade` - **GitHub:** [https://github.com/TheCrazyGM/nectarengine](https://github.com/TheCrazyGM/nectarengine) --- ### Introducing `liquidityBot.py` Now, for the project that spurred those updates: a fun little script I'm calling `liquidityBot.py`. This is an automated bot for Hive-Engine designed to help manage token swaps and liquidity provision. The basic idea is to automate two key tasks: 1. **Conditional Swapping:** The bot checks the market price of a token (the "target asset") against a base currency (like SWAP.HIVE). If the price is at or above a threshold you set, it will automatically sell a specified amount of your target asset. 2. **Automated LP Deposits:** Here’s the interesting part. If the swap is successful, the bot can then take the proceeds (the SWAP.HIVE you just received) and automatically pair it with more of your target asset to deposit into the corresponding liquidity pool. It’s a neat way to automate taking profits on a token while simultaneously deepening your position in its liquidity pool. #### How to Use It The script is run from the command line and configured with arguments. A typical dry-run might look something like this: ```bash usage: liquidityBot.py [-h] [-t TARGET_ASSET] [-b BASE_CURRENCY] [-a AMOUNT] [-p THRESHOLD] [-acc ACCOUNT] [-d] Automated token trading and LP management bot. options: -h, --help show this help message and exit -t, --target-asset TARGET_ASSET Symbol of the target asset to trade (default: PIZZA). -b, --base-currency BASE_CURRENCY Symbol of the base currency for trading (default: SWAP.HIVE). -a, --amount AMOUNT Amount of the target asset to trade (default: 50). -p, --threshold THRESHOLD Price threshold in base currency to trigger sell (default: 0.047). -acc, --account ACCOUNT Override Hive account name from config.json (default: loaded from config.json) -d, --dry-run Simulate transactions without broadcasting. ```  ```bash ./liquidityBot.py --target-asset SIM --amount-to-swap 100 --price-threshold 0.00007 --dry-run ``` This would simulate selling 100 SIM tokens if the price is at least 0.00007 SWAP.HIVE, and then simulate depositing the proceeds back into the SWAP.HIVE:PIZZA liquidity pool. It requires a `config.json` file in the same directory for your Hive account and active key. This is still a work in progress, but if you want to check it out or tinker with it yourself, you can find the full script and a more detailed `README` on GitHub. - **GitHub Repo:** [https://github.com/TheCrazyGM/liquiditybot](https://github.com/TheCrazyGM/liquiditybot) It's a perfect example of how building a specific-use tool can lead to discovering and strengthening the foundational libraries it depends on. Let me know what you think! As always, Michael Garcia a.k.a. TheCrazyGM
👍 thestrider, beco132, isnochys, gtw, frasier, grand.strategy, freecompliments, glimpsytips.dex, hdmed, hetty-rowan, borniet, magnacarta, wongi, boeltermc, beststart, poplar-22, georgesantana73, hive-140084, pepetoken, fc-curation, fc-rewards, fc-arbitration, indiasierra, magicalex, trovepower, mmbbot, honeyjean24, jacor, moretea, morwhale, coolguy123, braaiboy, dailyspam, guurry123, gurseerat, alkirua, trashyomen, vrezyy, tub3r0, noctury, chrisly.social, holdeck2, vrezion, tengolotodo.leo, timix648, converter.bonus, bankrobbery, spoonies, d-a-d, pepe.voter, claudiavb, murtaza-7868, digi-alt, michael561, hive.pizza, dauerossi, robtheranger, grocko, morwhaleplus, morwhalebonus, najat, fireguardian, ravenmus1c, thearned, baasdebeer, eternalsuccess, afternoondrinks, aydie1000, ilanisnapshots, nooblogger, hivetrending, kyleana, rondonshneezy, dadspardan, huzzah, emsenn0, cooperclub, wynella, creodas, wizzitywillican, thecbp-hiver, rayius, banzafahra, h3m4n7, spiritverve, thedoc07, cherute, lothbrox, zeclipse, highfist, the-pockets, elkingplayer, dutchchemist, gmzorn, thoth442, actordontee, mita3, prohive, shmieta, manclar, svanbo, esmeesmith, fonestreet, casimodo, mk992039, freemonster, instagram-models, bambukah, steembasicincome, sbi2, sbi3, anikys3reasure, awesomegames007, sbi4, tdas0, piestrikesback, buildingpies, sbi-tokens, qwertm, briefmarken, sbi5, noloafing, sneakyninja, thedailysneak, babysavage, ravensavage, netzisde, bububoomt, sports.power.bot, gamer00, pixelfan, neoxvoter, slothlydoesit, zallin.pimp, kiemis, youloseagain, oadissin, mviews, hivelist, agrante, learn2code, slothburn, calmphoenix, rudy-dj, kasih-sayang, ecoinstant, eturnerx, cryptoknight12, votehero, jozefkrichards, dpend.active, sketching, mxm0unite, thelogicaldude, bbarelyseal, dbooster, penguinpablo, cryptonized, funnyman, alphacore, joeyarnoldvn, hungrybear, esbat, magic.byte, teamvn, steemmillionaire, ladyaryastark, aljif7, gaottantacinque, cribbio, gasaeightyfive, keys-defender, cryptoshots.nft, marcocasario, crypto-shots, karina.gpt, hive-defender, key-defender.shh, cryptoshots.play, cryptoshotsdoom, chimp.ceo, lourica, balvinder294, eforucom, dkidfit, kenny-crane, artlover, logen9f, tydynrain, dstampede, adulruna, deggial, ecoinstats, treasure.hoard, ryosai, thecrazygm.bank, blessskateshop, archon-gov, pof.archon, abrockman, monsterrerentals, everythingsmgirl, ykretz, urun, herman-german, lrekt01, fw206, woelfchen, cryptoniusrex, niallon11, mes, ezun1, likedeeler, lolz.byte, vimukthi,