Codaone / DEXBot

Trading Bot for the BitShares Decentralized Exchange
Other
249 stars 129 forks source link

IndexError: list index out of range #445

Closed dev-x0 closed 5 years ago

dev-x0 commented 5 years ago

Expected Behavior

I assume config just moves onto next step.

Actual Behavior

Config outputs an error.

Steps to Reproduce the Problem

  1. dexbot-cli configure
  2. configure up to point where cli asks for external price source
  3. pick any price source eg. binance and select Ok, an error will appear and the config menu will close saying IndexError: list index out of range

Specifications

thehapax commented 5 years ago

This is related to external feeds, i will take a look after project administrative tasks

thehapax commented 5 years ago

I find this bug to be introduced during @joelvai 's refactoring in december where the "none" option is commented out.

https://github.com/Codaone/DEXBot/commit/a7015edf8e411ac8ab351d143aca11bc408915d4#diff-6a2e0d37f88f35d4bcc3e1d9da39a4b4

suggest default value to be none in config element instead of exchanges[0] . will continue to look at this tmr.

PermieBTS commented 5 years ago

Is there a planned fix for this bug?

bitphage commented 5 years ago

Ok, I'm able to reproduce the problem only by using a input value outside of proposed:

External price source - The bot will try to get price information from this source

 1) Coingecko
 2) Waves DEX
 3) Kraken
 4) Bitfinex
 5) Gdax
 6) Binance

Your choice: [1]: 7
Traceback (most recent call last):
  File "./cli.py", line 6, in <module>
    cli.main()
  File "/home/vvk/.local/share/virtualenvs/DEXBot-XTl2tJdV/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/vvk/.local/share/virtualenvs/DEXBot-XTl2tJdV/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/vvk/.local/share/virtualenvs/DEXBot-XTl2tJdV/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/vvk/.local/share/virtualenvs/DEXBot-XTl2tJdV/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/vvk/.local/share/virtualenvs/DEXBot-XTl2tJdV/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/vvk/.local/share/virtualenvs/DEXBot-XTl2tJdV/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/vvk/.local/share/virtualenvs/DEXBot-XTl2tJdV/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/vvk/devel/DEXBot/dexbot/ui.py", line 130, in new_func
    return ctx.invoke(f, *args, **kwargs)
  File "/home/vvk/.local/share/virtualenvs/DEXBot-XTl2tJdV/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/vvk/.local/share/virtualenvs/DEXBot-XTl2tJdV/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/vvk/devel/DEXBot/dexbot/ui.py", line 87, in new_func
    return ctx.invoke(f, *args, **kwargs)
  File "/home/vvk/.local/share/virtualenvs/DEXBot-XTl2tJdV/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/vvk/.local/share/virtualenvs/DEXBot-XTl2tJdV/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/vvk/devel/DEXBot/dexbot/ui.py", line 120, in new_func
    return ctx.invoke(f, *args, **kwargs)
  File "/home/vvk/.local/share/virtualenvs/DEXBot-XTl2tJdV/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/vvk/devel/DEXBot/dexbot/cli.py", line 145, in configure
    configure_dexbot(config, ctx)
  File "/home/vvk/devel/DEXBot/dexbot/cli_conf.py", line 277, in configure_dexbot
    config['workers'][txt] = configure_worker(whiptail, {})
  File "/home/vvk/devel/DEXBot/dexbot/cli_conf.py", line 236, in configure_worker
    process_config_element(elem, whiptail, worker_config)
  File "/home/vvk/devel/DEXBot/dexbot/cli_conf.py", line 122, in process_config_element
    config.get(elem.key, elem.default), elem.extra))
  File "/home/vvk/devel/DEXBot/dexbot/whiptail.py", line 157, in radiolist
    return self.menu(msg, [(k, v) for k, v, s in items], default=default)
  File "/home/vvk/devel/DEXBot/dexbot/whiptail.py", line 147, in menu
    ret = items[ret - 1]
IndexError: list index out of range
thehapax commented 5 years ago

I already made the fix on my branch here, the bug i did not find on whiptail but in the config elements. Here is the pull request: https://github.com/Codaone/DEXBot/pull/503

Why are we making the assignment of this redundant? @PermieBTS @vvk

bitphage commented 5 years ago

@PermieBTS asked me to look into this bug.

PermieBTS commented 5 years ago

There was some confusion between octo and I over reassigning this issue to vvk. My apologies