donewiththedollar / directionalscalper

CCXT based algorithmic trading framework for Bybit and other CCXT supported exchanges

Home Page:https://quantumvoid.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

add try to this + maybe try to catch retcode too many visits

ilaykim opened this issue · comments

self.exchange.cancel_all_open_orders_bybit(symbol)

Exception in thread Thread-196 (run_single_symbol):
Traceback (most recent call last):
File "/home/bot/.pyenv/versions/3.11.0/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
self.run()
File "/home/bot/.pyenv/versions/3.11.0/lib/python3.11/threading.py", line 975, in run
self._target(*self._args, **self._kwargs)
File "/home/bot/directionalscalper/directionalscalper/core/strategies/bybit/multi/bybit_mm.py", line 371, in
run_single_symbol
self.cancel_stale_orders_bybit()
File "/home/bot/directionalscalper/directionalscalper/core/strategies/strategy.py", line 3474, in
cancel_stale_orders_bybit
self.exchange.cancel_all_open_orders_bybit(symbol)
File "/home/bot/directionalscalper/directionalscalper/core/exchange.py", line 1761, in cancel_all_open_orders_bybit
return self.exchange.cancel_all_derivatives_orders(None, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bot/.pyenv/versions/3.11.0/lib/python3.11/site-packages/ccxt/bybit.py", line 4610, in
cancel_all_derivatives_orders
response = self.privatePostContractV3PrivateOrderCancelAll(self.extend(request, params))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bot/.pyenv/versions/3.11.0/lib/python3.11/site-packages/ccxt/base/types.py", line 26, in unbound_method
return _self.request(self.path, self.api, self.method, params, config=self.config)
File "/home/bot/.pyenv/versions/3.11.0/lib/python3.11/site-packages/ccxt/base/exchange.py", line 2989, in request
return self.fetch2(path, api, method, params, headers, body, config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bot/.pyenv/versions/3.11.0/lib/python3.11/site-packages/ccxt/base/exchange.py", line 2986, in fetch2
return self.fetch(request['url'], request['method'], request['headers'], request['body'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bot/.pyenv/versions/3.11.0/lib/python3.11/site-packages/ccxt/base/exchange.py", line 644, in fetch
self.handle_errors(http_status_code, http_status_text, url, method, headers, http_response, json_response,
request_headers, request_body)
File "/home/bot/.pyenv/versions/3.11.0/lib/python3.11/site-packages/ccxt/bybit.py", line 8286, in handle_errors
self.throw_exactly_matched_exception(self.exceptions['exact'], errorCode, feedback)
File "/home/bot/.pyenv/versions/3.11.0/lib/python3.11/site-packages/ccxt/base/exchange.py", line 3343, in
throw_exactly_matched_exception
raise exactstring
ccxt.base.errors.RateLimitExceeded: bybit {"retCode":10006,"retMsg":"Too many
visits","result":{},"retExtInfo":{},"time":1693923684133}

Thank you for pointing this out! Good eye! Seriously. :)

I added retries on two functions that were in regards to order cancellation, this seems to have reduced the rate limiting issues by a tiny bit however I still think there is over usage of fetching open_orders and once that is resolved I believe our rate limiting issues will be mitigated at large.