Back to Community
Can you change "Before_trading_starts" schedule

Hello everyone,

Would anyone know if it is possible to schedule this function to run on a weekly or monthly basis rather then being called daily.

IE. schedule_function(Before_trading_starts, date_rules.week_start(days_offset=1)

I may be wrong on my assumption but I believe this function allows for a runtime of more then 50 seconds. I have a code that has an extensive procedure that I do not want to call every since I am rebalancing on a weekly basis and only need it called on those days.


2 responses

I would just put an eval in there that checks which day it is... if get_datetime().weekday()==1:

Hi peter. That's solution will actually work. I thought of this at first but I think I over complicated it. My concerns was in the event of a holiday occurring on a Monday. I thought the code would have been thrown off having run on a Monday and then the week start function executing on the first trading day after the holiday. But the data is still the same if it run on the holiday or the Tuesday after. Thanks!