JeeZues / TradeBot

GNU General Public License v3.0
4 stars 4 forks source link

TradeBot Crashed out during market craziness. #2

Closed derrey closed 3 years ago

derrey commented 3 years ago

Yesterday (May 3, 2020) during the BTC market drop, the Futures bots were going a bit crazy and one of the 2 TradeBot's that we have been testing crashed out. I was able to capture this info and restart without any problems. The 2 backups were fine.


File "", line 3, in raise_from File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 421, in _make_request httplib_response = conn.getresponse() File "/usr/lib/python3.8/http/client.py", line 1347, in getresponse response.begin() File "/usr/lib/python3.8/http/client.py", line 307, in begin version, status, reason = self._read_status() File "/usr/lib/python3.8/http/client.py", line 268, in _read_status line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1") File "/usr/lib/python3.8/socket.py", line 669, in readinto return self._sock.recv_into(b) File "/usr/lib/python3/dist-packages/urllib3/contrib/pyopenssl.py", line 326, in recv_into raise timeout("The read operation timed out") socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3/dist-packages/requests/adapters.py", line 439, in send resp = conn.urlopen( File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 724, in urlopen retries = retries.increment( File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 403, in increment raise six.reraise(type(error), error, _stacktrace) File "/usr/lib/python3/dist-packages/six.py", line 703, in reraise raise value File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 670, in urlopen httplib_response = self._make_request( File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 428, in _make_request self._raise_timeout(err=e, url=url, timeout_value=read_timeout) File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 335, in _raise_timeout raise ReadTimeoutError( urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='api.binance.com', port=443): Read timed out. (read timeout=10)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "run.py", line 526, in ret = run_account(account, Binance_API_KEY, Binance_API_SECRET) File "/mnt/TradeBot/timeout.py", line 18, in wrapper result = func(*args, kwargs) File "run.py", line 207, in run_account usdt_spot_total_balance = get_spot_balance(BinanceClient) File "/mnt/TradeBot/utils.py", line 79, in get_spot_balance coins = Client.get_all_coins_info() File "/mnt/TradeBot/python_binance/binance/client.py", line 5837, in get_all_coins_info return self._request_margin_api('get', 'capital/config/getall', True, data=params) File "/mnt/TradeBot/python_binance/binance/client.py", line 275, in _request_margin_api return self._request(method, uri, signed, kwargs) File "/mnt/TradeBot/python_binance/binance/client.py", line 259, in _request self.response = getattr(self.session, method)(uri, kwargs) File "/usr/lib/python3/dist-packages/requests/sessions.py", line 543, in get return self.request('GET', url, kwargs) File "/usr/lib/python3/dist-packages/requests/sessions.py", line 530, in request resp = self.send(prep, send_kwargs) File "/usr/lib/python3/dist-packages/requests/sessions.py", line 643, in send r = adapter.send(request, kwargs) File "/usr/lib/python3/dist-packages/requests/adapters.py", line 529, in send raise ReadTimeout(e, request=request) requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='api.binance.com', port=443): Read timed out. (read timeout=10)

JeeZues commented 3 years ago

The error is expected if the API times out. It prevents stuck API calls from holding the script. The script should auto restart after such error if it was running before. Did it not do that? You can simulate the case by disconnecting WiFi or blocking one of the API domains, etc. Last time I tested it, it worked...

derrey commented 3 years ago

The error is expected if the API times out. It prevents stuck API calls from holding the script. The script should auto restart after such error if it was running before. Did it not do that? You can simulate the case by disconnecting WiFi or blocking one of the API domains, etc. Last time I tested it, it worked...

yes.. It just happened again and it did restart... I think that I just was in front of it when it happened last time and I stopped and restarted it in a panic.. hehe :)

thanks

derrey commented 3 years ago

Hi, This is what happens when 3C is down and you have to restart the script.




ERROR: Expected to get a list from 3Commas, got: {'error': 'unknown_error', 'error_description': 'Unknown error occurred#DistributeReads::TooMuchLag'} Traceback (most recent call last): File "run.py", line 515, in account, account_txt = getAccountID(account_name) File "/mnt/TradeBot/utils.py", line 448, in getAccountID accounts_found += f"{account['exchange_name']}\t:\t{account['name']}\n" TypeError: string indices must be integers

JeeZues commented 3 years ago

that is strange, my script is able to recover from that error just fine with no input from me... I'm running on Linux Mint 19.3 if that makes a difference.

derrey commented 3 years ago

that is strange, my script is able to recover from that error just fine with no input from me... I'm running on Linux Mint 19.3 if that makes a difference.

What are you using to autostart the scripts on boot?

JeeZues commented 3 years ago

I don't reboot that often so I manually start. I have the backup scripts running on a different machine in a different physical location so the odds of both going down at the same time is low. You can setup crontab to run the jobs on boot though...