minor corrections/optimizations
This commit is contained in:
parent
0de0eb5c08
commit
f5e5f4eb77
|
|
@ -44,7 +44,7 @@ class ConfigHandler:
|
||||||
self.config_dictionary["generated_at"] = int(time())
|
self.config_dictionary["generated_at"] = int(time())
|
||||||
self.save_to_file()
|
self.save_to_file()
|
||||||
if config_dict is not None:
|
if config_dict is not None:
|
||||||
self.config_dictionary = {**self.config_dictionary, **config_dict}
|
self.config_dictionary.update(config_dict)
|
||||||
self.save_to_file()
|
self.save_to_file()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1058,7 +1058,7 @@ class Logger:
|
||||||
self.tg_credentials = credentials.get_credentials("telegram")
|
self.tg_credentials = credentials.get_credentials("telegram")
|
||||||
self.log_list_max_length = 10
|
self.log_list_max_length = 10
|
||||||
self.log_list = collections.deque(maxlen=self.log_list_max_length)
|
self.log_list = collections.deque(maxlen=self.log_list_max_length)
|
||||||
self.log_list = self.preload_logs()
|
self.preload_logs()
|
||||||
|
|
||||||
|
|
||||||
def preload_logs(self):
|
def preload_logs(self):
|
||||||
|
|
@ -1066,12 +1066,10 @@ class Logger:
|
||||||
with open(f"logs/{self.exchange_name}.log","r") as f:
|
with open(f"logs/{self.exchange_name}.log","r") as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
self.log_list.append(line.rstrip("\n"))
|
self.log_list.append(line.rstrip("\n"))
|
||||||
# self.log_list = f.readlines()
|
return 0
|
||||||
#return self.log_list[-self.log_list_max_length:]
|
|
||||||
return list(self.log_list)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
return []
|
return 1
|
||||||
|
|
||||||
|
|
||||||
def set_log_list_max_length(self, amount):
|
def set_log_list_max_length(self, amount):
|
||||||
|
|
@ -1080,7 +1078,7 @@ class Logger:
|
||||||
|
|
||||||
|
|
||||||
def get_log_list(self):
|
def get_log_list(self):
|
||||||
return self.log_list
|
return list(self.log_list)
|
||||||
|
|
||||||
|
|
||||||
def set_telegram_notifications(self, toggle):
|
def set_telegram_notifications(self, toggle):
|
||||||
|
|
|
||||||
5
main.py
5
main.py
|
|
@ -317,6 +317,9 @@ def main_routine():
|
||||||
online_pairs.append(f"{instance.base}{instance.quote}")
|
online_pairs.append(f"{instance.base}{instance.quote}")
|
||||||
pairs_to_fetch.append(instance.config.get_pair())
|
pairs_to_fetch.append(instance.config.get_pair())
|
||||||
|
|
||||||
|
#Delete no longer used data
|
||||||
|
del open_orders
|
||||||
|
|
||||||
#Fetch prices
|
#Fetch prices
|
||||||
price_list = broker.get_prices(pairs_to_fetch)
|
price_list = broker.get_prices(pairs_to_fetch)
|
||||||
#Here, assign the prices to the dusters (if any)
|
#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())
|
global_status["paused_traders"].append(instance.config.get_pair())
|
||||||
paused_traders_status_strings.append(f"{cyan}Paused pairs: {list(global_status['paused_traders'])}{white}")
|
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.
|
#Append worker data to screen buffer, shorts first.
|
||||||
screen_buffer.extend(short_traders_status_strings + long_traders_status_strings)
|
screen_buffer.extend(short_traders_status_strings + long_traders_status_strings)
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ class StatusHandler:
|
||||||
"base_bought": 0.0,
|
"base_bought": 0.0,
|
||||||
"so_amount": 0,
|
"so_amount": 0,
|
||||||
"no_of_safety_orders": "",
|
"no_of_safety_orders": "",
|
||||||
"take_profit_price": "",
|
|
||||||
"safety_price_table": [],
|
"safety_price_table": [],
|
||||||
"deal_uptime": 0.0,
|
"deal_uptime": 0.0,
|
||||||
"total_uptime": 0.0,
|
"total_uptime": 0.0,
|
||||||
|
|
@ -44,10 +43,10 @@ class StatusHandler:
|
||||||
"deal_order_history": []
|
"deal_order_history": []
|
||||||
}
|
}
|
||||||
self.status_file_path = f"status/{base}{quote}.status"
|
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 = {k: v for k, v in self.default_status_dictionary.items()}
|
||||||
self.status_dictionary = {**self.status_dictionary, **status_dict}
|
if status_dict:
|
||||||
|
self.status_dictionary.update(status_dict)
|
||||||
self.save_to_file()
|
self.save_to_file()
|
||||||
|
|
||||||
def get_pair(self):
|
def get_pair(self):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue