minor refactor caching status_string
This commit is contained in:
parent
00c6157d2e
commit
8ef31c4bab
|
|
@ -31,7 +31,6 @@ class trader:
|
||||||
self.last_time_seen = time.time()
|
self.last_time_seen = time.time()
|
||||||
|
|
||||||
#Status string caches
|
#Status string caches
|
||||||
self.status_string_cache = ""
|
|
||||||
self.low_price_cache = None
|
self.low_price_cache = None
|
||||||
self.mid_price_cache = None
|
self.mid_price_cache = None
|
||||||
self.high_price_cache = None
|
self.high_price_cache = None
|
||||||
|
|
@ -1481,11 +1480,10 @@ class trader:
|
||||||
high_price = self.status.get_take_profit_price() if self.status.get_take_profit_price() is not None else 0
|
high_price = self.status.get_take_profit_price() if self.status.get_take_profit_price() is not None else 0
|
||||||
|
|
||||||
if low_price==self.low_price_cache and mid_price==self.mid_price_cache and high_price==self.high_price_cache:
|
if low_price==self.low_price_cache and mid_price==self.mid_price_cache and high_price==self.high_price_cache:
|
||||||
#status_string = self.status_string_cache
|
#Only modifies the uptime
|
||||||
#Edit uptime
|
position = self.status.get_status_string().find("Uptime")
|
||||||
position = self.status_string_cache.find("Uptime")
|
|
||||||
new_uptime = self.seconds_to_time(self.status.get_deal_uptime())
|
new_uptime = self.seconds_to_time(self.status.get_deal_uptime())
|
||||||
status_string = self.status_string_cache[:position+8] + new_uptime + self.status_string_cache[position+8+len(new_uptime):]
|
status_string = self.status.get_status_string()[:position+8] + new_uptime + self.status.get_status_string()[position+8+len(new_uptime):]
|
||||||
else:
|
else:
|
||||||
#Update caches
|
#Update caches
|
||||||
self.low_price_cache = low_price
|
self.low_price_cache = low_price
|
||||||
|
|
@ -1570,7 +1568,6 @@ class trader:
|
||||||
line1 = f"{line1} | LAST DEAL"
|
line1 = f"{line1} | LAST DEAL"
|
||||||
|
|
||||||
status_string = f"{self.get_color('white')}{line1}\n{line3}{self.get_color('white')}"
|
status_string = f"{self.get_color('white')}{line1}\n{line3}{self.get_color('white')}"
|
||||||
self.status_string_cache = status_string
|
|
||||||
|
|
||||||
return status_string
|
return status_string
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue