Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to fetch stock history for 'BIRLAPREC.BO' for a day starting from January 31, 2024 #2185

Open
tapadeep opened this issue Dec 21, 2024 · 1 comment

Comments

@tapadeep
Copy link

Describe bug

ERROR $BIRLAPREC.BO: possibly delisted; no price data found (1d 2024-01-31 -> 2024-02-01)
ERROR:yfinance: $BIRLAPREC.BO: possibly delisted; no price data found (1d 2024-01-31 -> 2024-02-01)

Simple code that reproduces your problem

import yfinance as yf
import datetime as datetime0
from datetime import datetime
yf.enable_debug_mode()
stock=yf.Ticker('BIRLAPREC.BO')
date=datetime.strptime('31-Jan-24','%d-%b-%y').date()
print(yf.version)
stock.history(start=date,end=date+datetime0.timedelta(days=1))

Debug log

`

DEBUG    Entering history()
DEBUG:yfinance:Entering history()
DEBUG     Entering history()
DEBUG:yfinance: Entering history()
DEBUG      BIRLAPREC.BO: Yahoo GET parameters: {'period1': '2024-01-31 00:00:00+05:30', 'period2': '2024-02-01 00:00:00+05:30', 'interval': '1d', 'includePrePost': False, 'events': 'div,splits,capitalGains'}
DEBUG:yfinance:  BIRLAPREC.BO: Yahoo GET parameters: {'period1': '2024-01-31 00:00:00+05:30', 'period2': '2024-02-01 00:00:00+05:30', 'interval': '1d', 'includePrePost': False, 'events': 'div,splits,capitalGains'}
DEBUG      Entering get()
DEBUG:yfinance:  Entering get()
DEBUG       Entering _make_request()
DEBUG:yfinance:   Entering _make_request()
DEBUG        url=https://query2.finance.yahoo.com/v8/finance/chart/BIRLAPREC.BO
DEBUG:yfinance:    url=https://query2.finance.yahoo.com/v8/finance/chart/BIRLAPREC.BO
DEBUG        params=frozendict.frozendict({'period1': 1706639400, 'period2': 1706725800, 'interval': '1d', 'includePrePost': False, 'events': 'div,splits,capitalGains'})
DEBUG:yfinance:    params=frozendict.frozendict({'period1': 1706639400, 'period2': 1706725800, 'interval': '1d', 'includePrePost': False, 'events': 'div,splits,capitalGains'})
DEBUG        Entering _get_cookie_and_crumb()
DEBUG:yfinance:    Entering _get_cookie_and_crumb()
DEBUG         cookie_mode = 'csrf'
DEBUG:yfinance:     cookie_mode = 'csrf'
DEBUG         Entering _get_crumb_csrf()
DEBUG:yfinance:     Entering _get_crumb_csrf()
0.2.51
DEBUG          Failed to find "csrfToken" in response
DEBUG:yfinance:      Failed to find "csrfToken" in response
DEBUG         Exiting _get_crumb_csrf()
DEBUG:yfinance:     Exiting _get_crumb_csrf()
DEBUG         toggling cookie strategy csrf -> basic
DEBUG:yfinance:     toggling cookie strategy csrf -> basic
DEBUG         Entering _get_cookie_and_crumb_basic()
DEBUG:yfinance:     Entering _get_cookie_and_crumb_basic()
DEBUG          loaded persistent cookie
DEBUG:yfinance:      loaded persistent cookie
DEBUG          reusing cookie
DEBUG:yfinance:      reusing cookie
DEBUG          crumb = 'Edge: Too Many Requests'
DEBUG:yfinance:      crumb = 'Edge: Too Many Requests'
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=429
DEBUG:yfinance:    response code=429
DEBUG        toggling cookie strategy basic -> csrf
DEBUG:yfinance:    toggling cookie strategy basic -> csrf
DEBUG        Entering _get_cookie_and_crumb()
DEBUG:yfinance:    Entering _get_cookie_and_crumb()
DEBUG         cookie_mode = 'csrf'
DEBUG:yfinance:     cookie_mode = 'csrf'
DEBUG         Entering _get_crumb_csrf()
DEBUG:yfinance:     Entering _get_crumb_csrf()
DEBUG          Failed to find "csrfToken" in response
DEBUG:yfinance:      Failed to find "csrfToken" in response
DEBUG         Exiting _get_crumb_csrf()
DEBUG:yfinance:     Exiting _get_crumb_csrf()
DEBUG         toggling cookie strategy csrf -> basic
DEBUG:yfinance:     toggling cookie strategy csrf -> basic
DEBUG         Entering _get_cookie_and_crumb_basic()
DEBUG:yfinance:     Entering _get_cookie_and_crumb_basic()
DEBUG          loaded persistent cookie
DEBUG:yfinance:      loaded persistent cookie
DEBUG          reusing cookie
DEBUG:yfinance:      reusing cookie
DEBUG          crumb = 'Edge: Too Many Requests'
DEBUG:yfinance:      crumb = 'Edge: Too Many Requests'
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=429
DEBUG:yfinance:    response code=429
DEBUG       Exiting _make_request()
DEBUG:yfinance:   Exiting _make_request()
DEBUG      Exiting get()
DEBUG:yfinance:  Exiting get()
ERROR      $BIRLAPREC.BO: possibly delisted; no price data found  (1d 2024-01-31 -> 2024-02-01)
ERROR:yfinance:  $BIRLAPREC.BO: possibly delisted; no price data found  (1d 2024-01-31 -> 2024-02-01)
DEBUG     Exiting history()
DEBUG:yfinance: Exiting history()
DEBUG    Exiting history()
DEBUG:yfinance:Exiting history()
  | Open | High | Low | Close | Adj Close | Volume -- | -- | -- | -- | -- | -- | --
`

Bad data proof

BIRLAPREC_BO

yfinance version

0.2.51

Python version

3.10.12

Operating system

Ubuntu 22.04.3 LTS

@R5dan
Copy link
Contributor

R5dan commented Dec 21, 2024

I am not getting the same error @tapadeep. Do you filter the data? The data will be returned at midnight for the time zone +5:30. The data is being requested from here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants