DEV Community

Cover image for Filtering Hodloo Alerts (API Version)
Nobbi's Crypto
Nobbi's Crypto

Posted on • Updated on

Filtering Hodloo Alerts (API Version)

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

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.

Installation

Script And Requirements

  1. Copy everything from my GitHub repository to a local folder. I'm using /opt/nobbi/hodloo.
  2. Install required Python libraries for all users:
sudo su
cd ~
pip install -r /opt/nobbi/hodloo/requirements.txt
Enter fullscreen mode Exit fullscreen mode
  1. Rename config.py.example to config.py and 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.
Enter fullscreen mode Exit fullscreen mode

Run the script to see if everything is running as expected: python3 /opt/nobbi/hodloo/hodloo-alerts-api.py

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.

Running the Script in Background

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.

Installing supervisor:

sudo apt-get install supervisor
Enter fullscreen mode Exit fullscreen mode

Checking the status of supervisor:

sudo service supervisor status
Enter fullscreen mode Exit fullscreen mode

Starting supervisor:

sudo service supervisor start
Enter fullscreen mode Exit fullscreen mode

Stopping and restarting supervisor:

sudo service supervisor stop
sudo service supervisor restart
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Configure supervisor:

sudo supervisorctl
reread
add hodloo-alerts-api
status
Enter fullscreen mode Exit fullscreen mode

To check whether your python script is running use the following:

sudo ps -axs | grep python
Enter fullscreen mode Exit fullscreen mode

Conclusion

You now get Hodloo alerts like the one below in your own Discord server:
Alert

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.

Update 2021-11-18

Volume Filter

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.

Multiple Config Files

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

Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
 
nobbi profile image
Nobbi's Crypto

I like crypto and scripting. If my stuff makes you money, please consider supporting me.

  • USDT (TRC20) - TMAroqHEg7Z41x8fhY14Xp4R9FtzWkFMpR
  • BTC - bc1qh45t0q0vgazf6l8qe8wf3ek6j3d7pr8awu5rgr
  • ETH - 0x9686360226dAedEf32E904CF3ecEcf6EE4fC31e5