Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Help: Runtime Error

I'm a newbie, so forgive my ignorance.
I'm trying to design an algo that buys aapl when the price breaks the high of the first 10 minute candle. I'm getting a runtime error? What am I doing wrong?

def initialize(context):  
    context.aapl = sid(24)

    schedule_function(rebalance, date_rules.every_day(), time_rules.market_open(minutes = 10))

def rebalance(context, data):  
    #get this high of the first 10 minute candle  
    get_high = data.history(context.aapl, 'high', 10, '1m')  
    log.info(get_high)

    price=data.current(context.aapl, 'price')  
#order when price breaks 5 minute high    

    if price > get_high:  
        order_target_percent(context.aapl, 1.0)  
2 responses

andre,

Try this:

    get_high = data.history(context.aapl, 'high', 10, '1m').iloc[0:-1].max()  

In most states in the US you're not allowed to get high, maybe that's why...