ranaroussi / yfinance

Download market data from Yahoo! Finance's API
https://aroussi.com/post/python-yahoo-finance
Apache License 2.0
14.89k stars 2.44k forks source link

No Update for stock price #2043

Closed thscowns closed 2 months ago

thscowns commented 2 months ago

Describe bug

When I call yf.Ticker("AAPL").history(period='1y') for U.S. stocks, the returned data only goes up to 2024-08-30, despite today's date being 2024-09-03. This issue seems to be specific to U.S. stocks, as I am able to retrieve up-to-date data for stocks from other markets, such as South Korea and China, using the same method.

Simple code that reproduces your problem

import yfinance as yf

ticker = yf.Ticker("AAPL")
data = ticker.history(period='1y')

Debug log

DEBUG    Entering history()
DEBUG:yfinance:Entering history()
DEBUG     Entering history()
DEBUG:yfinance: Entering history()
DEBUG      AAPL: Yahoo GET parameters: {'range': '1y', 'interval': '1d', 'includePrePost': False, 'events': 'div,splits,capitalGains'}
DEBUG:yfinance:  AAPL: Yahoo GET parameters: {'range': '1y', 'interval': '1d', 'includePrePost': False, 'events': 'div,splits,capitalGains'}
DEBUG      Entering get()
DEBUG:yfinance:  Entering get()
DEBUG       url=https://query2.finance.yahoo.com/v8/finance/chart/AAPL
DEBUG:yfinance:   url=https://query2.finance.yahoo.com/v8/finance/chart/AAPL
DEBUG       params={'range': '1y', 'interval': '1d', 'includePrePost': False, 'events': 'div,splits,capitalGains'}
DEBUG:yfinance:   params={'range': '1y', 'interval': '1d', 'includePrePost': False, 'events': 'div,splits,capitalGains'}
DEBUG       Entering _get_cookie_and_crumb()
DEBUG:yfinance:   Entering _get_cookie_and_crumb()
DEBUG        cookie_mode = 'basic'
DEBUG:yfinance:    cookie_mode = 'basic'
DEBUG        Entering _get_cookie_and_crumb_basic()
DEBUG:yfinance:    Entering _get_cookie_and_crumb_basic()
DEBUG         reusing cookie
DEBUG:yfinance:     reusing cookie
DEBUG         reusing crumb
DEBUG:yfinance:     reusing crumb
DEBUG        Exiting _get_cookie_and_crumb_basic()
DEBUG:yfinance:    Exiting _get_cookie_and_crumb_basic()
DEBUG       Exiting _get_cookie_and_crumb()
DEBUG:yfinance:   Exiting _get_cookie_and_crumb()
DEBUG       response code=200
DEBUG:yfinance:   response code=200
DEBUG      Exiting get()
DEBUG:yfinance:  Exiting get()
DEBUG      AAPL: yfinance received OHLC data: 2023-08-31 13:30:00 -> 2024-08-30 13:30:00
DEBUG:yfinance:  AAPL: yfinance received OHLC data: 2023-08-31 13:30:00 -> 2024-08-30 13:30:00
DEBUG      AAPL: OHLC after cleaning: 2023-08-31 09:30:00-04:00 -> 2024-08-30 09:30:00-04:00
DEBUG:yfinance:  AAPL: OHLC after cleaning: 2023-08-31 09:30:00-04:00 -> 2024-08-30 09:30:00-04:00
DEBUG      AAPL: OHLC after combining events: 2023-08-31 00:00:00-04:00 -> 2024-08-30 00:00:00-04:00
DEBUG:yfinance:  AAPL: OHLC after combining events: 2023-08-31 00:00:00-04:00 -> 2024-08-30 00:00:00-04:00
DEBUG      AAPL: yfinance returning OHLC: 2023-08-31 00:00:00-04:00 -> 2024-08-30 00:00:00-04:00
DEBUG:yfinance:  AAPL: yfinance returning OHLC: 2023-08-31 00:00:00-04:00 -> 2024-08-30 00:00:00-04:00
DEBUG     Exiting history()
DEBUG:yfinance: Exiting history()
DEBUG    Exiting history()
DEBUG:yfinance:Exiting history()

Bad data proof

No response

yfinance version

0.2.43

Python version

3.10.12

Operating system

No response