Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Schedule function help

Hi everyone this might be a really basic question but i'm trying to run my function once a day using the code below and it seems that my function is called every minutes...

def initialize(context):
context.sym = symbol('SPY')
schedule_function(
handle_data,
date_rules.every_day(),
time_rules.market_open(minutes=15)
)

def handle_data(context, data):
print("I'm here")

2 responses

That should work. However, change the name of your function to something other than 'handle_data' (maybe 'my_function'). The 'handle_data' method is built in and automatically called once a minute (no need to schedule it). The name is sort of a 'reserved' name and shouldn't be used for user defined functions/methods.

Thank you it works now!!