yahooquery icon indicating copy to clipboard operation
yahooquery copied to clipboard

Since about 8pm UTC yesterday, it started only returning 404 Errors

Open james-stevens opened this issue 2 years ago • 33 comments

Describe the bug Ticker("TSLA").quotes returns HTTP 404 Not Found

To Reproduce

#! /usr/bin/python3

import json
from yahooquery import Ticker

tickers = Ticker(["AAPL","TSLA"])
print(json.dumps(tickers.quotes,indent=3))

OUTPUT: HTTP 404 Not Found

Expected behavior Should return ticker data

Server (please complete the following information):

  • OS: Alpine 3.16.5
  • Python: 3.10.11
  • Version: yahooquery v2.3.1

Additional context Service was working fine for a couple of months until about 8pm UTC 23rd May (yesterday)

james-stevens avatar May 24 '23 11:05 james-stevens

I'm seeing this too. It appears to be random. Runs for a while and then gets the 404 error. My current workaround is to put it in a retry loop but this shouldn't be needed.

Server: Windows 11 Python 3.9.16 yahooquery: 2.2.15 - Anaconda3

chfiii avatar May 24 '23 15:05 chfiii

Interesting, I've had no success, since it started failing

alpine:~/python/yf$ ./yq.py
"HTTP 404 Not Found"
alpine:~/python/yf$ ./yq.py
"HTTP 404 Not Found"
alpine:~/python/yf$ ./yq.py
"HTTP 404 Not Found"
alpine:~/python/yf$ ./yq.py
"HTTP 404 Not Found"
alpine:~/python/yf$ ./yq.py
"HTTP 404 Not Found"
alpine:~/python/yf$ ./yq.py
"HTTP 404 Not Found"
alpine:~/python/yf$ ./yq.py
"HTTP 404 Not Found"
alpine:~/python/yf$ ./yq.py
"HTTP 404 Not Found"
alpine:~/python/yf$ ./yq.py
"HTTP 404 Not Found"

yq.py is the test script, as above

james-stevens avatar May 24 '23 15:05 james-stevens

Looks the same as #178.

Last time the url can back online around 24hrs later...

maread99 avatar May 24 '23 15:05 maread99

Looks the same as #178.

Last time the url can back online around 24hrs later...

reading that, the URL changed & the code was updated - I guess wait & see :)

https://github.com/maread99/market_prices/pull/155

james-stevens avatar May 24 '23 15:05 james-stevens

Seems random to me. I’m passing a list of ~140 stock and index symbols and then using the ‘quotes’ entry. I seem to be ok by doing:

ok = False

numRetries = 5

for i in range(numRetries):

    tic = Ticker(val,timeout=5)

    qts = tic.quotes

    if not isinstance(qts,dict):

        print(f'ERROR: qts is not a dict\n{qts=}')

        print('Retrying {i}')

        continue

    else:

        ok = True

        break

Hope this helps!

Charlie

From: James Stevens @.> Sent: Wednesday, May 24, 2023 11:04 AM To: dpguthrie/yahooquery @.> Cc: chfiii @.>; Comment @.> Subject: Re: [dpguthrie/yahooquery] Since about 8pm UTC yesterday, it stopped working (Issue #192)

Interesting, I've had no success, since it started failing

— Reply to this email directly, view it on GitHub https://github.com/dpguthrie/yahooquery/issues/192#issuecomment-1561331128 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ACX2GP5KGW5AOXISASDOT3TXHYPOZANCNFSM6AAAAAAYNHDPGE . You are receiving this because you commented.Message ID: @.***>

chfiii avatar May 24 '23 16:05 chfiii

#! /usr/bin/python3

import json

from yahooquery import Ticker

tickers = Ticker(["AAPL","TSLA"])
print(json.dumps(tickers.quotes,indent=3))

tickers = Ticker(["AAPL","TSLA"])
print(json.dumps(tickers.quotes,indent=3))

tickers = Ticker(["AAPL","TSLA"])
print(json.dumps(tickers.quotes,indent=3))

tickers = Ticker(["AAPL","TSLA"])
print(json.dumps(tickers.quotes,indent=3))

tickers = Ticker(["AAPL","TSLA"])
print(json.dumps(tickers.quotes,indent=3))

tickers = Ticker(["AAPL","TSLA"])
print(json.dumps(tickers.quotes,indent=3))

tickers = Ticker(["AAPL","TSLA"])
print(json.dumps(tickers.quotes,indent=3))

I get 404 every time (UK)

james-stevens avatar May 24 '23 16:05 james-stevens

Strange. Your test runs fine for me. I'm only seeing the 404 sporadically and the retry gets it.

chfiii avatar May 24 '23 16:05 chfiii

Last time it happened it did appear to be a regional thing

james-stevens avatar May 24 '23 16:05 james-stevens

FYI I'm in Connecticut, USA

chfiii avatar May 24 '23 16:05 chfiii

I'm just getting the 404 error as well. From Canada. Also seems random.

pfuller88 avatar May 24 '23 23:05 pfuller88

I'm just getting the 404 error as well. From Canada. Also seems random.

I'm still getting nothing but 404s here in the UK - so looks like its not going to cure itself in 24 hrs

james-stevens avatar May 25 '23 10:05 james-stevens

I noticed it seems to just be the "tickers.quotes" request that is returning a 404 error. The other modules I'm using are still working, i.e. ticker.price, history, option chain, etc.

pfuller88 avatar May 25 '23 12:05 pfuller88

I noticed it seems to just be the "tickers.quotes" request that is returning a 404 error. The other modules I'm using are still working, i.e. ticker.price, history, option chain, etc.

Well spotted, nice one! - same for me - gonna need to tweak my code now :)

james-stevens avatar May 25 '23 13:05 james-stevens

Me too!! Thanks for the heads up!

chfiii avatar May 25 '23 14:05 chfiii

Thank you so much - I got my code working again now - price has everything I need.

Super pleased cos I was missing seeing my $NVDA investment taking off !!!

As far as I concerned this can be closed, but quotes still doesn't work for me - so its up to you @dpguthrie

james-stevens avatar May 25 '23 14:05 james-stevens

It seems that the price module is taking a lot longer that the quotes one. I was averaging about 1.2 seconds for 136 quotes and now its taking ~10 seconds. Anyone else seeing this?

chfiii avatar May 25 '23 14:05 chfiii

Price works ok for me but missing the day's and 52 week ranges

chfiii avatar May 25 '23 14:05 chfiii

It seems that the price module is taking a lot longer that the quotes one. I was averaging about 1.2 seconds for 136 quotes and now its taking ~10 seconds. Anyone else seeing this?

I only do a small number - about 27, so it works fine for me - I also update the prices in the background 4 times an hour, so 1s or 10s is really neither here nor there to me

james-stevens avatar May 25 '23 15:05 james-stevens

I tend to update around every 90 seconds so I'm still ok but disappointed in the slowdown, especially it seem to be a subset of the quotes output.

chfiii avatar May 25 '23 15:05 chfiii

quotes is not working for me in Arizona, either. I concur with every comment except there's no randomness. It fails 100% of the time. I don't find price to be a suitable replacement because of missing values and slowness.

CraigerBrau avatar May 25 '23 17:05 CraigerBrau

Agree that the randomness has gone away. It’s dead all the time now. Missing the 52 week high/low, just returning a ‘N/A’ for now. And the price module is 7-10 times slower

chfiii avatar May 25 '23 19:05 chfiii

Hi everyone, I also get 404 error from "tickers.quotes" request since 25 May from Turkey. There are important KPIs in quotes that are not available elsewhere, like "bookValue" and "priceToBook". Since I am a beginner, do you have any idea if and when this would be fixed? Thanks!

caliskanuzay avatar May 26 '23 10:05 caliskanuzay

For me, I get a list of 27 via price in about 0.85s - I can't recall how long it took under quotes, but seems about the same to me

I pull the list of tickers from a database & pass the entire list to Ticker in one go.

def get_prices(ticker):
    try:
        tickers = Ticker(ticker)
        return tickers.price
    except Exception as exc:
        print(f"ERROR: {exc}")
    return None


cnx.query("select ticker from tickers")
res = cnx.store_result()
ret = res.fetch_row(maxrows=0, how=1)

tick_list = [ t["ticker"].upper() for t in ret ]
tickers = get_prices(tick_list)

(this is not posted for you to critique my Python :rofl: )

james-stevens avatar May 26 '23 15:05 james-stevens

FYI: One thing I noticed when I switched from quotes to price is that the change% needs to be multiplied by 100 to get the true change percentage.

chfiii avatar May 26 '23 15:05 chfiii

For those looking for other variabale, the data.summary_detail and the data.key_stats are also still working. Here is a sample of the output fields for each..... Summary Detail... fields: algorithm,ask,askSize,averageDailyVolume10Day,averageVolume,averageVolume10days,beta,bid,bidSize,coinMarketCapLink,currency,dayHigh,dayLow,dividendRate,dividendYield,exDividendDate,fiftyDayAverage,fiftyTwoWeekHigh,fiftyTwoWeekLow,fiveYearAvgDividendYield,forwardPE,fromCurrency,lastMarket,marketCap,maxAge,open,payoutRatio,previousClose,priceHint,priceToSalesTrailing12Months,regularMarketDayHigh,regularMarketDayLow,regularMarketOpen,regularMarketPreviousClose,regularMarketVolume,toCurrency,tradeable,trailingAnnualDividendRate,trailingAnnualDividendYield,trailingPE,twoHundredDayAverage,volume Key Stats: Fields: 52WeekChange,beta,bookValue,category,dateShortInterest,earningsQuarterlyGrowth,enterpriseToRevenue,enterpriseValue,floatShares,forwardEps,forwardPE,fundFamily,heldPercentInsiders,heldPercentInstitutions,impliedSharesOutstanding,lastDividendDate,lastDividendValue,lastFiscalYearEnd,lastSplitDate,lastSplitFactor,legalType,maxAge,mostRecentQuarter,netIncomeToCommon,nextFiscalYearEnd,pegRatio,priceHint,priceToBook,profitMargins,SandP52WeekChange,sharesOutstanding,sharesPercentSharesOut,sharesShort,sharesShortPreviousMonthDate,sharesShortPriorMonth,shortPercentOfFloat,shortRatio,trailingEps

pfuller88 avatar May 28 '23 17:05 pfuller88

Thanks. This does help as I wanted fiftyTwoWeekHigh./Low. Didn't want to use the history,'1y'' as way too much data

chfiii avatar May 28 '23 17:05 chfiii

Dear @pfuller88,thank you very much!!!! This helps a lot because I did not know about .keystats:)) You saved me hours and hours as some of the kPIs like priceToBook, sharesOutstanding and many useful stuff disappeared in .quotes.

caliskanuzay avatar May 28 '23 18:05 caliskanuzay

In my case, accessed from Qatar. all_financial_data(frequency='a') still working fine, but all_financial_data(frequency='q') got 'HTTP 404 Not Found.' error.

charlie-delta-003 avatar Jun 01 '23 13:06 charlie-delta-003

I noticed it seems to just be the "tickers.quotes" request that is returning a 404 error. The other modules I'm using are still working, i.e. ticker.price, history, option chain, etc.

thx for that .... still unfortunate that quotes isn't reliable, but prize will do the trick for me

kajdo avatar Jun 01 '23 21:06 kajdo

While the link blow is not the exact link use in the code but from the comments it seem yahoo quotes api has been disabled. See sub link. https://query2.finance.yahoo.com/v7/finance/quote .

Marcel2059 avatar Jun 04 '23 14:06 Marcel2059