liquidate_after_switch in status
This commit is contained in:
parent
c65848658e
commit
68ac600361
|
|
@ -37,6 +37,7 @@ class StatusHandler:
|
||||||
"deal_start_time": 0,
|
"deal_start_time": 0,
|
||||||
"stop_when_profit": False,
|
"stop_when_profit": False,
|
||||||
"autoswitch": False,
|
"autoswitch": False,
|
||||||
|
"liquidate_after_switch": False,
|
||||||
"old_long": {},
|
"old_long": {},
|
||||||
"pause_reason": "",
|
"pause_reason": "",
|
||||||
"status_string": "",
|
"status_string": "",
|
||||||
|
|
@ -130,6 +131,9 @@ class StatusHandler:
|
||||||
def get_autoswitch(self):
|
def get_autoswitch(self):
|
||||||
return self.status_dictionary["autoswitch"]
|
return self.status_dictionary["autoswitch"]
|
||||||
|
|
||||||
|
def get_liquidate_after_switch(self):
|
||||||
|
return self.status_dictionary["liquidate_after_switch"]
|
||||||
|
|
||||||
def get_old_long(self):
|
def get_old_long(self):
|
||||||
return self.status_dictionary["old_long"]
|
return self.status_dictionary["old_long"]
|
||||||
|
|
||||||
|
|
@ -343,6 +347,13 @@ class StatusHandler:
|
||||||
self.status_dictionary["autoswitch"] = switch
|
self.status_dictionary["autoswitch"] = switch
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
def set_liquidate_after_switch(self, switch: bool):
|
||||||
|
# if not isinstance(switch, bool):
|
||||||
|
# self.broker.logger.log_this(f"value provided is not a boolean",1,self.get_pair())
|
||||||
|
# return 1
|
||||||
|
self.status_dictionary["liquidate_after_switch"] = switch
|
||||||
|
return 0
|
||||||
|
|
||||||
def set_old_long(self, old_long: dict):
|
def set_old_long(self, old_long: dict):
|
||||||
# if not isinstance(old_long, dict):
|
# if not isinstance(old_long, dict):
|
||||||
# self.broker.logger.log_this(f"value provided is not a dictionary",1,self.get_pair())
|
# self.broker.logger.log_this(f"value provided is not a dictionary",1,self.get_pair())
|
||||||
|
|
|
||||||
|
|
@ -298,6 +298,7 @@ class trader:
|
||||||
self.status.set_tp_mode(self.config.get_tp_mode())
|
self.status.set_tp_mode(self.config.get_tp_mode())
|
||||||
self.status.set_profit_table(self.config.get_tp_table())
|
self.status.set_profit_table(self.config.get_tp_table())
|
||||||
self.status.set_autoswitch(self.config.get_autoswitch())
|
self.status.set_autoswitch(self.config.get_autoswitch())
|
||||||
|
self.status.set_liquidate_after_switch(self.config.get_liquidate_after_switch())
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.broker.logger.log_this(f"Can't update status dictionary. Exception: {e}",1,self.config.get_pair())
|
self.broker.logger.log_this(f"Can't update status dictionary. Exception: {e}",1,self.config.get_pair())
|
||||||
return 1
|
return 1
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue