Skip to content

Commit

Permalink
Merge pull request hummingbot#3131 from TheHolyRoger/feat/configurabl…
Browse files Browse the repository at this point in the history
…e-auto-fill-after-import

Feat / Add auto-fill after `import` command again, configurable with setting
  • Loading branch information
dennisocana authored Mar 30, 2021
2 parents 2a4109e + 6d05914 commit aeab025
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions hummingbot/client/command/config_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
no_restart_pmm_keys_in_percentage = ["bid_spread", "ask_spread", "order_level_spread", "inventory_target_base_pct"]
no_restart_pmm_keys = ["order_amount", "order_levels", "filled_order_delay", "inventory_skew_enabled", "inventory_range_multiplier"]
global_configs_to_display = ["0x_active_cancels",
"autofill_import",
"kill_switch_enabled",
"kill_switch_rate",
"telegram_enabled",
Expand Down
4 changes: 4 additions & 0 deletions hummingbot/client/command/import_command.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os

from hummingbot.core.utils.async_utils import safe_ensure_future
from hummingbot.client.config.global_config_map import global_config_map
from hummingbot.client.config.config_helpers import (
update_strategy_config_map_from_file,
short_strategy_name,
Expand Down Expand Up @@ -43,6 +44,9 @@ async def import_config_file(self, # type: HummingbotApplication
self.app.change_prompt(prompt=">>> ")
if await self.status_check_all():
self._notify("\nEnter \"start\" to start market making.")
autofill_import = global_config_map.get("autofill_import").value
if autofill_import is not None:
self.app.set_text(autofill_import)

async def prompt_a_file_name(self # type: HummingbotApplication
):
Expand Down
8 changes: 8 additions & 0 deletions hummingbot/client/config/global_config_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,14 @@ def global_token_symbol_on_validated(value: str):
default=-100,
validator=lambda v: validate_decimal(v, Decimal(-100), Decimal(100)),
required_if=lambda: global_config_map["kill_switch_enabled"].value),
"autofill_import":
ConfigVar(key="autofill_import",
prompt="What to auto-fill in the prompt after each import command? (start/config) >>> ",
type_str="str",
default=None,
validator=lambda s: None if s in {"start",
"config"} else "Invalid auto-fill prompt.",
required_if=lambda: False),
"telegram_enabled":
ConfigVar(key="telegram_enabled",
prompt="Would you like to enable telegram? >>> ",
Expand Down
5 changes: 4 additions & 1 deletion hummingbot/templates/conf_global_TEMPLATE.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#################################

# For more detailed information: https://docs.hummingbot.io
template_version: 19
template_version: 20

# Exchange configs
bamboo_relay_use_coordinator: false
Expand Down Expand Up @@ -101,6 +101,9 @@ kill_switch_enabled: null
# The rate of performance at which you would want the bot to stop trading (-20 = 20%)
kill_switch_rate: null

# What to auto-fill in the prompt after each import command (start/config)
autofill_import: null

# DEX active order cancellation
0x_active_cancels: false

Expand Down

0 comments on commit aeab025

Please sign in to comment.