List index out of range for orders[coin]
See original GitHub issueWhen 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][0]['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?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:6 (2 by maintainers)
Top Results From Across the Web
List Index Out of Range – Python Error Message Solved
In this article you'll see a few of the reasons that cause the list index out of range Python error. Besides knowing why...
Read more >How to fix - List Index Out of Range in Python - GeeksforGeeks
In this article, we are going to see how to fix – List Index Out of Range in Python. Why we get- List...
Read more >Can anyone help me to understand why i have the error "list ...
Can anyone help me to understand why i have the error "list index out of range"? · i goes past the end of...
Read more >How to Fix IndexError in Python - Rollbar
The IndexError in Python occurs when an item from a list is attempted to be accessed that is outside the index range of...
Read more >IndexError: list index out of range - YouTube
Traceback (most recent call last): File "stdin", line 1, in moduleIndexError: list index out of rangelike this video, share, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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