Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Writing algos for time frames other than 1m and 1d

I'd like to write an algo using hourly bars in the SPY or E-mini S&P futures (once available).

I see from the tutorials that it looks like only 1m and 1d bars are available, is that correct?

Thanks!

4 responses

Thank you so much, this is exactly what I need

So now that I can make the hourly bars how can I get the algo to run once per hour? It says in the documentation that the schedule function runs either daily, weekly or monthly. Can I call the function from handle data method or some other way?

def initialize(context):  
    for i in range(1, 390):  
        n = 60  
        # Every n minutes run schedule  
        if i % n == 0:  
        # This will start at 9:31AM and will run every n minutes  
            schedule_function(trade, date_rules.every_day(), time_rules.market_open(minutes=i))

Awesome thanks