I am looking for a better way to handle buy and sell orders on Day Open/Close
So far I use an if statements:
if( data[cur_sid].datetime.hour==13 and data[cur_sid].datetime.minute==31):
if( data[cur_sid].datetime.hour==19 and data[cur_sid].datetime.minute==58):
But this does not work properly in a backtest or LiveTrading due to daylight savings., Any ideas?
Daylight Savings Time bugfix: Right now when you trade, the first
minute bar is marked 14:31 UTC, every day. Unfortunately, that's not
correct - during daylight savings time, the first bar should be 13:31
UTC. That bug will be corrected. The behavior of "sell at close" and
similar strategies will need to be updated after we fix the bug. This
fix will impact some of the end-of-day returns and risk metric
calculations; sometimes the day was "ending" prematurely because of
DST.