BitMEX / api-connectors

Libraries for connecting to the BitMEX API.

Home Page:https://www.bitmex.com/app/restAPI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

":"HTTPError" - 503 Service Unavailable

FM100X opened this issue · comments

Hi there,
I have a bot (programmed in Python, run from Spyder IDE) which works well in terms of logic, but after 20, sometimes 100s of iterations, the Spyder IDE will return an error comment like this one:

HTTPServiceUnavailable: 503 Service Unavailable: {"error":{"message":"The system is currently overloaded. Please try again later.","name":"HTTPError"}}

My program stops to work and I have to restart it (if I am lucky to see the error quickly), which is especially bad when it happens overnight.

Is there any code I can add to automatically restart the program when there is an issue? I ve programmed the bot myself but not very experienced with error handling on BitMex.

I provide below the full traceback:

Your current position is 200
This is iteration: 23
The time is now: 04:00:01
Traceback (most recent call last):

File "", line 259, in
client.Order.Order_amend(orderID=orderID, orderQty=orderQty*-2).result()

File "C:\Users\User\anaconda3\lib\site-packages\bravado\http_future.py", line 271, in result
swagger_result = self._get_swagger_result(incoming_response)

File "C:\Users\User\anaconda3\lib\site-packages\bravado\http_future.py", line 124, in wrapper
return func(self, *args, **kwargs)

File "C:\Users\User\anaconda3\lib\site-packages\bravado\http_future.py", line 303, in _get_swagger_result
self.request_config.response_callbacks,

File "C:\Users\User\anaconda3\lib\site-packages\bravado\http_future.py", line 334, in unmarshal_response
raise_on_unexpected(incoming_response)

File "C:\Users\User\anaconda3\lib\site-packages\bravado\http_future.py", line 408, in raise_on_unexpected
raise make_http_exception(response=http_response)

HTTPServiceUnavailable: 503 Service Unavailable: {"error":{"message":"The system is currently overloaded. Please try again later.","name":"HTTPError"}}

Thanks!!!

Hi. During periods of very high load, some requests are rejected at the API. Please see https://www.bitmex.com/app/loadShedding for more details.