ranaroussi / yfinance

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

Inaccurate price data, NSE #2055

Closed Aryan1508 closed 1 week ago

Aryan1508 commented 1 week ago

Describe bug

High for TATASTEEL.NS on 29th Dec, 2023 incorrect, the high is 141.25

Simple code that reproduces your problem

import yfinance as yf 

print(yf.__version__)
yf.enable_debug_mode()

s = yf.Ticker("TATASTEEL.NS")
print(s.history(start="2023-12-29", end="2023-12-30"))

Debug log

0.2.41
DEBUG    Entering history()
DEBUG     Entering history()
DEBUG      TATASTEEL.NS: Yahoo GET parameters: {'period1': '2023-12-29 00:00:00+05:30', 'period2': '2023-12-30 00:00:00+05:30', 'interval': '1d', 'includePrePost': False, 'events': 'div,splits,capitalGains'}
DEBUG      Entering get()
DEBUG       url=https://query2.finance.yahoo.com/v8/finance/chart/TATASTEEL.NS
DEBUG       params=frozendict.frozendict({'period1': 1703788200, 'period2': 1703874600, 'interval': '1d', 'includePrePost': False, 'events': 'div,splits,capitalGains'})
DEBUG       Entering _get_cookie_and_crumb()
DEBUG        cookie_mode = 'basic'
DEBUG        Entering _get_cookie_and_crumb_basic()
DEBUG         loaded persistent cookie
DEBUG         reusing cookie
DEBUG         crumb = 'qoaOsjBIkyO'
DEBUG        Exiting _get_cookie_and_crumb_basic()
DEBUG       Exiting _get_cookie_and_crumb()
DEBUG       response code=200
DEBUG      Exiting get()
DEBUG      TATASTEEL.NS: yfinance received OHLC data: 2023-12-29 03:45:00 -> 2023-12-29 03:45:00
DEBUG      TATASTEEL.NS: OHLC after cleaning: 2023-12-29 09:15:00+05:30 -> 2023-12-29 09:15:00+05:30
DEBUG      TATASTEEL.NS: OHLC after combining events: 2023-12-29 00:00:00+05:30 -> 2023-12-29 00:00:00+05:30
DEBUG      TATASTEEL.NS: yfinance returning OHLC: 2023-12-29 00:00:00+05:30 -> 2023-12-29 00:00:00+05:30
DEBUG     Exiting history()
DEBUG    Exiting history()
                                 Open        High         Low       Close    Volume  Dividends  Stock Splits
Date
2023-12-29 00:00:00+05:30  135.862676  138.460333  134.441301  136.842926  49202910        0.0           0.0

Bad data proof

image

High = 141.25

yfinance version

0.2.41

Python version

3.11.1

Operating system

Windows 10

ValueRaider commented 1 week ago

Dividend adjusted