bittrex fetch_open_orders returning incorrect None on retry after DDoSProtection error
See original GitHub issueATTENTION!!!
MUST READ THIS BEFORE SUBMITTING ISSUES (read the link, then delete this message before submitting):
https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-submit-an-issue
- OS: Windows 10
- Programming Language version: Python 3.6.3
- CCXT version: ‘1.18.458’
- Exchange: bittrex
- Method: fetch_open_orders
I had two processes running side by side that got throttled. I have them on a 60 second sleep before restart. Other requests such as cancel_order, request_order have no problems restarting. However, fetch_open_orders somehow always retrieves None on the retry call. Meanwhile, I have other trades open so the result should not be None(I get this bug repeatedly). Here is the output:
Placing an order on PART/BTC for these parameters: sell, closing, 166.0 units at price 0.00037268
bittrex.fetch_open_orders failed with exception DDoSProtection: bittrex {"success":false,"message":"Call to GetOpenOrders was throttled. Try again in 60 seconds.","result":null}
Traceback (most recent call last):
...
File "C:\Users\nt\Documents\Bots\RobotZai2-2c.py", line 311, in run_fighter
self.create_order(trade, current_best_entry)
File "C:\Users\nt\Documents\Bots\RobotZai2-2c.py", line 281, in create_order
trade.trade_update('id')
File "C:\Users\nt\Documents\Bots\RobotZai2-2c.py", line 522, in trade_update
open_orders.reverse()
AttributeError: 'NoneType' object has no attribute 'reverse'
Here is the code
def api_call(message, *args):
response = eval(message)(*args)
except ccxt.OrderNotFound as e: #Typically get this one when order was filled on exchange side between calls
print(message + ' failed with exception OrderNotFound: ', str(e))
return 'OrderNotFound'
except ccxt.RequestTimeout as e:
print(message + ' failed with exception RequestTimeout: ', str(e))
time.sleep(1)
bittrex.rateLimit = (bittrex.rateLimit * 2)
api_call(message, *args)
except ccxt.DDoSProtection as e:
print(message + ' failed with exception DDoSProtection: ', str(e))
time.sleep(bittrex.throttleDelay)
bittrex.rateLimit = (bittrex.rateLimit * 2)
api_call(message, *args)
except Exception as e:
print(message + ' failed with exception General: ', str(e))
sys.exit()
else:
return response
#Called from here when getting the order_id for a new order
open_orders = api_call('bittrex.fetch_open_orders')
open_orders.reverse()
I’m sorry, I can’t figure out how to properly indent here…I added a photo of the code in case it is unclear. I would appreciate help with this issue, thank you.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
I see what my problem was, fixed it, thank you very much!
That was exactly the version i posted here initially, but then I edited it for your case with
response
)) You’re absolutely right )