yf.download not loading today's data
import yfinance as yf df = yf.download("AAPL", period="1mo") df_close = df[["Adj Close", "Close"]] df_close
This has previously worked (up until last week) to pull in closing data for the past 1 month including the current intraday price. Now doesn't pull current price but is able to access other data. Does anyone know why this is happening?
Hello.
I could not repeat your mistake. Check which version do you have installed?
pip show yfinance
And what is your operating system?
(Traiding_py_3.9) (base) .../Trad_histori_test$ pip show yfinance
Name: yfinance
Version: 0.1.59
Summary: Yahoo! Finance market data downloader
Home-page: https://github.com/ranaroussi/yfinance
Author: Ran Aroussi
Author-email: [email protected]
License: Apache
Location: .../python3.9/site-packages
Requires: pandas, numpy, requests, multitasking, lxml
Required-by:
(Traiding_py_3.9) (base) .../PycharmProjects/Trad_histori_test$ python
Python 3.9.5 (default, May 5 2021, 02:20:16)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import yfinance as yf
>>> df = yf.download("AAPL", period="1mo")
[*********************100%***********************] 1 of 1 completed
>>> df_close = df[["Adj Close", "Close"]]
>>> df_close
Adj Close Close
Date
2021-04-19 134.611343 134.839996
2021-04-20 132.884293 133.110001
2021-04-21 133.273621 133.500000
2021-04-22 131.716278 131.940002
2021-04-23 134.092239 134.320007
2021-04-26 134.491562 134.720001
2021-04-27 134.162109 134.389999
2021-04-28 133.353485 133.580002
2021-04-29 133.253662 133.479996
2021-04-30 131.237091 131.460007
2021-05-03 132.315247 132.539993
2021-05-04 127.633202 127.849998
2021-05-05 127.882790 128.100006
2021-05-06 129.520004 129.740005
2021-05-07 130.210007 130.210007
2021-05-10 126.849998 126.849998
2021-05-11 125.910004 125.910004
2021-05-12 122.769997 122.769997
2021-05-13 124.970001 124.970001
2021-05-14 127.449997 127.449997
2021-05-17 125.254997 125.254997
Updated to latest version. Worked perfectly for a few days, but is again having problems pulling today's data. Seems to work sporadically for some tickers.
pip show yfinance Name: yfinance Version: 0.1.59 Summary: Yahoo! Finance market data downloader Home-page: https://github.com/ranaroussi/yfinance Author: Ran Aroussi Author-email: [email protected] License: Apache Location: c:\users\kosht\appdata\roaming\python\python37\site-packages Requires: pandas, requests, lxml, multitasking, numpy Required-by:
import yfinance as yf df = yf.download("AAPL", period="2y") print(df)
2021-03-24 122.820 122.900 120.070 120.090 119.886 88530500 2021-03-25 119.540 121.660 119.000 120.590 120.386 98844700 2021-03-26 120.350 121.480 118.920 121.210 121.004 94071200 2021-03-29 121.650 122.580 120.730 121.390 121.184 80819200 2021-03-30 120.110 120.400 118.860 119.900 119.697 85671900 2021-03-31 121.650 123.520 121.150 122.150 121.943 118323800 2021-04-01 123.660 124.180 122.490 123.000 122.791 75089100 2021-04-05 123.870 126.160 123.070 125.900 125.687 88651200 2021-04-06 126.500 127.130 125.650 126.210 125.996 80171300 2021-04-07 125.830 127.920 125.140 127.900 127.683 83466700 2021-04-08 128.950 130.390 128.520 130.360 130.139 88844600 2021-04-09 129.800 133.040 129.470 133.000 132.774 106686700 2021-04-12 132.520 132.850 130.630 131.240 131.017 91420000 2021-04-13 132.440 134.660 131.930 134.430 134.202 91266500 2021-04-14 134.940 135.000 131.660 132.030 131.806 87222800 2021-04-15 133.820 135.000 133.640 134.500 134.272 89347100 2021-04-16 134.300 134.670 133.280 134.160 133.933 84922400 2021-04-19 133.510 135.470 133.340 134.840 134.611 94264200 2021-04-20 135.020 135.530 131.810 133.110 132.884 94812300 2021-04-21 132.360 133.750 131.300 133.500 133.274 68847100 2021-04-22 133.040 134.150 131.410 131.940 131.716 84566500 2021-04-23 132.160 135.120 132.160 134.320 134.092 78657500 2021-04-26 134.830 135.060 133.560 134.720 134.492 66905100 2021-04-27 135.010 135.410 134.110 134.390 134.162 66015800 2021-04-28 134.310 135.020 133.080 133.580 133.353 107760100 2021-04-29 136.470 137.070 132.450 133.480 133.254 151101000 2021-04-30 131.780 133.560 131.070 131.460 131.237 109839500 2021-05-03 132.040 134.070 131.830 132.540 132.315 75135100 2021-05-04 131.190 131.490 126.700 127.850 127.633 137564700 2021-05-05 129.200 130.450 127.970 128.100 127.883 84000900 2021-05-06 127.890 129.750 127.130 129.740 129.520 78128300 2021-05-07 130.850 131.260 129.480 130.210 130.210 78973300 2021-05-10 129.410 129.540 126.810 126.850 126.850 88071200 2021-05-11 123.500 126.270 122.770 125.910 125.910 126142800 2021-05-12 123.400 124.640 122.250 122.770 122.770 112172300 2021-05-13 124.580 126.150 124.260 124.970 124.970 105861300 2021-05-14 126.250 127.890 125.850 127.450 127.450 81918000 2021-05-17 126.820 126.930 125.170 126.270 126.270 74244600 2021-05-18 126.560 126.990 124.780 124.850 124.850 63342900 2021-05-19 123.160 124.920 122.860 124.690 124.690 92612000 2021-05-20 125.230 127.720 125.100 127.310 127.310 76857100 2021-05-21 127.820 128.000 125.210 125.430 125.430 79209300
Is the market still closed? First data appears at 9:30 AM GMT-4 New York
No, market was open. I pulled data around 10:15 AM GMT-4.
Does this still happen with latest version?