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

No options data anymore? #1738

Closed
Coding4Sec opened this issue Nov 8, 2023 · 18 comments
Closed

No options data anymore? #1738

Coding4Sec opened this issue Nov 8, 2023 · 18 comments

Comments

@Coding4Sec
Copy link

Coding4Sec commented Nov 8, 2023

Describe bug

Since yesterday (11/07/2023) my script does not get any options data anymore. Does someone else run into this problem? The script runs for more than year every day w/o any issues. Debugging reveals, no expiration are loaded...

Important to say: Options data on website is ok.

Simple code that reproduces your problem

Basic code from my Juyter NB:

xsp = yf.Ticker('^XSP')

gives back an object:

xsp
> yfinance.Ticker object <^XSP>

pulling expiration list:

exp_lst = xsp.options
exp_lst
>()

returns nothing. The list is empty, therefor no options data is returned.

Debug log

Jupyter Notebook
Logout
current mode
File
Edit
View
Language

1
Error! /Users/crg/myPython/yFinance/old_skripts/yfinance.cache is not UTF-8 encoded
2
Saving disabled.
3
See Console for more details.

Bad data proof

No response

yfinance version

Name: yfinance Version: 0.2.31

Python version

No response

Operating system

No response

@AlluSu
Copy link

AlluSu commented Nov 8, 2023

Also facing the same issue here. options method seems to return empty list for S&P 500 ('SPY') data

@michael-william
Copy link

Same here. I was able to get a list of options for 1 min, but its stopped again.

@ahuruglica
Copy link

Same issue here also.

@bot-unit
Copy link

bot-unit commented Nov 8, 2023

Look like Yahoo step by step is trying to block any robo-request.

@ValueRaider
Copy link
Collaborator

Does #1657 help?

@Coding4Sec
Copy link
Author

Strange. My script finishes w/o any issue this evening...

@ahuruglica
Copy link

Same issue here also.

After a few hours it started working.

@pipreaper
Copy link

import yfinance as yf
import sys
yf.enable_debug_mode()

print('run')
print(sys.version)

s_ticker = '^XSP'
ticker = yf.Ticker(s_ticker)
# data = ticker.get_fast_info()
# data = ticker.info
data = ticker.options
print(data)

/home/robert/PycharmProjects/get_prospects/env/bin/python /home/robert/PycharmProjects/get_prospects/tests/a_cookie and crumb/test_it.py
DEBUG Entering get()
DEBUG url=https://query2.finance.yahoo.com/v7/finance/options/^XSP
DEBUG params=None
DEBUG Entering _get_cookie_and_crumb()
DEBUG cookie_mode = 'basic'
DEBUG Entering _get_cookie_and_crumb_basic()
DEBUG Entering _get_cookie_basic()
DEBUG loaded persistent cookie
DEBUG Exiting _get_cookie_basic()
DEBUG Entering _get_crumb_basic()
DEBUG Entering _get_cookie_basic()
DEBUG reusing cookie
DEBUG Exiting _get_cookie_basic()
run
3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0]
DEBUG crumb = 'n9BMUI5oIqh'
DEBUG Exiting _get_crumb_basic()
DEBUG Exiting _get_cookie_and_crumb_basic()
DEBUG Exiting _get_cookie_and_crumb()
DEBUG Exiting get()
('2023-11-09', '2023-11-10', '2023-11-13', '2023-11-14', '2023-11-15', '2023-11-16', '2023-11-17', '2023-11-20', '2023-11-21', '2023-11-22', '2023-11-24', '2023-11-27', '2023-11-28', '2023-11-29', '2023-11-30', '2023-12-01', '2023-12-04', '2023-12-05', '2023-12-07', '2023-12-08', '2023-12-14', '2023-12-15', '2023-12-22', '2023-12-29', '2024-01-19', '2024-01-31', '2024-02-16', '2024-02-29', '2024-03-15', '2024-03-28', '2024-04-19', '2024-04-30', '2024-05-17', '2024-05-31', '2024-06-21', '2024-06-28', '2024-07-19', '2024-07-31', '2024-08-16', '2024-08-30', '2024-09-20', '2024-09-30', '2024-10-18', '2024-10-31', '2024-11-15', '2024-12-20', '2025-06-20')

Process finished with exit code 0

@pipreaper
Copy link

Options run (No VPN, UK):

import yfinance as yf
import sys
yf.enable_debug_mode()

print('run')
print(sys.version)

s_ticker = '^XSP'
ticker = yf.Ticker(s_ticker)
# data = ticker.get_fast_info()
# data = ticker.info
data = ticker.options
print('************ OPTIONS DATES ^XSP ***********')
print(data)
print('************ END OPTIONS DATES ^XSP ***********')
print(' ')
# get option chain for specific expiration
opt = ticker.option_chain(data[5])
print(opt)
print('************ OPT PUTS ***********')
print(opt.puts)
print('************ END OPT PUTS ***********')
print(' ')
print('************ OPT CALLS ***********')
print(opt.calls)
print('************ END OPT CALLS ***********')
print(' ')

options info.txt

@bot-unit
Copy link

Looks like this was a local Yahoo problem. Is this issue still necessary?

@Coding4Sec
Copy link
Author

Looks like this was a local Yahoo problem. Is this issue still necessary?

No, it is not necesssary anymore. You are right it has been a yahoo issue

@Coding4Sec
Copy link
Author

Yahoo problem. Non existing anymore

@mmx5
Copy link

mmx5 commented Feb 17, 2024

the problem still exist. !!! can't reach data. options returns nothing.

@krtek123
Copy link

Yes, it still exists. I cannot download options data!

@ValueRaider ValueRaider reopened this Apr 28, 2024
@bot-unit
Copy link

Yes, it still exists. I cannot download options data!

Is there options data for your tickers on Yahoo site?

@Coding4Sec
Copy link
Author

I faced this issue two times. First time it was an yahoo issue. It was ok next day then. Second time has been an issue related to python version which i could reveal by updating to latest version 3.12.xx

Which python do you use?

@henry-wrightman
Copy link

the issue is resolved in yfinance version 0.2.38.

@jkalanda
Copy link

the issue is resolved in yfinance version 0.2.38.

This does the trick. Your yfinance module has be newer.
Thank you, Henry W.

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