Exemple #1
0
 async def connect_ethereum(self,  # type: HummingbotApplication
                            ):
     self.placeholder_mode = True
     self.app.hide_input = True
     ether_wallet = global_config_map["ethereum_wallet"].value
     to_connect = True
     if ether_wallet is not None:
         answer = await self.app.prompt(prompt=f"Would you like to replace your existing Ethereum wallet "
                                               f"{ether_wallet} (Yes/No)? >>> ")
         if self.app.to_stop_config:
             self.app.to_stop_config = False
             return
         if answer.lower() not in ("yes", "y"):
             to_connect = False
     if to_connect:
         private_key = await self.app.prompt(prompt="Enter your wallet private key >>> ", is_password=True)
         public_address = Security.add_private_key(private_key)
         global_config_map["ethereum_wallet"].value = public_address
         if global_config_map["ethereum_rpc_url"].value is None:
             await self.prompt_a_config(global_config_map["ethereum_rpc_url"])
         if global_config_map["ethereum_rpc_ws_url"].value is None:
             await self.prompt_a_config(global_config_map["ethereum_rpc_ws_url"])
         if self.app.to_stop_config:
             self.app.to_stop_config = False
             return
         save_to_yml(GLOBAL_CONFIG_PATH, global_config_map)
         err_msg = UserBalances.validate_ethereum_wallet()
         if err_msg is None:
             self._notify(f"Wallet {public_address} connected to hummingbot.")
         else:
             self._notify(f"\nError: {err_msg}")
     self.placeholder_mode = False
     self.app.hide_input = False
     self.app.change_prompt(prompt=">>> ")
Exemple #2
0
 async def connection_df(self  # type: HummingbotApplication
                         ):
     columns = ["Exchange", "  Keys Added", "  Keys Confirmed"]
     data = []
     failed_msgs = {}
     err_msgs = await UserBalances.instance().update_exchanges(
         reconnect=True)
     for option in sorted(OPTIONS):
         keys_added = "No"
         keys_confirmed = 'No'
         if option == "ethereum":
             eth_address = global_config_map["ethereum_wallet"].value
             if eth_address is not None and eth_address in Security.private_keys(
             ):
                 keys_added = "Yes"
                 err_msg = UserBalances.validate_ethereum_wallet()
                 if err_msg is not None:
                     failed_msgs[option] = err_msg
                 else:
                     keys_confirmed = 'Yes'
         else:
             api_keys = (await Security.api_keys(option)).values()
             if len(api_keys) > 0:
                 keys_added = "Yes"
                 err_msg = err_msgs.get(option)
                 if err_msg is not None:
                     failed_msgs[option] = err_msg
                 else:
                     keys_confirmed = 'Yes'
         data.append([option, keys_added, keys_confirmed])
     return pd.DataFrame(data=data, columns=columns), failed_msgs
Exemple #3
0
 async def connection_df(self  # type: HummingbotApplication
                         ):
     columns = [
         "Exchange", "  Keys Added", "  Keys Confirmed",
         "  Connector Status"
     ]
     data = []
     failed_msgs = {}
     network_timeout = float(
         global_config_map["other_commands_timeout"].value)
     try:
         err_msgs = await asyncio.wait_for(
             UserBalances.instance().update_exchanges(reconnect=True),
             network_timeout)
     except asyncio.TimeoutError:
         self._notify(
             "\nA network error prevented the connection table to populate. See logs for more details."
         )
         raise
     for option in sorted(OPTIONS):
         keys_added = "No"
         keys_confirmed = 'No'
         status = get_connector_status(option)
         if option == "ethereum":
             eth_address = global_config_map["ethereum_wallet"].value
             if eth_address is not None and eth_address in Security.private_keys(
             ):
                 keys_added = "Yes"
                 err_msg = UserBalances.validate_ethereum_wallet()
                 if err_msg is not None:
                     failed_msgs[option] = err_msg
                 else:
                     keys_confirmed = 'Yes'
         elif option == "celo":
             celo_address = global_config_map["celo_address"].value
             if celo_address is not None and Security.encrypted_file_exists(
                     "celo_password"):
                 keys_added = "Yes"
                 err_msg = await self.validate_n_connect_celo(True)
                 if err_msg is not None:
                     failed_msgs[option] = err_msg
                 else:
                     keys_confirmed = 'Yes'
         else:
             api_keys = (await Security.api_keys(option)).values()
             if len(api_keys) > 0:
                 keys_added = "Yes"
                 err_msg = err_msgs.get(option)
                 if err_msg is not None:
                     failed_msgs[option] = err_msg
                 else:
                     keys_confirmed = 'Yes'
         data.append([option, keys_added, keys_confirmed, status])
     return pd.DataFrame(data=data, columns=columns), failed_msgs
 async def validate_required_connections(self) -> Dict[str, str]:
     invalid_conns = {}
     if self.strategy_name == "celo_arb":
         err_msg = await self.validate_n_connect_celo(True)
         if err_msg is not None:
             invalid_conns["celo"] = err_msg
     if not global_config_map.get("paper_trade_enabled").value:
         await self.update_all_secure_configs()
         connections = await UserBalances.instance().update_exchanges(exchanges=required_exchanges)
         invalid_conns.update({ex: err_msg for ex, err_msg in connections.items()
                               if ex in required_exchanges and err_msg is not None})
         if any(ex in DEXES for ex in required_exchanges):
             err_msg = UserBalances.validate_ethereum_wallet()
             if err_msg is not None:
                 invalid_conns["ethereum"] = err_msg
     return invalid_conns
 async def validate_required_connections(self) -> Dict[str, str]:
     invalid_conns = {}
     if self.strategy_name == "celo_arb":
         err_msg = await self.validate_n_connect_celo(True)
         if err_msg is not None:
             invalid_conns["celo"] = err_msg
     if not any([
             str(exchange).endswith("paper_trade")
             for exchange in required_exchanges
     ]):
         await self.update_all_secure_configs()
         connections = await UserBalances.instance().update_exchanges(
             exchanges=required_exchanges)
         invalid_conns.update({
             ex: err_msg
             for ex, err_msg in connections.items()
             if ex in required_exchanges and err_msg is not None
         })
         if ethereum_wallet_required():
             err_msg = UserBalances.validate_ethereum_wallet()
             if err_msg is not None:
                 invalid_conns["ethereum"] = err_msg
     return invalid_conns