async def show_balances(self):
     self._notify("Updating balances, please wait...")
     df = await self.balances_df()
     lines = [
         "    " + line for line in df.to_string(index=False).split("\n")
     ]
     self._notify("\n".join(lines))
     eth_address = global_config_map["ethereum_wallet"].value
     if eth_address is not None:
         bal = UserBalances.ethereum_balance()
         bal = round(bal, 4)
         self._notify(
             f"Ethereum balance in ...{eth_address[-4:]} wallet: {bal} ETH")
         self._notify(
             f"Note: You may have other ERC 20 tokens in this same address (not shown here)."
         )
     celo_address = global_config_map["celo_address"].value
     if celo_address is not None:
         try:
             if not CeloCLI.unlocked:
                 await self.validate_n_connect_celo()
             bals = CeloCLI.balances()
             self._notify("Celo balances:")
             for token, bal in bals.items():
                 self._notify(
                     f"  {token} - total: {bal.total} locked: {bal.locked}")
         except Exception as e:
             self._notify(f"Celo CLI Error: {str(e)}")
Exemple #2
0
 async def ethereum_balances_df(
         self,  # type: HummingbotApplication
 ):
     rows = []
     bal = UserBalances.ethereum_balance()
     rows.append({"asset": "ETH", "amount": round(bal, 4)})
     df = pd.DataFrame(data=rows, columns=["asset", "amount"])
     df.sort_values(by=["asset"], inplace=True)
     return df
 async def ethereum_balances_df(self,  # type: HummingbotApplication
                                ):
     rows = []
     if ethereum_required_trading_pairs():
         bals = await UserBalances.eth_n_erc20_balances()
         for token, bal in bals.items():
             rows.append({"Asset": token, "Amount": round(bal, 4)})
     else:
         eth_bal = UserBalances.ethereum_balance()
         rows.append({"Asset": "ETH", "Amount": round(eth_bal, 4)})
     df = pd.DataFrame(data=rows, columns=["Asset", "Amount"])
     df.sort_values(by=["Asset"], inplace=True)
     return df
 async def show_balances(self):
     self._notify("Updating balances, please wait...")
     df = await self.balances_df()
     lines = [
         "    " + line for line in df.to_string(index=False).split("\n")
     ]
     self._notify("\n".join(lines))
     eth_address = global_config_map["ethereum_wallet"].value
     if eth_address is not None:
         bal = UserBalances.ethereum_balance()
         bal = round(bal, 4)
         self._notify(
             f"Ethereum balance in ...{eth_address[-4:]} wallet: {bal} ETH")
         self._notify(
             f"Note: You may have other ERC 20 tokens in this same address (not shown here)."
         )