[Python] Python > yfinance > yf.Ticker(symbol) [duplicate]

Discussão em 'Python' iniciado por Stack, Abril 21, 2025.

  1. Stack

    Stack Membro Participativo

    When using logging and yfinance, if one queries for a incorrect ticker name, they will get an error and I am struggling to shield the user from that error:

    Code which triggers the error:

    ticker = yf.Ticker("QQQQQQQQQ")
    stock_info = ticker.info


    The error:

    ERROR - 404 Client Error: Not Found for url: https://query2.finance.yahoo.com/v10/finance/quoteSummary/QQQQQQQQQ?modules=financialData%2CquoteType%2CdefaultKeyStatistics%2CassetProfile%2CsummaryDetail&corsDomain=finance.yahoo.com&formatted=false&symbol=QQQQQQQQZ1Z&crumb=XXXX
    ERROR - Failed to fetch or update Yahoo Finance data for 'QQQQQQQQQ': 'NoneType' object has no attribute 'update'


    What is the easiest way to check with Yahoo to see if a symbol is valid without triggering this error?

    I do want to keep logging set on.

    Thank you.

    Continue reading...

Compartilhe esta Página