Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Get Wrong price of ITUB on 2017-08-14

Just simply run following code to print price(date range 08/11/2017-08/16/2017):

context.security =symbol('ITUB')
price_history = data.history(
context.security,
fields=["high","low","close","volume","open"],
bar_count=10,
frequency='1d'
)

print price_history  

======================= close high low open volume
2017-08-14 00:00:00+00:00 12.341 12.500 12.203 12.222 7137462.0
2017-08-15 00:00:00+00:00 12.470 12.560 12.390 12.440 7846924.0

Question:
The close price of ITUB on 2017-08-14 is 12.341 But in TC2000 and other website,the correct close price is 12.45.
Actually this just one case,I find many places that the prices is quite different with TC2000.
Is there any way I can get the correct price?

2 responses

I saw data.history return adjusted value,maybe that's the reason the price is different with tc2000(use none adjusted value).But seems I still can't get the close price 12.341 of ITUB on 2017-08-14 by switching price to forward adjusted or backward adjusted or none adjusted. Weired.

There was a cash dividend of $0.109 on 2017-8-15 (https://www.nasdaq.com/symbol/itub/dividend-history). The 'data.history' method returns prices which are adjusted as of the simulation date. So, when this is run on or after 2017-8-15 that dividend will be subtracted from the actual price on 2017-8-14 to 'adjust' for the dividend. Therefore, the actual 2017-8-14 close price will show up as 12.45 on 2017-8-14. But then after that will be 12.45 - .109 = 12.341. That is the number you are seeing.