Course Name: Python for Trading: Basic, Section No: 5, Unit No: 7, Unit type: Notebook
Both the Yahoo Finance and Data Reader modules give historical data over a timeframe. Why then is there a difference in the values it return? Is one correct an the other wrong or is the difference too small to matter?
Hi Joseph,
It's great to see that you've started learning about Python for trading.
Answering your question, you can use either of the two - pandas_datareader or yfinance module to fetch the historical data.
However, the yfinance approach seems to be a bit more reliable, as compared to pandas_datareader, since the latter is known to have frequent downtimes.
But in terms of the data returned, you won't find any discrepancies for the most part.
As an example, the image below shows the results obtained using the two methods.

Here, note that the order of the columns in the two data frames is different.
However, the individual values remain the same, as indicated by the blue and green highlighting.
In regards to adjusted close prices, it does seem that there is a difference (as indicated in orange in the image above). Nevertheless, the difference is very negligible and can be ignored, as the values seem to be accurate up to four decimal places.
Hope you found this helpful. Kind regards!