DEV Community

Cover image for Filtering Hodloo Alerts
Nobbi's Crypto
Nobbi's Crypto

Posted on • Updated on

Filtering Hodloo Alerts

Using Telegram to filter Hodloo alerts is outdated. Please read my other article instead.

QFL is a popular crypto trading strategy. In a nutshell, you mark strong buying action as a base, buy when the price falls under that base and sell when it reaches the base again.

Alerts example

While the founder of QFL marked bases manually, many services were created that can draw bases automatically. You can find some indicators on TradingView (search for QFL) or use something like 3commas which has several algorithms built-in.

The best service, in my opinion, is Hodloo. Its bases are very well respected hence the winning rate is very high. You even get Telegram alerts for free! But, the alerts can get quite spammy when BTC drops. Also, you get alerts for BTC and ETH pairs while I only care about USDT pairs. So I needed a way to filter the Hodloo alerts. Luckily that's possible with Python.

This article outlines how to filter Hodloo alerts and forward them to a Discord server. The latter is what I'm using as my personal notification system as I prefer it over a flooded mailbox. A second blog post will cover how you can forward the alerts to a bot for automated trading.

My Setup

VPS

The alerts need to be monitored constantly, hence a normal computer is not the ideal place to run this as it is not always on. I'm using an Ubuntu VPS for stuff like this. More precisely a CX11 Cloud server from Hetzner. But you can go with whatever you like, of course.

Anyway, I can't teach you Linux here. You need some basic knowledge to follow this article.

Discord

Discord is what I use as my notification system. I created a server just for me where I collect all kinds of notifications. The script currently supports only Discord as its notification system.

Binance

Hodloo alerts are available for multiple exchanges. I use Binance hence the script is optimized for it. If you use other exchanges please change the script accordingly.

Telegram

Obviously, you need to have a Telegram account and must be a member of the Hoodlo alert groups to be able to parse and filter the alerts.

Script Requirements

The script is written in Python and uses a public Python library to interact with Telegram. The following things must be present on your machine for everything to work. Installation instructions can be found via Google.

  • Python, should be installed by default on Ubuntu
  • Telethon, the library to interact with Telegram

Customizing and Running the Script

The script hodloo-alerts.py is available on GitHub. The variable section needs to be customized.

###
### Variables
###
api_id = 
api_hash = ''
binance_10_webhook = ''
binance_5_webhook = ''

# Only include USDT pairs but exclude anything with "DOWN/" or "UP/" in the name aka Binance Leveraged Tokens.
# Valid pair examples: ADA/USDT, LINK/USDT and so on
# Non-valid pairs: ADADOWN/USDT, ADA/BUSD, LINK/ETH, LINK/BTC and so on
pattern = '(?i)^(?!.*DOWN\/)(?!.*UP\/).*\/USDT.*'
Enter fullscreen mode Exit fullscreen mode

Let's go over each.

  • api_id and api_hash - Telegram API information. You need to get yours from my.telegram.org.

  • binance_5_webhook and binance_10_webhook - The webhooks for the notification channels in Discord. Read this post on how to get the webhooks.

  • pattern - See description in the script. If you are trading only USDT pairs like me you don't need to change anything.

Save the script somewhere on your Linux box. I like to create a folder in /opt for these kinds of scripts. Then run it with Python, like:

python3 /opt/nobbi/hodloo/hodloo-alerts.py
Enter fullscreen mode Exit fullscreen mode

The script will ask you to verify your phone number. You only need to do this once.

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.py script. The following example uses vi.

sudo vi /etc/supervisor/conf.d/hodloo-alerts.conf
Enter fullscreen mode Exit fullscreen mode

Contents of the file (change the paths accordingly):

[program:hodloo-alerts]
command=python3 -u hodloo-alerts.py
directory=/opt/nobbi/hodloo
stdout_logfile=/opt/nobbi/hodloo/hodloo-alerts.log
redirect_stderr=true
Enter fullscreen mode Exit fullscreen mode

Configure supervisor:

sudo supervisorctl
reread
add hodloo-alerts
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

That's it! You're successfully filtering the Hodloo telegram alerts for USDT pairs. I know the setup is quite cumbersome and I would love to pay a monthly fee to the creator of Hodloo for the filtered alerts, but sadly that service is not available.

Top comments (2)

Collapse
 
jaffasoft profile image
Jaffasoft

"I know the setup is quite cumbersome and I would love to pay a monthly fee to the creator of Hodloo for the filtered alerts, but sadly that service is not available."

Agree. Doing code and running programs in not my strong point. Thanks for the article as they are most interesting and hits the nail on the head. I real wish there was even just selection alerts for a few coins watched BTC, ETH, DOT etc and just sent instead of the flood that occurs in a major market dumping.

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