def import_command( self, # type: HummingbotApplication file_name): if file_name is not None: file_name = format_config_file_name(file_name) safe_ensure_future(self.import_config_file(file_name))
def create(self, # type: HummingbotApplication file_name): if file_name is not None: file_name = format_config_file_name(file_name) if (STRATEGIES_CONF_DIR_PATH / file_name).exists(): self.notify(f"{file_name} already exists.") return safe_ensure_future(self.prompt_for_configuration(file_name))
def create(self, # type: HummingbotApplication file_name): if file_name is not None: file_name = format_config_file_name(file_name) if os.path.exists(os.path.join(CONF_FILE_PATH, file_name)): self._notify(f"{file_name} already exists.") return safe_ensure_future(self.prompt_for_configuration(file_name))
async def prompt_new_file_name(self, # type: HummingbotApplication strategy): file_name = default_strategy_file_path(strategy) self.app.set_text(file_name) input = await self.app.prompt(prompt="Enter a new file name for your configuration >>> ") input = format_config_file_name(input) file_path = os.path.join(STRATEGIES_CONF_DIR_PATH, input) if input is None or input == "": self.notify("Value is required.") return await self.prompt_new_file_name(strategy) elif os.path.exists(file_path): self.notify(f"{input} file already exists, please enter a new name.") return await self.prompt_new_file_name(strategy) else: return input