예제 #1
0
 async def _unlock_wallet(self):
     choice = await self.app.prompt(
         prompt=
         "Would you like to unlock your previously saved wallet? (y/n) >>> "
     )
     if choice.lower() == "y":
         wallets = list_wallets()
         self.app.log("Existing wallets:")
         self.list(obj="wallets")
         if len(wallets) == 1:
             public_key = wallets[0]
         else:
             public_key = await self.app.prompt(
                 prompt="Which wallet would you like to import ? >>> ")
         password = await self.app.prompt(prompt="Enter your password >>> ",
                                          is_password=True)
         try:
             acct = unlock_wallet(public_key=public_key, password=password)
             self.app.log("Wallet %s unlocked" % (acct.address, ))
             self.acct = acct
             return self.acct.address
         except Exception as e:
             self.app.log("Cannot unlock wallet. Please try again.")
             result = await self._unlock_wallet()
             return result
     else:
         value = await self._create_or_import_wallet()
         return value
예제 #2
0
async def main():
    await create_yml_files()
    init_logging("hummingbot_logs.yml")
    read_configs_from_yml()
    hb = HummingbotApplication()
    hb.acct = unlock_wallet(public_key=WALLET_PUBLIC_KEY, password=WALLET_PASSWORD)

    with patch_stdout(log_field=hb.app.log_field):
        init_logging("hummingbot_logs.yml", override_log_level=global_config_map.get("log_level").value)
        logging.getLogger().info("____DEV_MODE__start_directly__")

        in_memory_config_map.get("strategy").value = STRATEGY
        in_memory_config_map.get("strategy").validate(STRATEGY)
        in_memory_config_map.get("strategy_file_path").value = STRATEGY_PATH
        in_memory_config_map.get("strategy_file_path").validate(STRATEGY_PATH)
        global_config_map.get("wallet").value = WALLET_PUBLIC_KEY

        tasks: List[Coroutine] = [hb.run()]
        await asyncio.gather(*tasks)