I'm interested in only placing orders based on alpha creation more than some timedelta before market close. How do I access the current days market hours? For example, some days close early at 1PM. If this wasn't the case I could do something simple like:

if datetime.time(9,30) <= algorithm.Time.time() <= datetime.time(16,0) - timedelta(n):

This will not work for early closes.

Author