Hi,

In the Algorithm Framework, I usually get the Market Open and Close Times by doing this right at the market open:

self.todayOpen = {} # store open times self.todayClose = {} # store close times for security in algorithm.ActiveSecurities.Values: # get Open and Close Hours for today hours = algorithm.ActiveSecurities[security.Symbol].Exchange.Hours if hours.IsDateOpen(algorithm.Time): self.todayOpen[security.Symbol] = hours.GetNextMarketOpen(algorithm.Time - timedelta(hours=2), False) self.todayClose[security.Symbol] = hours.GetNextMarketClose(algorithm.Time - timedelta(hours=2), False)

Basically, every trading day, I use the function GetNextMarketOpen and I pass the current time minus 2 hours to get the current day market open....it works but it's ugly! Is there any elegant way of getting the current trading day market open and close time?

I need this time for the duration of my insights as I like to add/deduct time from the open/close for the duration of the signals.

Thanks!

Emilio