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

hi guys,

I'm trying to calculate a stock performance manually from last month close to "current" month close price

However and using using data.history(stock,'close',2, '1d')
Prices are inconsistent when calling at month_end op[-1] ---> OK
cos it should equal the close price run at month_start sp[-2] (effectively last month close) ---> not OK

Hope my explanation of the problem make sense
Ive attached logs and code
Please let me know if there is any explanation for this

Thanks in advance
Ben

Logs
2017-01-04 04:59 PRINT 115.84
2017-02-01 04:59 PRINT 121.249 ----> op[-1] correct close
2017-02-02 04:59 PRINT 121.3 ---> sp[-2] wrong close
2017-03-01 04:59 PRINT 136.945
2017-03-02 04:59 PRINT 136.99
2017-04-01 03:59 PRINT 143.805
2017-04-04 03:59 PRINT 143.67
2017-04-29 03:59 PRINT 143.72
2017-05-02 03:59 PRINT 143.64
2017-06-01 03:59 PRINT 152.8
2017-06-02 03:59 PRINT 152.76
2017-07-01 03:59 PRINT 144.28
2017-07-04 00:59 PRINT 144.03