Hi William,
Schedule_function is powerful. In your initialize function, write something like the following:
schedule_function(handle_data_daily, date_rules.every_day(), time_rules.market_open(minutes=1))
You would then create a function called "handle_data_daily" with whatever code you want to run at 9:31:00 AM EST every day (because the schedule_function above is telling your program to run "handle_data_daily" at market_open + 1). You MUST keep "handle_data" separate as your default function for minutely action (you cannot use schedule_function on handle_data, as far as I know)
Here's an example to get you started:
def initialize(context):
schedule_function(handle_data_daily, date_rules.every_day(), time_rules.market_open(minutes=1))
def handle_data_daily(context, data):
global my_open
open_price = history(bar_count=10, frequency='1d', field='open_price')
for stock in data:
my_open = open_price[stock][-1] #[-1] pulls latest open value
def handle_data(context, data):
global my_open
#do something with "my_open"
Global declarations aren't exactly Pythonic but they allow you to use the same variable in multiple functions. I've yet to find a better way to do this but there might be.
Hope that helps!