Giter Club home page Giter Club logo

btb-manager-telegram's Introduction

Binance Trade Bot Manager Telegram

A Telegram bot for remotely managing Edendg23's Binance Trade Bot and its forks (Idkravitz's, Tntwist's, MasaiasuOse's being the major forks).

This program aims to be 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.

This program supports only Linux and WSL. Other distributions (BSD, MacOS, Windows, ...) are unmainted and support is not currently planned and is supposed to run 24/7. If you can't have a long running computer on linux, you can use a free VPS, such as Oracle Cloud's.

Manual install

Python 3.7, 3.8 or 3.9 is required.

0 - Create a dedicated folder

Create a dedicated directory for the binance trade bot and the present manager. In this tutorial, we will be using as an example the folder ~/trading-bot:

cd ~
mkdir trading-bot

1 - Install binance trade bot.

Choose the fork you want to use. The main one (Edendg23's) is fine to go with.

Place youself in the previously created directory, e.g.:

cd ~/trading-bot

Then follow the install instruction given on the binance-trade-bot's readme. Setup telegram bot during the install of binance-trade-bot (see the section Notifications with Apprise in the README)

Once the binance-trade-bot has been installed, make sure everything is properly installed : the following commands should yeild no errors.

cd ~/trading-bot
ls binance-trade-bot/binance_trade_bot/__main__.py
ls binance-trade-bot/config/apprise.yml

2 - Install the telegram manager next to the binance trade bot

As always, place youself in the install directory, e.g.:

cd ~/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

Other Install Methods

Automated Install

For an automated install, please refer to Enriko82's Install Script

Docker Install

This method is discouraged as it is no longer maintained. If you crave to contain the bot and its manager, you can always use python's virtual environments. However, you can still find a docker setup guide here.

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, cn, pt
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.

Telegram token and chat_id

Make sure that Binance Trade Bot's config/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

This program is fully compatible with Linux and Windows through WSL (Windows Subsystem for Linux).

Severa known problems are present on native Windows and will not be asserted.

MacOS compatibility is unknown, but supposed to be good ad this system is close to Linux.

Screenshots

Click here

         

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

🤔 💻 🐛

Ren Kasiyas

🌍

KevinTroyT

🌍

Timur

💻 🌍

Diogo Marques

🌍

stavsher

💻

btb-manager-telegram's People

Contributors

allcontributors[bot] avatar bloodf avatar dependabot[bot] avatar diogomarques2003 avatar dmytrolitvinov avatar dv-hoang avatar fedearre avatar hieu0nguyen avatar idkravitz avatar kevintroyt avatar lisiadito avatar lorcalhost avatar maromalo avatar masaiasuose avatar neuhausj avatar novusedge avatar phoenix-blue avatar pwnfoo avatar renkasiyas avatar santiagocarod avatar sgoult avatar shhhmel avatar sunbooster avatar sydekumf avatar titulebolide avatar tntwist avatar tsecret avatar ullasbharadwaj avatar wptranslate avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

btb-manager-telegram's Issues

Add custom scripts feature

Users should be able to define their own bash scripts inside a chosen file.
The bot will give the possibility to select between them and execute the content.

The custom_scripts.json file could look like this:

{
  "Test script 1": "echo hello",
  "Test script 2": "echo world"
}

Add logging for errors

Right now when I click on "Current ratios" I receive an error.
When I am trying to checkout logs from nohup.out - there is no logging for the error.

So I manually added logging error and checked the error - I got: list index out of range. But this is another issue I guess related to function text_4096_cutter

def text_4096_cutter(m_list):

telegram.error.RetryAfter: Flood control exceeded

Hi I have install the bot on my raspberry pi with python 3.7.3 but I get this error:

2021-04-27 06:40:14,524 - btb_manager_telegram_logger - INFO - Retrieving Telegram token and chat_id from apprise.yml file.
2021-04-27 06:40:14,540 - btb_manager_telegram_logger - INFO - Successfully retrieved Telegram configuration. The bot will only respond to user in the chat with chat_id 1321341011
2021-04-27 06:40:15,542 - btb_manager_telegram_logger - INFO - Checking for updates.
2021-04-27 06:40:17,000 - btb_manager_telegram_logger - INFO - BTB Manager Telegram update found.
2021-04-27 06:40:21,123 - btb_manager_telegram_logger - INFO - Binance Trade Bot update found.
Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/pi/binance/BTB-manager-telegram/btb_manager_telegram/__main__.py", line 126, in <module>
    pre_run_main()
  File "/home/pi/binance/BTB-manager-telegram/btb_manager_telegram/__main__.py", line 70, in pre_run_main
    scheduler.run(blocking=False)
  File "/usr/lib/python3.7/sched.py", line 151, in run
    action(*argument, **kwargs)
  File "/home/pi/binance/BTB-manager-telegram/btb_manager_telegram/utils.py", line 174, in update_checker
    bot.close()
  File "/home/pi/.local/lib/python3.7/site-packages/telegram/bot.py", line 127, in decorator
    result = func(*args, **kwargs)
  File "/home/pi/.local/lib/python3.7/site-packages/telegram/bot.py", line 4966, in close
    return self._post('close', timeout=timeout)  # type: ignore[return-value]
  File "/home/pi/.local/lib/python3.7/site-packages/telegram/bot.py", line 260, in _post
    f'{self.base_url}/{endpoint}', data=data, timeout=effective_timeout
  File "/home/pi/.local/lib/python3.7/site-packages/telegram/utils/request.py", line 354, in post
    **urlopen_kwargs,
  File "/home/pi/.local/lib/python3.7/site-packages/telegram/utils/request.py", line 265, in _request_wrapper
    message = str(self._parse(resp.data))
  File "/home/pi/.local/lib/python3.7/site-packages/telegram/utils/request.py", line 223, in _parse
    raise RetryAfter(retry_after)
telegram.error.RetryAfter: Flood control exceeded. Retry in 598.0 seconds

How do I fix it?

Separate script into multiple files

Now that BTB-manager-telegram transitioned from being a one-file utility to a project on its own, good coding practices should be followed.
Split the (almost 1000 lines) file into separate classes.

Current Ratios not working

Clicking on "current ratios" outputs " Something went wrong, unable to generate ratios at this time."

image

It never worked so far for me so I'm not sure how to replicate it. Please ask me for specific logs if you think it will help pinpoint the cause.

telegram.ext.dispatcher - ERROR - No error handlers are registered, logging exception. Traceback (most recent call last)

Hi, I just install the Telegram Bot on my Debian 10 VPS with Python 3.9.4 but I get this error:

2021-04-26 23:55:14,370 - telegram.ext.dispatcher - ERROR - No error handlers are registered, logging exception.
Traceback (most recent call last):
 File "/home/me/environments/binance39/lib/python3.9/site-packages/telegram/ext/dispatcher.py", line 442, in process_update
   handler.handle_update(update, self, check, context)
 File "/home/me/environments/binance39/lib/python3.9/site-packages/telegram/ext/conversationhandler.py", line 549, in handle_update
   new_state = handler.handle_update(update, dispatcher, check_result, context)
 File "/home/me/environments/binance39/lib/python3.9/site-packages/telegram/ext/handler.py", line 160, in handle_update
   return self.callback(update, context)
 File "/home/me/BTB-manager-telegram/btb_manager_telegram/handlers.py", line 251, in start
   update.message.reply_text(
 File "/home/me/environments/binance39/lib/python3.9/site-packages/telegram/message.py", line 689, in reply_text
   return self.bot.send_message(
 File "/home/me/environments/binance39/lib/python3.9/site-packages/telegram/bot.py", line 127, in decorator
   result = func(*args, **kwargs)
 File "/home/me/environments/binance39/lib/python3.9/site-packages/telegram/bot.py", line 475, in send_message
   return self._message(  # type: ignore[return-value]
 File "/home/me/environments/binance39/lib/python3.9/site-packages/telegram/bot.py", line 296, in _message
   result = self._post(endpoint, data, timeout=timeout, api_kwargs=api_kwargs)
 File "/home/me/environments/binance39/lib/python3.9/site-packages/telegram/bot.py", line 259, in _post
   return self.request.post(
 File "/home/me/environments/binance39/lib/python3.9/site-packages/telegram/utils/request.py", line 349, in post
   result = self._request_wrapper(
 File "/home/me/environments/binance39/lib/python3.9/site-packages/telegram/utils/request.py", line 272, in _request_wrapper
   raise BadRequest(message)
telegram.error.BadRequest: Can't parse entities: can't find end of bold entity at byte offset 9

I have also tried with Python 3.7 (which is the default in Debian 10) without chance. What I do wrong?
Thanks for any advice.
Dav

Add "Fresh start" feature

Thank for great effort ! Could you please add "fresh start" features ?
Its mean clean/delete all database, cancel all wating orders. its will help.

Wrong ratios on past transactions

Potentially linked to #35

On "Current Value", wrong ratios are displayed for the previously bough ratios.

image

As we can see, the bot thinks doge was at 0.03, but the value hasn't changed much from 0.06 lately (the bot only ran for a few hours). This may be due to me buying coins, stopping the bot, manually doing some transactions which changed the coin's amount, then resuming the bot. I'm not sure how the ratio is computed, but it might be that the bot assumes that the amount did not change when computing the old ratio instead of directly storing the old ratio.

Request of new features

Hi @lorcalhost ,
That project started to grow and more and more users will ask to add features which only to them related.
I guess we should keep the balance of the requested features and needed functionality.

Python Code Quality

Integrate black and isort as minimum.
Also, we can add flake8 with plugins.

Can't Find apprise.yml

Hi,

Both my folders (bot and telegram bot) are in the same drectory:
image
The teleram bot can't find de yml file inside the config directory:
image

I dont see why it cant find it since I'm running the binance bot with the consiguration for the telegram bot and it working.

Any Idead why thats not working?

Add the coin buying price on the Current value 💵

I think it's a good idea to have the price of the buying order on the current value command, so you could check how well the coin is doing and take any decisions, and don't need to write down each order, or save the bot chat history.

Can't parse entities: character '-' is reserved and must be escaped with the preceding '\'

Hello, I tried to run the bot for the first time and got these errors

2021-04-27 14:36:17,369 - btb_manager_telegram_logger - INFO - Retrieving Telegram token and chat_id from apprise.yml file.
2021-04-27 14:36:17,370 - btb_manager_telegram_logger - INFO - Successfully retrieved Telegram configuration. The bot will only respond to user in the chat with chat_id XXXXXXX
2021-04-27 14:36:18,372 - btb_manager_telegram_logger - INFO - Checking for updates.
2021-04-27 14:36:20,754 - apscheduler.scheduler - INFO - Scheduler started
2021-04-27 14:36:28,630 - btb_manager_telegram_logger - INFO - Started conversation.
2021-04-27 14:36:28,818 - telegram.ext.dispatcher - ERROR - No error handlers are registered, logging exception.
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telegram/ext/dispatcher.py", line 442, in process_update
    handler.handle_update(update, self, check, context)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telegram/ext/conversationhandler.py", line 549, in handle_update
    new_state = handler.handle_update(update, dispatcher, check_result, context)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telegram/ext/handler.py", line 160, in handle_update
    return self.callback(update, context)
  File "/Users/XXXXXX/BTB-manager-telegram/btb_manager_telegram/handlers.py", line 251, in start
    update.message.reply_text(
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telegram/message.py", line 689, in reply_text
    return self.bot.send_message(
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telegram/bot.py", line 127, in decorator
    result = func(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telegram/bot.py", line 475, in send_message
    return self._message(  # type: ignore[return-value]
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telegram/bot.py", line 296, in _message
    result = self._post(endpoint, data, timeout=timeout, api_kwargs=api_kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telegram/bot.py", line 259, in _post
    return self.request.post(
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telegram/utils/request.py", line 349, in post
    result = self._request_wrapper(
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telegram/utils/request.py", line 272, in _request_wrapper
    raise BadRequest(message)
telegram.error.BadRequest: Can't parse entities: character '-' is reserved and must be escaped with the preceding '\'

Have you ever seen this error ?
Cheers

Error while getting Updates: Conflict: terminated by other getUpdates request; make sure that only one bot instance is running

Hello, I had to restart the bot so I killed it and run it again, but now I'm having this error:

2021-04-27 16:35:52,906 - telegram.ext.updater - ERROR - Error while getting Updates: Conflict: terminated by other getUpdates request; make sure that only one bot instance is running
2021-04-27 16:35:52,906 - telegram.ext.dispatcher - ERROR - No error handlers are registered, logging exception.
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telegram/ext/updater.py", line 516, in _network_loop_retry
    if not action_cb():
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telegram/ext/updater.py", line 467, in polling_action_cb
    updates = self.bot.get_updates(
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telegram/bot.py", line 127, in decorator
    result = func(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telegram/bot.py", line 2761, in get_updates
    result = self._post(
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telegram/bot.py", line 259, in _post
    return self.request.post(
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telegram/utils/request.py", line 349, in post
    result = self._request_wrapper(
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telegram/utils/request.py", line 276, in _request_wrapper
    raise Conflict(message)
telegram.error.Conflict: Conflict: terminated by other getUpdates request; make sure that only one bot instance is running

Do you have any idea how to kill the other instance ? Thanks

Add support for multiple languages

When I started the BTB-manager-telegram project my goal was to give easy access to autmated trading to people who are not familiar with terminals and such.
I had chats with many of this project's users and many of them don't seem to be native english speakers.
I believe adding mulitple language support will be another step into the right direction and will provide even easier access to automated trading technology to people from anywhere in the world.

Error with configuration commands win WIN 10

Hey mate!
Thanks for your AWESOME work with this bot! Is amazing!
I run the bot well, all is working except the all commands relating to files or processes.
I attach you the error code, im not just asking, i tried everything, trying to debug in stackoverflow....
I know is a permission problem, i tried running as administrator binance_bot and telegram_bot with the same errors.

I hope you can help me friend

Thanks another time

MUCHAS GRACIAS AMIGO ITALIANO!

2021-04-15 20:38:28,571 - __main__ - INFO - Menu selector. (⚙ Edit user.cfg)
2021-04-15 20:38:28,571 - __main__ - INFO - Edit user configuration button pressed.
2021-04-15 20:38:28,579 - telegram.ext.dispatcher - ERROR - No error handlers are registered, logging exception.
Traceback (most recent call last):
  File "C:\Users\tiwes\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\psutil\_pswindows.py", line 780, in cmdline
    ret = cext.proc_cmdline(self.pid, use_peb=True)
PermissionError: [WinError 5] Acceso denegado: '(originated from OpenProcess)'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\tiwes\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\psutil\_pswindows.py", line 679, in wrapper
    return fun(self, *args, **kwargs)
  File "C:\Users\tiwes\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\psutil\_pswindows.py", line 695, in wrapper
    return fun(self, *args, **kwargs)
  File "C:\Users\tiwes\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\psutil\_pswindows.py", line 783, in cmdline
    ret = cext.proc_cmdline(self.pid, use_peb=False)
PermissionError: [Errno 13] assume access denied (originated from NtQueryInformationProcess(ProcessBasicInformation) -> STATUS_NOT_FOUND)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\tiwes\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\telegram\ext\dispatcher.py", line 442, in process_update
    handler.handle_update(update, self, check, context)
  File "C:\Users\tiwes\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\telegram\ext\conversationhandler.py", line 549, in handle_update
    new_state = handler.handle_update(update, dispatcher, check_result, context)
  File "C:\Users\tiwes\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\telegram\ext\handler.py", line 160, in handle_update
    return self.callback(update, context)
  File "C:\Users\tiwes\desktop\CRIPTO APPS\BTB-manager-telegram\BTBManagerTelegram.py", line 242, in __menu
    re = self.__btn_edit_user_cfg()
  File "C:\Users\tiwes\desktop\CRIPTO APPS\BTB-manager-telegram\BTBManagerTelegram.py", line 728, in __btn_edit_user_cfg
    if not self.__find_process():
  File "C:\Users\tiwes\desktop\CRIPTO APPS\BTB-manager-telegram\BTBManagerTelegram.py", line 457, in __find_process
    p.cmdline()
  File "C:\Users\tiwes\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\psutil\__init__.py", line 677, in cmdline
    return self._proc.cmdline()
  File "C:\Users\tiwes\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\psutil\_pswindows.py", line 681, in wrapper
    raise convert_oserror(err, pid=self.pid, name=self._name)
psutil.AccessDenied: psutil.AccessDenied (pid=124, name='Registry')

Add "Quick sell" button

Not sure if this fully belongs here or not, but if the market suddenly tanks it could be nice to have some sort of "panic button" that sells the current coin (with option of either at a limit you choose or market sell, risky though) and stops the bot.

You can then restart the bot later when the market stabilises.

Cleanup `__btn_current_ratio` and `__btn_current_value` methods

Separating current value and current ratio is a good idea as well as separating all those buttons in two pages.

The only changes to your PR I would suggest are:

  • Change Current ratio to Current ratios
  • When one of the buttons in the Configurations sub-menu is pressed, stay in the Configurations sub-menu after button action completition instead of going back to the main sub-menu
  • Some cleaning up needs to be done in the __btn_current_ratio and __btn_current_value methods

Thanks for the contributions!

Originally posted by @lorcalhost in #11 (comment)

Add a feature to purge trade bot logs

TSIA

The logs can sometimes eat up a lot of space, so it'll be nice to have a way to purge logs.

Maybe this can be coupled with Delete Database? I don't know if there's a valid use case where you will want to purge db, but not the logs.

`Start bot` not working when full path is passed as argument

If a full path (e.g. /root/bot/install/dir) is passed as argument -p instead of a relative one (e.g. ../bot/install/dir) BTBMT is unable to start BTB.

It might be due to this function:

def get_binance_trade_bot_process() -> Optional[psutil.Process]:
name = "binance_trade_bot"
is_root_path_absolute = os.path.isabs(settings.ROOT_PATH)
bot_path = settings.ROOT_PATH
if not is_root_path_absolute:
bot_path = os.path.normpath(os.path.join(os.getcwd(), settings.ROOT_PATH))
for proc in psutil.process_iter():
if (
name in proc.name() or name in " ".join(proc.cmdline())
) and proc.cwd() == bot_path:
return proc

@DmytroLitvinov do you know more about this?

Windows compatibility

Hello,

Follow the instructions and run the script, first part is working (connection with Telegram).
But when there must be a interaction with the binance trader bot I get a permission error.

2021-03-29 20:48:29,614 - telegram.ext.dispatcher - ERROR - No error handlers are registered, logging exception. Traceback (most recent call last): File "C:\Python\lib\site-packages\psutil\_pswindows.py", line 780, in cmdline ret = cext.proc_cmdline(self.pid, use_peb=True) PermissionError: [WinError 5] Access denied: '(originated from OpenProcess)'

I have already try to run with the admin rights but unfortunately it doesn't work.
Are there any suggestions to try?

Thanks a lot.

telegram.error.BadRequest: Message is too long

When sending last 20 lines of log file eroor telegram.error.BadRequest: Message is too long sometimes occurs.

This seems due to the fact that Telegram's api only supports 4096 bytes per message.

Find a way to avoid this error and still display something useful.

Update available notifications not working

Current behavior:

Update is only checked on bot startup

Expected behavior:

  • Bot checks every hour if update for BTB or BTBMT is available
  • If available notify the user and remind every 12 hours

Might have to put a sleep timer before scheduling a new event, further inspection needed.

Clicking buttons in the 'Configurations' tab throw errors

Hey there, thank you for the wonderful bot! Trying to understand where my issue lies here.

Every button (except 'Read last log lines') throws an error like this:

Traceback (most recent call last):
  File "C:\Users\Anthony\AppData\Local\Programs\Python\Python39\lib\site-packages\psutil\_pswindows.py", line 780, in cmdline
    ret = cext.proc_cmdline(self.pid, use_peb=True)
PermissionError: [WinError 5] Access is denied: '(originated from OpenProcess)'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Anthony\AppData\Local\Programs\Python\Python39\lib\site-packages\psutil\_pswindows.py", line 679, in wrapper
    return fun(self, *args, **kwargs)
  File "C:\Users\Anthony\AppData\Local\Programs\Python\Python39\lib\site-packages\psutil\_pswindows.py", line 695, in wrapper
    return fun(self, *args, **kwargs)
  File "C:\Users\Anthony\AppData\Local\Programs\Python\Python39\lib\site-packages\psutil\_pswindows.py", line 783, in cmdline
    ret = cext.proc_cmdline(self.pid, use_peb=False)
PermissionError: [WinError 5] Access is denied: '(originated from OpenProcess)'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Anthony\AppData\Local\Programs\Python\Python39\lib\site-packages\telegram\ext\dispatcher.py", line 442, in process_update
    handler.handle_update(update, self, check, context)
  File "C:\Users\Anthony\AppData\Local\Programs\Python\Python39\lib\site-packages\telegram\ext\conversationhandler.py", line 549, in handle_update
    new_state = handler.handle_update(update, dispatcher, check_result, context)
  File "C:\Users\Anthony\AppData\Local\Programs\Python\Python39\lib\site-packages\telegram\ext\handler.py", line 160, in handle_update
    return self.callback(update, context)
  File "C:\Users\Anthony\Desktop\Binance Trade Bot\BTB-manager-telegram\btb_manager_telegram\handlers.py", line 148, in menu
    re = buttons.edit_coin()
  File "C:\Users\Anthony\Desktop\Binance Trade Bot\BTB-manager-telegram\btb_manager_telegram\buttons.py", line 364, in edit_coin
    if not get_binance_trade_bot_process():
  File "C:\Users\Anthony\Desktop\Binance Trade Bot\BTB-manager-telegram\btb_manager_telegram\utils.py", line 82, in get_binance_trade_bot_process
    name in proc.name() or name in " ".join(proc.cmdline())
  File "C:\Users\Anthony\AppData\Local\Programs\Python\Python39\lib\site-packages\psutil\__init__.py", line 677, in cmdline
    return self._proc.cmdline()
  File "C:\Users\Anthony\AppData\Local\Programs\Python\Python39\lib\site-packages\psutil\_pswindows.py", line 681, in wrapper
    raise convert_oserror(err, pid=self.pid, name=self._name)
psutil.AccessDenied: psutil.AccessDenied (pid=116, name='csrss.exe')

I can't decypher what it means myself, but maybe you can help.

Thank you so much in advance!

Add handling for empty content of apprise.yml file

Traceback (most recent call last):
  File "BTBManagerTelegram.py", line 4, in <module>
    pre_run_main()
  File "/home/manager/binance-trade-bot/BTB-manager-telegram/btb_manager_telegram/__main__.py", line 49, in pre_run_main
    setup_telegram_constants()
  File "/home/manager/binance-trade-bot/BTB-manager-telegram/btb_manager_telegram/utils.py", line 27, in setup_telegram_constants
    parsed_urls = yaml.load(f, Loader=yaml.FullLoader)["urls"]
TypeError: 'NoneType' object is not subscriptable

Add a order history command

I think it's great to have a order history command, with the response.

Coin from, coin to
Coin value bought
Coin amount bought
Date of order placement
Order is done
Type of order

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.