List index out of range for orders[coin]See original GitHub issue
When update_portfolio is called, I very often get a
list index out of range error and the program crashes.
File "app.py", line 286, in <module> update_porfolio(orders, last_price, volume) File "app.py", line 228, in update_porfolio 'symbol': orders[coin]['symbol'], IndexError: list index out of range
Using my debugger, it looks like some currencies that the bot tries to buy are in the orders dict, but some don’t end up going in there and are just empty.
I’m guessing it’s an issue where the client is retrieving orders too quickly before they place on Binance’s end?
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top GitHub Comments
I have the same issue all the time in live aswell. Tried changing all requests to await using async functions from binance library, but same result. It’s a big problem because it creates the orders, crashes before it puts it in the JSON and the orders are stuck in limbo until you manually sell them back to USDT on binance
Not the original coder and I’m not familiar with Python, but in NodeJs there’s this concept of async/await for things like this. I did a quick google and I think this might be similar: https://docs.python.org/3/library/asyncio-task.html