I am trying to use the schedule_function function, but the reported time of the function execution seems wrong to me. Here's my example:
def initialize(context):
context.issues = [ symbol('AAPL') ]
schedule_function(
func=testFunc,
date_rule=date_rules.every_day(),
time_rule=time_rules.market_open(),
half_days=False
)
return
def testFunc( context, data ):
log.debug( get_datetime('US/Eastern') )
def handle_data(context, data):
log.debug('handle_data')
When I build this algo, the first few lines of log output look like this:
2011-01-04handle_data:22DEBUGhandle_data
2011-01-04testFunc:18DEBUG2011-01-03 19:00:00-05:00
2011-01-05handle_data:22DEBUGhandle_data
2011-01-05testFunc:18DEBUG2011-01-04 19:00:00-05:00
2011-01-06handle_data:22DEBUGhandle_data
2011-01-06testFunc:18DEBUG2011-01-05 19:00:00-05:00
2011-01-07handle_data:22DEBUGhandle_data
2011-01-07testFunc:18DEBUG2011-01-06 19:00:00-05:00
2011-01-10handle_data:22DEBUGhandle_data
2011-01-10testFunc:18DEBUG2011-01-09 19:00:00-05:00
2011-01-11handle_data:22DEBUGhandle_data
2011-01-11testFunc:18DEBUG2011-01-10 19:00:00-05:00
2011-01-12handle_data:22DEBUGhandle_data
2011-01-12testFunc:18DEBUG2011-01-11 19:00:00-05:00
2011-01-13handle_data:22DEBUGhandle_data
2011-01-13testFunc:18DEBUG2011-01-12 19:00:00-05:00
2011-01-14handle_data:22DEBUGhandle_data
2011-01-14testFunc:18DEBUG2011-01-13 19:00:00-05:00
2011-01-18handle_data:22DEBUGhandle_data
2011-01-18testFunc:18DEBUG2011-01-17 19:00:00-05:00
2011-01-19handle_data:22DEBUGhandle_data
Obviously I'm missing something basic here because according to get_datetime, the scheduled function is firing at 7pm EST, rather than at market open (about 9:30am EST). Any point in the right direction would be greatly appreciated.