service.clear_time_triggers()
Remove all time triggers from the list of triggers.
Interface: clear_time_triggers()
Sample - Calling Method
service.clear_time_triggers()
None
Returns:None
Remarks:- Clear all time triggers for the instance.
- Doesn't clear time triggers for other instances.
Clear Time Triggers
from cloudquant.interfaces import Strategy
class ClearTimeTriggersExample(Strategy):
@classmethod
def is_symbol_qualified(cls, symbol, md, service, account):
return symbol == "AAL"
def on_start(self, md, order, service, account):
# print start time
print(self.symbol + "\n" + service.time_to_string(service.system_time) + "\n\n")
# add time trigger for 11:20
service.add_time_trigger(service.time(11,20))
# add time trigger for 15:55
service.add_time_trigger(service.time(15, 55))
#only one timer should trigger
def on_timer(self, event, md, order, service, account):
print(service.time_to_string(service.system_time) + " - Timer triggered")
# clear all time triggers for instance
service.clear_time_triggers()
Console
AAL 2016-08-09 09:24:32.989000 Timer triggered