Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Data/Pricing error in contest submission

From Thursday night (20150702):

For one of my hedged algorithms, I performed a simple backtest. Then I moved on to the full backtest. Both tests performed correctly.

Finally, a contest submission was performed. It soon registered as "Disqualified" along with an email message stating:

**The error occurred on line(s) 75 with the high-level message, AttributeError: 'SIDData' object has no attribute 'price'.**

The code spins through a small set of stocks:

    context.stocks = symbols('CMG','DIS','DPZ','NFLX')  

This is the portion of the code that apparently is failing:

def daily_rebal(context, data):  
    for security in context.stocks:  
        price = data[security].price  

How would the algorithm run though the previous 2 test stages, then fail in the contest? Is there some type of data issue preventing line 75 of the code to be evaluated properly?

   price = data[security].price 

Also, if you drop some debugging messages in, you can see the log output on line 76:

2011-01-04daily_rebal:82INFOprice=38.99

Further down in function:

2011-01-04daily_rebal:94DEBUGEquity(2190
[DIS])[price=38.99|vwap5=38.3768253536|spyvwap5=126.487297602|spy_vwap14=125.470225808|spyvwap30=122.900273055]

1 response

I updated as follows and resubmitted. I'll check back on Monday...

def daily_rebal(context, data):  
    for security in context.stocks:  
        if 'price' in data[security]:  
            price = data[security].price  
        else:  
            log.warn("No price for {s}".format(s=security))  
            continue  
...