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.
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.
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 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.
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.
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.
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
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.*'
Let's go over each.
api_hash- Telegram API information. You need to get yours from my.telegram.org.
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:
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.
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.py script. The following example uses vi.
sudo vi /etc/supervisor/conf.d/hodloo-alerts.conf
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
sudo supervisorctl reread add hodloo-alerts status
To check whether your python script is running use the following:
sudo ps -axs | grep python
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)
"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.
I like crypto and scripting. If my stuff makes you money, please consider supporting me.