The other day I wrote an article on how to use Telegram and Python to filter Hodloo alerts for USDT pairs only (took it offline on 2021-12-27). That turned out out to be quiet popular. However, shortly after I found that there is also an API availalbe to which I got access by the founder Pete through the Hodloo Discussion Telegram channel.
Using the API is better than parsing Telegram messages as it's faster and more robust. It has a new metric called panic sells, too. It detects a higher than normal sell of.
My setup is still the same as described in the old article:
- I'm running everything on a Linux VPS for 24/7 availability. You can run this on your home PC, too, but it needs to be online all the time.
- I'm parsing Hodloo messages for USDT pairs on Binance.
- Results are send to a Discord server. Discord is the only notification method available at the moment, so please read my tutorial on how to set it up.
- Copy everything from my GitHub repository to a local folder. I'm using
- Install required Python libraries for all users:
sudo su cd ~ pip install -r /opt/nobbi/hodloo/requirements.txt
config.pyand change the variables. The variables are very well documented in the file itself hence I won't cover this here. For your reference the variables below:
# Discord DISCORD_WEBHOOK_5 = '' # Discord Webhook for alerts 5% under the base. Leavy empty if not desired. DISCORD_WEBHOOK_10 = '' # Discord Webhook for alerts 10% under the base. Leavy empty if not desired. DISCORD_PANIC = '' # Discord Webhook for panic sell alerts. Leave empty if not desired. DISCORD_ERRORS = '' # Discord Webhook in case of errors. Mandatory. # Hodloo HODLOO_URI = '' # Hoodlo Websocket API. Request the info from Pete in the Hoodlo Discussions Telegram channel as it is private. HODLOO_QUOTES = ["USDT"] # Multiple quotes -> ["USDT","USDC"] HODLOO_EXCHANGES = ["Binance"] # Multiple exchanges -> ["Binance","Kucoin"] Note that only Binance and Kucoin are fully supported at the moment.
Run the script to see if everything is running as expected:
Running the script like above will work but is not very handy because as soon as you close the terminal or the session, the script stops. So we need a way to run the script in the background and also after a server reboot. Check the next chapter on how to achieve this.
We need a way to run the script in the background and also after a server reboot. There are multiple ways to achieve that and the easiest method for Ubuntu I found is using the tool supervisor.
sudo apt-get install supervisor
Checking the status of supervisor:
sudo service supervisor status
sudo service supervisor start
Stopping and restarting supervisor:
sudo service supervisor stop sudo service supervisor restart
Create an entry for the
hodloo-alerts-api.py script. The following example uses vi.
sudo vi /etc/supervisor/conf.d/hodloo-alerts-api.conf
Contents of the file (change the paths accordingly):
[program:hodloo-alerts-api] command=python3 -u hodloo-alerts-api.py directory=/opt/nobbi/hodloo stdout_logfile=/opt/nobbi/hodloo/hodloo-alerts-api.log redirect_stderr=true autorestart=true
sudo supervisorctl reread add hodloo-alerts-api status
To check whether your python script is running use the following:
sudo ps -axs | grep python
I'd like to thank Pete for access to the API and the permission to post this script. And I like to thank lampak from the Hodloo Discussion Telegram channel for sending me his Python implementation - a lot of my work is based on his actually.
The next article will cover how to connect the alerts with a trading bot.
The new variable
HODLOO_MIN_VOLUME allows to filter coins based on a certain amount of volume. If the volume is below the variable's threshold, the coin will be ignored. See the variable description for an example.
Until now the script required one config file named
config.py. It now supports passing the name of the config file as a parameter, which allows running multiple instances of the script with different config files. Examples below.
# Old behavior where the script uses config.py as variable source (still supported btw) > python hodloo-alerts-api.py # Use kucoin.py file as variable source instead. > python hodloo-alerts-api.py kucoin.py