question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IndexError: list index out of range

See original GitHub issue
 ETHUSDT has gained 21.425% in the last 5 minutes, calculating volume in USDT
 preparing to buy 0.26192 ETHUSDT
Traceback (most recent call last):
  File "/Users/miguelstevens/Desktop/bot/Binance Detect Moonings.py", line 299, in <module>
    update_porfolio(orders, last_price, volume)
  File "/Users/miguelstevens/Desktop/bot/Binance Detect Moonings.py", line 267, in update_porfolio
    'symbol': orders[coin][0]['symbol'],
IndexError: list index out of range

Received this error, the console has been open for about an hour, all default settings are there, using testnet as well.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
CyberPunkMetalHeadcommented, May 9, 2021

I believe I have found a fix for this as well as the cause of the issue. Binance seems to take a while (sometimes up to 3 seconds until it returns the results of a live order). I have added a while block that will keep on calling the API once every second it returns the order. The output will look something like this

Binance is being slow in returning the order, again the API again... Binance is being slow in returning the order, again the API again... Binance is being slow in returning the order, again the API again... Order returned, saving order to file preparing to buy 110.0 DOCKUSDT

I will shortly commit the changes to the main branch

0reactions
CyberPunkMetalHeadcommented, May 10, 2021

New commit pushed, this should fix the issue above, feel free to re-open the issue in case it doesn’t

Read more comments on GitHub >

github_iconTop Results From Across the Web

List Index Out of Range – Python Error Message Solved
You'll get the Indexerror: list index out of range error when iterating through a list and trying to access an item that doesn't...
Read more >
Indexerror: list Index Out of Range in Python - STechies
In python “list index out of range” error occurs when we try to access an undefined element from the list. List index out...
Read more >
Index Error: list index out of range (Python) - Stack Overflow
Generally it means that you are providing an index for which a list element does not exist. E.g, if your list was [1,...
Read more >
Python IndexError: List Index Out of Range [Easy Fix] - Finxter
The error “list index out of range” arises if you access invalid indices in your ...
Read more >
How to debug list index out of range error in python? - Flexiple
To foolproof your loop of such instances, the range() function along with len() would return the length of the list dynamically. Subsequently ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found