Enabling last_call disables autoswitch

This commit is contained in:
Nicolás Sánchez 2025-03-29 10:21:18 -03:00
parent a19cf0271c
commit d0a189b68a
2 changed files with 7 additions and 1 deletions

View File

@ -1,3 +1,6 @@
2025.03.29:
. Enabling last_call disables autoswitch.
2025.03.19: 2025.03.19:
. Added the possibility to force specific orders when importing a trader. . Added the possibility to force specific orders when importing a trader.

View File

@ -16,7 +16,7 @@ import exchange_wrapper
import trader import trader
version = "2025.03.19" version = "2025.03.29"
''' '''
Color definitions. If you want to change them, check the reference at https://en.wikipedia.org/wiki/ANSI_escape_code#Colors Color definitions. If you want to change them, check the reference at https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
@ -1678,6 +1678,8 @@ def unwrapped_last_call(base,quote):
x.status.set_stop_when_profit(not x.status.get_stop_when_profit()) x.status.set_stop_when_profit(not x.status.get_stop_when_profit())
x.update_status(True) x.update_status(True)
if x.status.get_stop_when_profit(): if x.status.get_stop_when_profit():
x.config.set_autoswitch(False)
x.update_status(True)
return jsonify({"Success": "Trader scheduled to go offline when profit is reached"}) return jsonify({"Success": "Trader scheduled to go offline when profit is reached"})
return jsonify({"Success": "Last call cancelled"}) return jsonify({"Success": "Last call cancelled"})
return jsonify({"Error": "Trader does not exist"}) return jsonify({"Error": "Trader does not exist"})
@ -1755,6 +1757,7 @@ def unwrapped_global_last_call():
#broker.clear_pairs() #broker.clear_pairs()
for x in running_instances: for x in running_instances:
x.status.set_stop_when_profit(True) x.status.set_stop_when_profit(True)
x.config.set_autoswitch(False)
broker.logger.log_this("Modified flag",2,f"{x.base}/{x.quote}") broker.logger.log_this("Modified flag",2,f"{x.base}/{x.quote}")
return jsonify({"Success": "All traders scheduled to go offline when profit is reached"}) return jsonify({"Success": "All traders scheduled to go offline when profit is reached"})
return jsonify({"Error": "No traders running"}) return jsonify({"Error": "No traders running"})