Hello Dear Dogecoin community and Hive Community !
I just finished the first version my first DIY trade bot on a Dogecoin Hive trade using Hiveengine API !
My objective is mainly to earn Dogecoins, because I like Dogecoin.
Let me share my rapid experience on the first version of the technical prototype (approx 200 code lines).
Technical stack
I also like PHP / MySQL so it is my duty to code this bot using those free, reliable and open sources technologies.
MySQL8 is used to store the trade bot bids history in a simple table :
https://dev.mysql.com/doc/refman/8.0/en/Python3 is used to manage Hiveengine API :
https://hiveengine.readthedocs.io/en/latest/cli.htmlPHP8 is used to query MySQL trade table, to call the CoinGecko API and to call Hiveengine API
https://www.php.net/manual/fr/langref.php
Prerequisite
You need to load it with few Dogecoin and Hive to fund first script executions.
Hive power of your account reloads itself naturaly each hour. If necessary you can load some more HIVE on your wallet to get enough ressource credits.The script needs an internet access to call Hiveengine API and Coingecko API : https://www.coingecko.com/fr/api/documentation
The script needs a Hive Engine account, you can create it here : https://hive-engine.com/
The script needs some Hive Power available on the account, you can check your Hive Power here : https://hive.ausbit.dev/
Principle
Each 5min the script is runing automaticaly (e.g: using crontab).
It calls the HiveEngine API to get the current Hive and Doge wallet balance :
hiveengine balance --account onlydoge
It gets the last trade from the MySQL Table
SELECT * FROM trade ORDER BY id DESC LIMIT 1
It calls the CoinGecko API to get current live quotes of HIVE and DOGE and then to calculate the appropriate Hive for Doge.
$currentDogePrice / $currentHivePrice = $currentDogeHivePrice
Note: the result is fat, but we only need the value of market_data.current_price.usd
curl -X GET https://api.coingecko.com/api/v3/coins/hive
curl -X GET https://api.coingecko.com/api/v3/coins/dogecoin
At each execution the bot is either proceeding to a Buy or to Sell order, depending on the last bid.
If it is a buy, it calculates recommendedDogeHivePrice by multiplying the currentDogeHivePrice by 0.98 to earn 2% for the exchange.
If it is a sell, it calculates recommendedDogeHivePrice by multiplying the currentDogeHivePrice by 1,02 to earn 2% for the exchange.
It calls the HiveEngine API to get the current list of bids in the sellbook or in the buybook (depending on our last bid).
hiveengine sellbook SWAP.DOGE
hiveengine buybook SWAP.DOGE
If one of our previous bid is still in the sellbook or buybook, it checks if the bid price is still appropriate, which means it is still in bounds (between currentDogeHivePrice and recommendedDogeHivePrice).
If we are not at the best bid, then we try to place 0,001 under the best one (and while staying inbound). So in case of necessary, it cancels our last bid.
hiveengine cancel -a onlydoge sell 8867981
And then place our Buy or Sell order :
hiveengine sell -a onlydoge 1 SWAP.DOGE 0.1638
or
hiveengine buy -a onlydoge 1 SWAP.DOGE 0.1638
Next improvements
Here are my next ideas of improvements :
- controls Hive Power credits using : https://hive.ausbit.dev/
- manages Hive staking
- executes buy and sell orders
- makes more agressive trading bot version
- extends to all HiveEngine tokens list : https://hive-engine.com/?p=tokens
- any more idea ? PLEASE feel free to suggest
Et voilà !
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.
I now have a formidable and very motivating competitor.
Cheers mate, looks very good, but difficult to understand for me looks like Chinese for me 😅. But i like it.
!WINE
!PIZZA
!LOL
3 Days Days.Hi @oceanwilley, This Post Is Older Than
Please Try Another Post.
(We Will Not Send This Error Message In Next 24 Hrs).
Contact Us : WINEX Token Discord Channel
WINEX Current Market Price : 0.360
Swap Your Hive <=> Swap.Hive With Industry Lowest Fee (0.1%) : Click This Link
Read Latest Updates Or Contact Us
lolztoken.com
Make me one with everything.
Credit: reddit
$LOLZ
Use the !LOL or !LOLZ command to share a joke and an $LOLZ. (1/1)@onlydoge, I sent you an on behalf of @oceanwilley