Back to Community
High Low Daily data wrong ?!

I understand that the close price of the stocks is not the official close of the market and it is fine but I see errors even in the high low of the day !
IBM on 2016-01-07(verified with print and debug)
So the close should be (one of )the highest point of the day which is completely wrong as you can see in any intraday chart.
(IBM was going down that day) How is it possible ??????
Data from Yahoo is consistent with the intraday chart: High=135.0200 Low=132.4300 Close=132.8600

To retrieve the data I simply wrote:
closes = data.history(context.security_list, 'close', 2, '1d')
highs = data.history(context.security_list, 'high', 2, '1d')
lows = data.history(context.security_list, 'low', 2, '1d')
then got the right symbol...

4 responses

no comments ? is it possible that years after launch Q has such errors ?!

Using, I get daily OHLC values of:

01/07/2016 133.7 135.02 132.43 132.86

And from the attached backtest, I obtain:

01/07/2016 133.7 135.02 132.43 132.769

So, aside from the close, the values are dead on.

Clone Algorithm
Total Returns
Max Drawdown
Benchmark Returns
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
def initialize(context): = sid(3766)
def before_trading_start(context, data):
    open = data.history(, 'open', 1, '1d')
    high = data.history(, 'high', 1, '1d')
    low = data.history(, 'low', 1, '1d')
    close = data.history(, 'close', 1, '1d')
    print 'open'
    print open
    print 'high'
    print high
    print 'low'
    print low
    print 'close'
    print close
def handle_data(context,data):
There was a runtime error.

Thank you Grant you're very helpful.
Upon further investigations the problem lies in the fact that I am retrieving the data in a function scheduled at the first minute of the day.
It's not a shift of the data by one day it's really a wrong value !
It's odd it doesn't return an error instead of wrong data...
Sorry I had to include the code. Thank you again...

See the help on the '1d' data returned by history. You were probably getting exactly what is specified in the help.