yfinance: Inconsistant results - a problem with yfinance or yahoo?

I’m getting inconsistent results, for example the code:

import yfinance.yfinance as yf

print(yf.download('ISF.L ECAR.L', start='2021-03-01', end='2021-03-12', interval='1d', auto_adjust=True, group_by='ticker'))
print(yf.download('ECAR.L ISF.L', start='2021-03-01', end='2021-03-12', interval='1d', auto_adjust=True, group_by='ticker'))

Yields:

[*********************100%***********************]  2 of 2 completed
                 ISF.L                                              ECAR.L                              
                  Open        High         Low       Close   Volume   Open   High    Low   Close  Volume
Date                                                                                                    
2021-03-01  900.299988  910.788025  900.299988  906.549988  73976.0  6.262  6.442  6.262  6.4050    6953
2021-03-02  902.900024  915.094971  901.882996  913.000000  15094.0  6.469  6.469  6.401  6.4010   17332
2021-03-03  921.799988  925.900024  916.693970  921.500000  27767.0  6.362  6.469  6.362  6.3840    5011
2021-03-04  913.900024  922.000000  911.099976  920.400024  27720.0  6.350  6.350  6.141  6.1410    2045
2021-03-05  902.000000  910.599976  902.000000  905.000000  13989.0  6.236  6.390  6.220  6.3900    9125
2021-03-08         NaN         NaN         NaN         NaN      NaN  7.458  7.770  7.397  7.5885  340126
2021-03-09         NaN         NaN         NaN         NaN      NaN  7.483  7.693  7.483  7.6640  263112
2021-03-10         NaN         NaN         NaN         NaN      NaN  7.630  7.752  7.600  7.7010  233957
2021-03-11         NaN         NaN         NaN         NaN      NaN  7.808  7.898  7.769  7.8430  227326
[*********************100%***********************]  2 of 2 completed

When I check the yahoo website using https://uk.finance.yahoo.com/quote/ECAR.L/history?p=ECAR.L it returns:

                 ISF.L                                              ECAR.L                              
                  Open        High         Low       Close   Volume   Open   High    Low   Close  Volume
Date                                                                                                    
2021-03-01  900.299988  910.788025  900.299988  906.549988  73976.0  7.683  7.760  7.613  7.7300  229947
2021-03-02  902.900024  915.094971  901.882996  913.000000  15094.0  7.740  7.764  7.668  7.7160  157541
2021-03-03  921.799988  925.900024  916.693970  921.500000  27767.0  7.812  7.842  7.668  7.7800  335061
2021-03-04  913.900024  922.000000  911.099976  920.400024  27720.0  7.657  7.672  7.505  7.5760  210196
2021-03-05  902.000000  910.599976  902.000000  905.000000  13989.0  7.448  7.582  7.310  7.3270  202433
2021-03-08         NaN         NaN         NaN         NaN      NaN  7.458  7.770  7.397  7.5885  340126
2021-03-09         NaN         NaN         NaN         NaN      NaN  7.483  7.693  7.483  7.6640  263112
2021-03-10         NaN         NaN         NaN         NaN      NaN  7.630  7.752  7.600  7.7010  233957
2021-03-11         NaN         NaN         NaN         NaN      NaN  7.808  7.898  7.769  7.8430  227326

I’m running the latest code. It’s probably a Yahoo problem because it’s not consistent - often it works. I’ve no reason to believe the order of tickers makes a difference, this is just one example when it did fail. I’m trying to download 20 years of about 300 tickers and I’m always getting many instances of something like this.

I could scrape Yahoo directly as the data seems to be good on the web page, but maybe this is a known problem?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 20

Most upvoted comments

yfinance fetches from historical tab