error handling

This commit is contained in:
Nicolás Sánchez 2025-02-21 10:23:37 -03:00
parent 574d8f82ef
commit ad1adeff0a
2 changed files with 11 additions and 4 deletions

View File

@ -114,12 +114,19 @@ class earner:
return self.status_string return self.status_string
def get_trading_balance(self): def get_trading_balance(self):
return float(self.trading_balance) try:
return float(self.trading_balance)
except Exception as e:
self.write_to_log(f"{e}")
return 0.0
def get_earning_balance(self): def get_earning_balance(self):
return float(self.earning_balance) try:
return float(self.earning_balance)
except Exception as e:
self.write_to_log(f"{e}")
return 0.0
def subscribe(self,amount,force_pause=False): def subscribe(self,amount,force_pause=False):
print(f"{datetime.datetime.now().strftime('[%Y/%m/%d %H:%M:%S]')} | {str(self.connector).upper()} | {colors.green}Subscribing{colors.white} {amount} {self.currency}") print(f"{datetime.datetime.now().strftime('[%Y/%m/%d %H:%M:%S]')} | {str(self.connector).upper()} | {colors.green}Subscribing{colors.white} {amount} {self.currency}")
self.write_to_log(f"{colors.green}Subscribing{colors.white} {amount} {self.currency}") self.write_to_log(f"{colors.green}Subscribing{colors.white} {amount} {self.currency}")

View File

@ -480,7 +480,7 @@ def run_API(port):
if __name__=="__main__": if __name__=="__main__":
version = "2025.01.29" version = "2025.02.21"
start_time = time.time() start_time = time.time()
with open("config.json") as f: with open("config.json") as f: