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

0.2.42 and onwards fails to pull most recent trading days data for ASX stocks #2121

Closed wally2511 closed 1 week ago

wally2511 commented 1 week ago

Describe bug

Pulling stock data using versions 0.2.42 and onwards fails to pull the last trading days data for ASX stocks. This could be related to timezones but the issue doesn't exist in 0.2.41.

Simple code that reproduces your problem

stock_data_daily = yf.download('CSL.AX', period='1y', interval='1d')

Debug log

DEBUG Entering download() DEBUG:yfinance:Entering download() DEBUG Disabling multithreading because DEBUG logging enabled DEBUG:yfinance: Disabling multithreading because DEBUG logging enabled DEBUG Entering history() DEBUG:yfinance: Entering history() DEBUG Entering history() DEBUG:yfinance: Entering history() DEBUG CSL.AX: Yahoo GET parameters: {'range': '1y', 'interval': '1d', 'includePrePost': False, 'events': 'div,splits,capitalGains'} DEBUG:yfinance: CSL.AX: 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/CSL.AX DEBUG:yfinance: url=https://query2.finance.yahoo.com/v8/finance/chart/CSL.AX 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 CSL.AX: yfinance received OHLC data: 2023-11-07 23:00:00 -> 2024-11-08 05:10:12 DEBUG:yfinance: CSL.AX: yfinance received OHLC data: 2023-11-07 23:00:00 -> 2024-11-08 05:10:12 DEBUG CSL.AX: OHLC after cleaning: 2023-11-08 10:00:00+11:00 -> 2024-11-08 16:10:12+11:00 DEBUG:yfinance: CSL.AX: OHLC after cleaning: 2023-11-08 10:00:00+11:00 -> 2024-11-08 16:10:12+11:00 DEBUG CSL.AX: OHLC after combining events: 2023-11-08 00:00:00+11:00 -> 2024-11-08 00:00:00+11:00 DEBUG:yfinance: CSL.AX: OHLC after combining events: 2023-11-08 00:00:00+11:00 -> 2024-11-08 00:00:00+11:00 DEBUG CSL.AX: yfinance returning OHLC: 2023-11-08 00:00:00+11:00 -> 2024-11-07 00:00:00+11:00 DEBUG:yfinance: CSL.AX: yfinance returning OHLC: 2023-11-08 00:00:00+11:00 -> 2024-11-07 00:00:00+11:00 DEBUG Exiting history() DEBUG:yfinance: Exiting history() DEBUG Exiting history() DEBUG:yfinance: Exiting history() DEBUG Exiting download() DEBUG:yfinance:Exiting download()

Bad data proof

No response

yfinance version

= 0.2.42

Python version

No response

Operating system

No response

ValueRaider commented 1 week ago

Thanks for report, that bug been present a long time. Only happens when Yahoo duplicates last 1d interval image