Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
history data and backtest daily

I am a new comer. I am wondering how I can use history data but do backtest daily. thanks.

1 response

Hello Minyong,

One approach is to pick a fixed time every day to execute your code. For example, here's a snippet:

from pytz import timezone

def handle_data(context, data):

    loc_dt = get_datetime().astimezone(timezone('US/Eastern'))  
    if loc_dt.hour == 10 and loc_dt.minute == 0:  
        pass  
    else:  
        return  

Grant