Skip to content

Commit

Permalink
Fix CLI new worker creation
Browse files Browse the repository at this point in the history
  • Loading branch information
joelvai committed Oct 30, 2018
1 parent 892c24a commit 0964b06
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions dexbot/cli_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,12 @@ def get_strategy_tag(strategy_class):


def configure_worker(whiptail, worker_config):
# By default always editing
editing = True

if not worker_config:
editing = False

default_strategy = worker_config.get('module', 'dexbot.strategies.relative_orders')
strategy_list = []

Expand All @@ -185,6 +191,7 @@ def configure_worker(whiptail, worker_config):
# Add strategy tag and name pairs to a list
strategy_list.append([strategy['tag'], strategy['name']])

# Strategy selection
worker_config['module'] = whiptail.radiolist(
"Choose a worker strategy",
select_choice(default_strategy, strategy_list)
Expand All @@ -200,8 +207,8 @@ def configure_worker(whiptail, worker_config):
'Strategy'
)

# Check if strategy has changed
if default_strategy != get_strategy_tag(worker_config['module']):
# Check if strategy has changed and editing existing worker
if editing and default_strategy != get_strategy_tag(worker_config['module']):
new_worker_config = {}

# If strategy has changed, create new config where base elements stay the same
Expand Down

0 comments on commit 0964b06

Please sign in to comment.