Skip to content

A feature packed but easy-to-use Telegram bot for remotely managing Binance Trade Bot instances

License

Notifications You must be signed in to change notification settings

lorcalhost/BTB-manager-telegram

Repository files navigation

Binance Trade Bot Manager Telegram

A Telegram bot for remotely managing Binance Trade Bot.

I wanted to develop an easy way of managing Binance Trade Bot so that I wouldn't have to constantly ssh into my VPS, and my non-techy friends could enjoy the benefits of automated trading.

The program's default behavior fetches Telegram token and chat_id from Binance Trade Bot's apprise.yml file. For a quick Telegram bot setup guide click here.

Installation

Docker install

For a Docker setup guide click here.

Manual install

Python 3.7, 3.8 or 3.9 is required. BTB-manager-telegram should be installed in the same parent directory as Binance Trade Bot. Your filesystem should look like this:

PARENT_DIR
  ├── BTB-manager-telegram
  └── binance-trade-bot

To begin with, open a terminal and place yourself in the directory where the binance-trade-bot is already present, e.g. if the binance_trade_bot directory is located in /home/user/trading_bot run:

cd /home/user/trading_bot

Then, run the following lines:

git clone https://github.com/lorcalhost/BTB-manager-telegram.git
cd BTB-manager-telegram
python3 -m pip install -r requirements.txt

Usage

As the telegram bot is launching itself the Binance Trade Bot, you only have to start the BTB Manager Telegram like so:

python3 -m btb_manager_telegram

If the bot is running on a server you may want to keep it running even after ssh connection is closed by using nohup. Note the trailing "&" :

nohup python3 -m btb_manager_telegram &

However, you can run the bot with options :

# Autostart the Binance Trade Bot when the BTB Manager starts
# (Otherwise you will have to manually start the Binance Trade Bot from telegram)
python3 -m btb_manager_telegram -s

# Use the french translation. Available translation : en, ru, fr, de, nl, es, id
python3 -m btb_manager_telegram -l fr

# Make possible to plot the bot's performance in EUR instead of USD
python3 -m btb_manager_telegram -u EUR

# If using other currencies than USD or EUR, for example GBP, you will have to provide
# an openexchangerates API key, see the flag --oer_key.
# Get you key here : https://openexchangerates.org/signup/free
python3 -m btb_manager_telegram -u GBP -o OPENEXCHANGERATES_KEY

# Of course you can combine all of this!
python3 -m btb_manager_telegram -s -l fr -u EUR

# Using nohup with options
nohup python3 -m btb_manager_telegram -s -l fr -u EUR &

# See all available options
python3 -m btb_manager_telegram --help

Stopping the bot

If the trade bot has been launched with the telegram bot, stopping the telegram bot will stop the trade bot.

  • If the telegram bot has been launched without nohup, closing the terminal or pressing CTRL + C will stop the bot.

  • If the telegram bot has been launched with nohup, the bot can be stopped with the command kill $(cat btbmt.pid) (no animal will be hurt in this operation). If this command respond the file btbmt.pid, it his very likely the telegram bot is no longer running.

Manual upgrade

First of, stop the telegram bot.

git pull
python3 -m pip install --upgrade -r requirements.txt

You can now reboot the telegram bot.

Additional notes

Custom scripts

This bot supports custom scripts in a plugin manner. An extensive documentation on customs scripts is available here.

Create a new translation

Copy the i18n/en.yml file and rename it to e.g. i18n/it.yml and translate all the included values. Check the translation is complete :

cd i18n
pip3 install click
python3 check_translation_file.py it.yml

Please submit your translation in a PR for it to profit everybody!

Telegram token and chat_id

Make sure Binance Trade Bot's apprise.yml file is correctly setup before running, the telegram manager retreives this file to connect the bot.

If Binance Trade Bot and BTB-Manager-Telegram were not installed in the same parent directory or if apprise.yml is not setup or you want to use different token and chat_id from the ones in the apprise.yml file, you can set these two keys with the options --token and --chat_id

Virtualenvs

If the Binance Trade Bot has its own python environment, that is not shared with the telegram manager, you have to specify the path of the python binary used by the trade bot with the option --python_path. For example, if you created a virtualenv specific to the binance trade bot in the folder /home/user/trading_bot/binance-trade-bot/venv, you have to run the telegram bot like so:

python3 -m btb_manager_telegram --python_path /home/user/trading_bot/binance-trade-bot/venv/bin/python

Multiple bots

If you would like to run several Binance Trade Bot instances at the same time click here.

Compatibility

The program is fully compatible with Linux and Windows through WSL.
RWX permission problems are present on native Windows and MacOS.

Screenshots

Click here

         

Support the project

If you like BTB-manager-telegram and use it on a daily basis consider supporting the project through a small donation. 😄

❤️ Sponsor on GitHub

Donations through GitHub sponsors will be matched by GitHub (e.g. if you decide to donate 10$, GitHub will add 10$ to the donation).

Contributions and feature requests

If you have any feature requests please open an issue.

Contributions from anyone are welcome! Before opening pull requests please read the contributing guidelines.

Disclaimer

This project is for informational purposes only. You should not consider any such information or other material as legal, tax, investment, financial, or other advice. Nothing contained here constitutes a solicitation, recommendation, endorsement, or offer by me or any third party service provider to buy or sell any securities or other financial instruments in this or in any other jurisdiction in which such solicitation or offer would be unlawful under the securities laws of such jurisdiction.

If you plan to use real money, USE AT YOUR OWN RISK.

Under no circumstances will I or the project's maintainers be held responsible or liable in any way for any claims, damages, losses, expenses, costs, or liabilities whatsoever, including, without limitation, any direct or indirect damages for loss of profits.

Contributors ✨

Many people contributed to the project by providing ideas, finding bugs and helping in the development (Emoji Key ✨).
This project follows the all-contributors specification.


Lorenzo Callegari 乐子睿

🚇 ⚠️ 💻 📖 🚧 🐛 🤔

Dmytro Litvinov

💻 🤔 🚧 🧑‍🏫

Heitor Ramon Ribeiro

🤔 🎨

NovusEdge

💻

Sachin S. Kamath

🤔 📖

Hoang Dinh

🐛

Dmitry Kravtsov

🤔 💻

Florian Sydekum

💻

Nico L.

🐛

SeriousSeal

💻

titulebolide

📖 🚧 👀 🐛 🌍 ⚠️ 🔧

Stephen Goult

🐛

Patrick Weingärtner

💻 🤔 🌍 📖

Federico Arredondo

🌍

MasaiasuOse

🌍 📖

phoenix-blue

🌍

neuhausj

💻

Santiago Caro Duque

🐛

Ivan Myronov

🌍

Hieu Nguyen

🐛

Riza Abdul Aziz

🌍

Kelecheck

🌍

kentuki

🌍

maromalo

🐛

Ulllas Bharadwaj

🤔 💻