BitBotFactory / MikaLendingBot

Automated lending on Cryptocurrency exchanges Poloniex and Bitfinex
http://poloniexlendingbot.readthedocs.io/en/latest/index.html
MIT License
1.11k stars 344 forks source link

list index out of range #566

Closed utdrmac closed 6 years ago

utdrmac commented 7 years ago

Config: http://termbin.com/anja

Welcome to "Bitfinex Lending Bot" on BITFINEX
ETH : Need more data for analysis, still collecting. I have 242/270 records
Caught exception during MACD analysis, using percentile for now
ETH : Need more data for analysis, still collecting. I have 245/270 records
Caught exception during MACD analysis, using percentile for now
BCH : Need more data for analysis, still collecting. I have 243/270 records
Caught exception during MACD analysis, using percentile for now
2017-10-23 12:50:55 Error list index out of range
Traceback (most recent call last):
  File "lendingbot.py", line 94, in <module>
    Lending.lend_all()
  File "/usr/src/bitfinex/modules/Lending.py", line 249, in lend_all
    lend_all()
  File "/usr/src/bitfinex/modules/Lending.py", line 247, in lend_all
    usable_currencies += lend_cur(cur, total_lent, lending_balances, ticker)
  File "/usr/src/bitfinex/modules/Lending.py", line 444, in lend_cur
    orders = construct_orders(active_cur, active_bal, active_cur_total_balance, ticker)  # Build all potential orders
  File "/usr/src/bitfinex/modules/Lending.py", line 345, in construct_orders
    top_rate, bottom_rate = get_gap_mode_rates(cur, cur_active_bal, cur_total_balance, ticker)
  File "/usr/src/bitfinex/modules/Lending.py", line 399, in get_gap_mode_rates
    top_rate = get_gap_rate(cur, top_depth, order_book, cur_total_balance, True)
  File "/usr/src/bitfinex/modules/Lending.py", line 332, in get_gap_rate
    return Decimal(order_book['rates'][i])
IndexError: list index out of range

v343
 Unhandled error, please open a Github issue so we can fix it!
rurara commented 6 years ago

I have similar problem

File "lendingbot.py", line 94, in <module>
    Lending.lend_all()
  File "/data/www/poloniexlendingbot/modules/Lending.py", line 247, in lend_all
    usable_currencies += lend_cur(cur, total_lent, lending_balances, ticker)
  File "/data/www/poloniexlendingbot/modules/Lending.py", line 418, in lend_cur
    orders = construct_orders(active_cur, active_bal, active_cur_total_balance, ticker)  # Build all potential orders
  File "/data/www/poloniexlendingbot/modules/Lending.py", line 319, in construct_orders
    top_rate, bottom_rate = get_gap_mode_rates(cur, cur_active_bal, cur_total_balance, ticker)
  File "/data/www/poloniexlendingbot/modules/Lending.py", line 373, in get_gap_mode_rates
    top_rate = get_gap_rate(cur, top_depth, order_book, cur_total_balance, True)
  File "/data/www/poloniexlendingbot/modules/Lending.py", line 306, in get_gap_rate 
    return Decimal(order_book['rates'][i])
IndexError: list index out of range

v311 Unhandled error, please open a Github issue so we can fix it!

laxdog commented 6 years ago

Again, I think this is a corrupted DB.

utdrmac commented 6 years ago

How can the DB be corrupted between intervals? It's not like the db corrupts and then the bot crashes. You get these randomly but everything continues working again a few cycles later.

Evanito commented 6 years ago

Lots of reports for this same error recently. We should either:

The second one is likely better. And it appears that the error just coincidentally appeared alongside some DB work.

Evanito commented 6 years ago

https://github.com/BitBotFactory/poloniexlendingbot/blob/ce424469ee9c684d720be106f6dc1f57547d1544/modules/Lending.py#L328

https://github.com/BitBotFactory/poloniexlendingbot/blob/ce424469ee9c684d720be106f6dc1f57547d1544/modules/Lending.py#L333

Two instances where you get an off by one error due to comparing an iterator to the length. Oops. Fix coming shortly.