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

I cannot get price module in Ticker class #237

Closed
RafaBarneto opened this issue Nov 11, 2023 · 9 comments · Fixed by #248
Closed

I cannot get price module in Ticker class #237

RafaBarneto opened this issue Nov 11, 2023 · 9 comments · Fixed by #248

Comments

@RafaBarneto
Copy link

Describe the bug
From some days ago when I create Ticker class for any ticker, the modules price and summary details are missing. It seems only history module is working.

To Reproduce
This is my code:

from yahooquery import Ticker
ticker = 'VOYA'
emp = Ticker(ticker)
datos_diarios = emp.history(start=fecha_ini, end=fecha_fin,
adj_ohlc=True)
info = {}
ticker = empresa.symbols[0]
info['nombre'] = emp.price[ticker]['shortName']
info['beta'] = float(emp.summary_detail[ticker]['beta'])

Expected behavior
I should have the Name of the company in info['nombre'] and beta in info['beta']
Instead I have a KeyError for the ticker ´VOYA´ in both cases.
Inspecting the content of emp instance, both methods "price" and "summary_detail" are missing.

Screenshots
I add screenshots for the above results.

Captura de pantalla 2023-11-11 a las 9 25 40 Captura de pantalla 2023-11-11 a las 9 24 54

Desktop (please complete the following information):

  • OS: macOS Sonoma 14.0
  • Browser [safari]
  • Version [17]
@RafaBarneto
Copy link
Author

Just to complete information, I use version 2.3.3 of yahooquery to get that result.

@alBronko
Copy link

I think I have the same issue.
I am outside the US so changed the \etc\hosts file to route query2.finance.yahoo.com to the hard ip 69.147.92.11.

>>> from yahooquery import Ticker
>>> all_financial_data_list = ['AccountsPayable', 'AccountsReceivable']
>>> ticker = Ticker("AAPL")
>>> ticker.get_financial_data(all_financial_data_list, frequency = 'q', trailing=False)
         asOfDate periodType currencyCode  AccountsPayable  AccountsReceivable
symbol
AAPL   2022-09-30         3M          USD     6.411500e+10        2.818400e+10
AAPL   2022-12-31         3M          USD     5.791800e+10        2.375200e+10
AAPL   2023-03-31         3M          USD     4.294500e+10        1.793600e+10
AAPL   2023-06-30         3M          USD     4.669900e+10        1.954900e+10
AAPL   2023-09-30         3M          USD     6.261100e+10        2.950800e+10

>>> ticker.price["AAPL"]
'Invalid Cookie'
>>> ticker.key_stats["AAPL"]
'Invalid Cookie'

this worked a few days ago and stopped all of a sudden. it doesnt work with a VPN to the US either.

Ubuntu 22.04
python 3.10 and 3.11 tested
yahooquery 2.3.3.

@RafaBarneto
Copy link
Author

I think I have the same issue. I am outside the US so changed the \etc\hosts file to route query2.finance.yahoo.com to the hard ip 69.147.92.11.

>>> from yahooquery import Ticker
>>> all_financial_data_list = ['AccountsPayable', 'AccountsReceivable']
>>> ticker = Ticker("AAPL")
>>> ticker.get_financial_data(all_financial_data_list, frequency = 'q', trailing=False)
         asOfDate periodType currencyCode  AccountsPayable  AccountsReceivable
symbol
AAPL   2022-09-30         3M          USD     6.411500e+10        2.818400e+10
AAPL   2022-12-31         3M          USD     5.791800e+10        2.375200e+10
AAPL   2023-03-31         3M          USD     4.294500e+10        1.793600e+10
AAPL   2023-06-30         3M          USD     4.669900e+10        1.954900e+10
AAPL   2023-09-30         3M          USD     6.261100e+10        2.950800e+10

>>> ticker.price["AAPL"]
'Invalid Cookie'
>>> ticker.key_stats["AAPL"]
'Invalid Cookie'

this worked a few days ago and stopped all of a sudden. it doesnt work with a VPN to the US either.

Ubuntu 22.04 python 3.10 and 3.11 tested yahooquery 2.3.3.

Thanks alBronko.
I am also out of US, but let me confirm my understanding of your solution:

  • It works right now or was just for some days/weeks?
  • Where exactly make you the change and how?
    Regards.

@alBronko
Copy link

I don't have a solution. Price doesn't work.

on linux, I added
69.147.92.11 query2.finance.yahoo.com
to the file /etc/hosts

@kryp33
Copy link

kryp33 commented Dec 4, 2023

It seems to stop working in US also a few hours ago. Hard to say if it is a temporary glitch or not.
aapl = Ticker(['AAPL'])
aapl.quotes

'Invalid Cookie'

@chfiii
Copy link

chfiii commented Dec 4, 2023

I've been seeing here in CT, US. Started around 2:29PM EST. the first problem I see is that https://fc.yahoo.com is returning a 502 error code. It is saying that there's a problem and they are working to fix it. The main finance.yahoo.com site is up though

@dpguthrie
Copy link
Owner

See if 2.3.4 fixes this for you. Problems are largely location dependent unfortunately and may not provide the fix you're looking for.

@Rapid1898-code
Copy link

Hello - i tried to use the version 2.3.4 and still have the same error:

{'AAPL': 'Invalid Cookie'}

@danielegramola
Copy link

Same error here (Italy):

stock = Ticker('UCG.MI')
print(stock.key_stats)

Failed to obtain crumb. Ability to retrieve data will be significantly limited.
{'UCG.MI': 'Invalid Cookie'}

Python 3.11.7, Yahooquery 2.3.6

@dpguthrie dpguthrie linked a pull request Dec 16, 2023 that will close this issue
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

Successfully merging a pull request may close this issue.

7 participants