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

Failed to get ticker '<Tickername>' reason: Expecting value: line 1 column 1 (char 0) #2179

Open
rajanpanchal opened this issue Dec 14, 2024 · 2 comments

Comments

@rajanpanchal
Copy link

Describe bug

when downloading tickers I am seeing "Failed to get ticker 'AXON' reason: Expecting value: line 1 column 1 (char 0)" . Only some tickers are successful rest all failing with same error. I have checked these tickers exists at finance.yahoo.com

Simple code that reproduces your problem

` data = yf.download(tickers, period='6mo', interval='1wk', auto_adjust=True, progress=True)```

Debug log

Failed to get ticker 'RSG' reason: Expecting value: line 1 column 1 (char 0)
[**********************94%********************   ]  811 of 860 completedFailed to get ticker 'TSM' reason: Expecting value: line 1 column 1 (char 0)
[**********************94%********************   ]  812 of 860 completedFailed to get ticker 'SPG' reason: Expecting value: line 1 column 1 (char 0)
[**********************95%*********************  ]  813 of 860 completedFailed to get ticker 'CSX' reason: Expecting value: line 1 column 1 (char 0)
[**********************95%*********************  ]  814 of 860 completedFailed to get ticker 'MTB' reason: Expecting value: line 1 column 1 (char 0)
Failed to get ticker 'BHP' reason: Expecting value: line 1 column 1 (char 0)
[**********************96%*********************  ]  827 of 860 completedFailed to get ticker 'INTC' reason: Expecting value: line 1 column 1 (char 0)
[**********************96%*********************  ]  828 of 860 completedFailed to get ticker 'TRI' reason: Expecting value: line 1 column 1 (char 0)
[**********************97%********************** ]  831 of 860 completedFailed to get ticker 'UMC' reason: Expecting value: line 1 column 1 (char 0)
Failed to get ticker 'DOW' reason: Expecting value: line 1 column 1 (char 0)
[**********************97%********************** ]  837 of 860 completedFailed to get ticker 'ELV' reason: Expecting value: line 1 column 1 (char 0)
Failed to get ticker 'CPNG' reason: Expecting value: line 1 column 1 (char 0)

Bad data proof

image

yfinance version

0.1.62

Python version

3

Operating system

windows 11

@ValueRaider
Copy link
Collaborator

Re-run with yf.enable_debug_mode() at start

@R5dan
Copy link
Contributor

R5dan commented Dec 16, 2024

@rajanpanchal I managed to get it working if you specify start and end times explicitly. Something like this:

import yfinance as yf
import datetime as dt

end=dt.datetime.now()

if end.month<=6:
    start = end.replace(year=end.year-1, month=12+(end.month-6))
else:
    start = end.replace(month=end.month-6)

data = yf.download("AXON", interval='1wk', end=end, start=start)

The error seems to be with the yahoo finance api itself as I can't get any stock data for anything with interval='1wk' and setting period.

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

3 participants