minor corrections/optimizations

This commit is contained in:
Nicolás Sánchez 2025-08-19 15:49:01 -03:00
parent 0de0eb5c08
commit f5e5f4eb77
4 changed files with 16 additions and 14 deletions

View File

@ -44,7 +44,7 @@ class ConfigHandler:
self.config_dictionary["generated_at"] = int(time())
self.save_to_file()
if config_dict is not None:
self.config_dictionary = {**self.config_dictionary, **config_dict}
self.config_dictionary.update(config_dict)
self.save_to_file()

View File

@ -1058,7 +1058,7 @@ class Logger:
self.tg_credentials = credentials.get_credentials("telegram")
self.log_list_max_length = 10
self.log_list = collections.deque(maxlen=self.log_list_max_length)
self.log_list = self.preload_logs()
self.preload_logs()
def preload_logs(self):
@ -1066,12 +1066,10 @@ class Logger:
with open(f"logs/{self.exchange_name}.log","r") as f:
for line in f:
self.log_list.append(line.rstrip("\n"))
# self.log_list = f.readlines()
#return self.log_list[-self.log_list_max_length:]
return list(self.log_list)
return 0
except Exception as e:
print(e)
return []
return 1
def set_log_list_max_length(self, amount):
@ -1080,7 +1078,7 @@ class Logger:
def get_log_list(self):
return self.log_list
return list(self.log_list)
def set_telegram_notifications(self, toggle):

View File

@ -316,7 +316,10 @@ def main_routine():
futures.append(future)
online_pairs.append(f"{instance.base}{instance.quote}")
pairs_to_fetch.append(instance.config.get_pair())
#Delete no longer used data
del open_orders
#Fetch prices
price_list = broker.get_prices(pairs_to_fetch)
#Here, assign the prices to the dusters (if any)
@ -353,6 +356,8 @@ def main_routine():
global_status["paused_traders"].append(instance.config.get_pair())
paused_traders_status_strings.append(f"{cyan}Paused pairs: {list(global_status['paused_traders'])}{white}")
#Delete no longer used data
del price_list
#Append worker data to screen buffer, shorts first.
screen_buffer.extend(short_traders_status_strings + long_traders_status_strings)

View File

@ -24,7 +24,6 @@ class StatusHandler:
"base_bought": 0.0,
"so_amount": 0,
"no_of_safety_orders": "",
"take_profit_price": "",
"safety_price_table": [],
"deal_uptime": 0.0,
"total_uptime": 0.0,
@ -44,11 +43,11 @@ class StatusHandler:
"deal_order_history": []
}
self.status_file_path = f"status/{base}{quote}.status"
self.status_dictionary = self.default_status_dictionary.copy()
if status_dict is not None:
self.status_dictionary = {**self.status_dictionary, **status_dict}
self.save_to_file()
self.status_dictionary = {k: v for k, v in self.default_status_dictionary.items()}
if status_dict:
self.status_dictionary.update(status_dict)
self.save_to_file()
def get_pair(self):
return self.status_dictionary["pair"]