Binance Trade Bot Manager Telegram
A Telegram bot for remotely managing Binance Trade Bot.
If you have feature requests please open an issue on this repo, developers are also welcome to contribute!
About
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.
As of now the bot is able to perform the following actions:
- Check bot status (running / not running)
- Start Binance Trade Bot
- Stop Binance Trade Bot
- Display current coin stats (balance, USD value, BTC value, initial buying price)
- Display current coin ratios
- Display progress (how much more of a certain coin you gained since you started using Binance Trade Bot)
- Display trade history
- Display last 4000 characters of log file
- Edit coin list (
supported_coin_list
file) - Edit user configuration (
user.cfg
file) - Delete database file (
crypto_trading.db
file) - Export database file
- Update Binance Trade Bot (and notify when new update is available)
- Update Binance Trade Bot Manager Telegram (and notify when new update is available)
The program's default behavior fetches Telegram token
and user_id
from Binance Trade Bot's apprise.yml
file.
Only the Telegram user with user_id
equal to the one set in the apprise.yml
file will be able to use the bot.
Installation
Python 3 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
- Clone this repository:
$ git clone https://github.com/lorcalhost/BTB-manager-telegram.git
- Move to
BTB-manager-telegram
's directory:
$ cd BTB-manager-telegram
- Install
BTB-manager-telegram
's dependencies:
$ python3 -m pip install -r requirements.txt
rwx
permissions are set and the program is run with correct privileges.
(Optional) Setup Docker image
CLICK ME
To run _Binance Trade Bot Manager Telegram_ inside a Docker container you must first make sure to have your _binance-trade-bot_ installation directory inside the _BTB-manager-telegram_ one. Your filesystem should look like this:.
└── *parent_dir*
└── BTB-manager-telegram
└── binance-trade-bot
For quickly setting up the filesystem as intended you can run the docker_setup.py
script:
$ python3 docker_setup.py
docker_setup.py
also takes the following optional arguments:
optional arguments:
-m, --make-image Create a docker image for the bot.
-u, --update-image Update the docker image for the bot.
-D, --delete-image Delete the docker image for the bot.
Usage
Run normally
BTBManagerTelegram can be run directly by executing the following command:
# Run normally
$ 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
$ nohup python3 -m btb_manager_telegram &
Make sure Binance Trade Bot's apprise.yml
file is correctly setup before running.
Note:
If Binance Trade Bot and BTB-Manager-Telegram were not installed in the same parent directory or you want to use different token
and user_id
from the ones in the apprise.yml
file, the following optional arguments can be used:
optional arguments:
-p PATH, --path PATH (optional) binance-trade-bot installation absolute path
-t TOKEN, --token TOKEN
(optional) Telegram bot token
-u USER_ID, --user_id USER_ID
(optional) Telegram user id
-d DOCKER, --docker DOCKER
(optional) Run the script in a docker container.
NOTE: Run the 'docker_setup.py' file before passing this flag.
Run inside a Docker container
To run Binance Trade Bot Manager Telegram in a Docker container you can do the following after setting up the image:
$ python3 -m btb_manager_telegram --docker
Interaction
Interaction with BTBManagerTelegram can be started by sending the /start
command in the bot's Telegram chat.
Every time the Telegram bot is restarted the /start
command should be sent again.
Screenshots
Troubleshooting
/start
command to the bot but it's not answering:
1. I am sending the CLICK ME
Usually when this happens it means that you haven't properly setup your apprise.yml
file.
For security reasons the bot is programmed so that it only responds to the person with user_id
equal to the one set in the Telegram URL inside the apprise.yml
file.
Example of apprise.yml
file:
version: 1
urls:
- tgram://123456789:AABx8iXjE5C-vG4SDhf6ARgdFgxYxhuHb4A/606743502
In this URL:
123456789:AABx8iXjE5C-vG4SDhf6ARgdFgxYxhuHb4A
is the bot'stoken
606743502
is theuser_id
You can find your user_id
by sending a Telegram message to @userinfobot.
Note:
If the bot is not responsive after using the Update Telegram Bot function something might have gone wrong and you need to manually restart BTB Manager Telegram.
Make sure that only one bot instance is running
:
2. ERROR: CLICK ME
This means that there are two or more instances of BTB-Manager-Telegram
running at the same time on the same Telegram token
.
To fix this error you can kill all BTB-Manager-Telegram
instances and restart the Telegram bot.
You can kill the processes using the following command:
kill -9 $(ps ax | grep btb_manager_telegram | fgrep -v grep | awk '{ print $1 }')
Support the Project
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.