ranaroussi / yfinance

Download market data from Yahoo! Finance's API
https://aroussi.com/post/python-yahoo-finance
Apache License 2.0
14.89k stars 2.44k forks source link

No forwardPE for NWS #2028

Open tylerlong opened 3 months ago

tylerlong commented 3 months ago

Describe bug

NWS info doesn't contain forwardPE.

Simple code that reproduces your problem

import pprint
import yfinance as yf

yf.enable_debug_mode()
ticker = yf.Ticker('NWS')
pprint.pprint(ticker.info)

Debug log

DEBUG    get_raw_json(): https://query2.finance.yahoo.com/v10/finance/quoteSummary/NWS
DEBUG    Entering get()
DEBUG     url=https://query2.finance.yahoo.com/v10/finance/quoteSummary/NWS
DEBUG     params={'modules': 'financialData,quoteType,defaultKeyStatistics,assetProfile,summaryDetail', 'corsDomain': 'finance.yahoo.com', 'formatted': 'false', 'symbol': 'NWS'}
DEBUG     Entering _get_cookie_and_crumb()
DEBUG      cookie_mode = 'basic'
DEBUG      Entering _get_cookie_and_crumb_basic()
DEBUG       loaded persistent cookie
DEBUG       reusing cookie
DEBUG       crumb = 'OimU6iibYQg'
DEBUG      Exiting _get_cookie_and_crumb_basic()
DEBUG     Exiting _get_cookie_and_crumb()
DEBUG     response code=200
DEBUG    Exiting get()
DEBUG    Entering get()
DEBUG     url=https://query1.finance.yahoo.com/ws/fundamentals-timeseries/v1/finance/timeseries/NWS?symbol=NWS&type=trailingPegRatio&period1=1708128000&period2=1723939200
DEBUG     params=None
DEBUG     Entering _get_cookie_and_crumb()
DEBUG      cookie_mode = 'basic'
DEBUG      Entering _get_cookie_and_crumb_basic()
DEBUG       reusing cookie
DEBUG       reusing crumb
DEBUG      Exiting _get_cookie_and_crumb_basic()
DEBUG     Exiting _get_cookie_and_crumb()
DEBUG     response code=200
DEBUG    Exiting get()
{'52WeekChange': 0.35218632,
 'SandP52WeekChange': 0.2623955,
 'address1': '1211 Avenue of the Americas',
 'ask': 28.47,
 'askSize': 100,
 'auditRisk': 10,
 'averageDailyVolume10Day': 638810,
 'averageVolume': 728853,
 'averageVolume10days': 638810,
 'beta': 1.345,
 'bid': 28.43,
 'bidSize': 100,
 'boardRisk': 7,
 'bookValue': 14.268,
 'city': 'New York',
 'companyOfficers': [{'age': 62,
                      'exercisedValue': 0,
                      'fiscalYear': 2023,
                      'maxAge': 1,
                      'name': 'Mr. Robert J. Thomson',
                      'title': 'CEO & Director',
                      'totalPay': 8896316,
                      'unexercisedValue': 0,
                      'yearBorn': 1961},
                     {'age': 51,
                      'exercisedValue': 0,
                      'fiscalYear': 2023,
                      'maxAge': 1,
                      'name': 'Ms. Susan Lee Panuccio B.Bus (Hons), BBUS '
                              '(Dist), ICCA',
                      'title': 'Chief Financial Officer',
                      'totalPay': 4256264,
                      'unexercisedValue': 0,
                      'yearBorn': 1972},
                     {'age': 58,
                      'exercisedValue': 0,
                      'fiscalYear': 2023,
                      'maxAge': 1,
                      'name': 'Mr. David B. Pitofsky',
                      'title': 'Executive VP & General Counsel',
                      'totalPay': 2756742,
                      'unexercisedValue': 0,
                      'yearBorn': 1965},
                     {'age': 47,
                      'exercisedValue': 0,
                      'fiscalYear': 2023,
                      'maxAge': 1,
                      'name': 'Ms. Marygrace  DeGrazio',
                      'title': 'Chief Accounting Officer',
                      'unexercisedValue': 0,
                      'yearBorn': 1976},
                     {'age': 65,
                      'exercisedValue': 0,
                      'fiscalYear': 2023,
                      'maxAge': 1,
                      'name': 'Mr. David L. Kline',
                      'title': 'Executive VP & CTO',
                      'unexercisedValue': 0,
                      'yearBorn': 1958},
                     {'exercisedValue': 0,
                      'fiscalYear': 2023,
                      'maxAge': 1,
                      'name': 'Mr. Michael  Florin',
                      'title': 'Senior VP & Head of Investor Relations',
                      'unexercisedValue': 0},
                     {'exercisedValue': 0,
                      'fiscalYear': 2023,
                      'maxAge': 1,
                      'name': 'Mr. Arthur  Bochner',
                      'title': 'Executive VP & Chief Communications Officer',
                      'unexercisedValue': 0},
                     {'exercisedValue': 0,
                      'fiscalYear': 2023,
                      'maxAge': 1,
                      'name': 'Ms. Ruth  Allen',
                      'title': 'Executive VP & Chief Human Resources Officer',
                      'unexercisedValue': 0},
                     {'exercisedValue': 0,
                      'fiscalYear': 2023,
                      'maxAge': 1,
                      'name': 'Ms. Anoushka  Healy',
                      'title': 'Executive VP & Chief Strategy Officer',
                      'unexercisedValue': 0},
                     {'exercisedValue': 0,
                      'fiscalYear': 2023,
                      'maxAge': 1,
                      'name': 'Mr. Michael L. Bunder',
                      'title': 'Senior VP, Deputy General Counsel & Corporate '
                               'Secretary',
                      'unexercisedValue': 0}],
 'compensationAsOfEpochDate': 1703980800,
 'compensationRisk': 8,
 'country': 'United States',
 'currency': 'USD',
 'currentPrice': 28.45,
 'currentRatio': 1.431,
 'dateShortInterest': 1722384000,
 'dayHigh': 28.66,
 'dayLow': 28.395,
 'debtToEquity': 45.001,
 'dividendRate': 0.2,
 'dividendYield': 0.0070999996,
 'ebitda': 1220000000,
 'ebitdaMargins': 0.12097,
 'enterpriseToEbitda': 15.639,
 'enterpriseToRevenue': 1.892,
 'enterpriseValue': 19079006208,
 'exDividendDate': 1726012800,
 'exchange': 'NMS',
 'fiftyDayAverage': 28.1908,
 'fiftyTwoWeekHigh': 29.37,
 'fiftyTwoWeekLow': 20.01,
 'financialCurrency': 'USD',
 'firstTradeDateEpochUtc': 1371648600,
 'fiveYearAvgDividendYield': 1.11,
 'floatShares': 489869869,
 'freeCashflow': 435000000,
 'fullTimeEmployees': 23900,
 'gmtOffSetMilliseconds': -14400000,
 'governanceEpochDate': 1722470400,
 'grossMargins': 0.50412,
 'heldPercentInsiders': 0.40733,
 'heldPercentInstitutions': 0.44779,
 'impliedSharesOutstanding': 557332992,
 'industry': 'Entertainment',
 'industryDisp': 'Entertainment',
 'industryKey': 'entertainment',
 'lastDividendDate': 1710201600,
 'lastDividendValue': 0.1,
 'lastFiscalYearEnd': 1719705600,
 'longBusinessSummary': 'News Corporation, a media and information services '
                        'company, creates and distributes authoritative and '
                        'engaging content, and other products and services for '
                        'consumers and businesses worldwide. It operates in '
                        'six segments: Digital Real Estate Services, '
                        'Subscription Video Services, Dow Jones, Book '
                        'Publishing, News Media, and Other. The company '
                        'distributes content and data products, including The '
                        "Wall Street Journal, Barron's, MarketWatch, "
                        "Investor's Business Daily, Factiva, Dow Jones Risk & "
                        'Compliance, Dow Jones Newswires, and OPIS through '
                        'various media channels, such as newspapers, '
                        'newswires, websites, mobile apps, newsletters, '
                        'magazines, proprietary databases, live journalism, '
                        'video, and podcasts. It also owns and operates Monday '
                        'to Friday, Saturday and Sunday, weekly, and bi-weekly '
                        'newspapers comprising The Australian, The Weekend '
                        'Australian, The Daily Telegraph, The Sunday '
                        'Telegraph, Herald Sun, Sunday Herald Sun, The Courier '
                        'Mail, The Sunday Mail, The Advertiser, Sunday Mail, '
                        'The Sun, The Sun on Sunday, The Times, The Sunday '
                        'Times, and New York Post, as well as digital '
                        'mastheads and other websites. In addition, the '
                        'company publishes general fiction, nonfiction, '
                        "children's, and religious books; provides sports, "
                        'entertainment, and news services to pay-TV and '
                        'streaming subscribers, and other commercial licensees '
                        'through satellite and internet distribution; and '
                        'broadcasts rights to live sporting events. Further, '
                        'it offers property and property-related advertising '
                        'and services on its websites and mobile applications; '
                        'digital real estate services; and financial services. '
                        'News Corporation was founded in 2012 and is '
                        'headquartered in New York, New York.',
 'longName': 'News Corporation',
 'marketCap': 15774074880,
 'maxAge': 86400,
 'messageBoardId': 'finmb_212741644',
 'mostRecentQuarter': 1719705600,
 'netIncomeToCommon': 266000000,
 'nextFiscalYearEnd': 1751241600,
 'open': 28.64,
 'operatingCashflow': 1098000000,
 'operatingMargins': 0.06286,
 'overallRisk': 10,
 'payoutRatio': 0.4348,
 'phone': '212 416 3400',
 'previousClose': 28.52,
 'priceHint': 2,
 'priceToBook': 1.9939727,
 'priceToSalesTrailing12Months': 1.5641125,
 'profitMargins': 0.02638,
 'quickRatio': 1.16,
 'quoteType': 'EQUITY',
 'recommendationKey': 'none',
 'regularMarketDayHigh': 28.66,
 'regularMarketDayLow': 28.395,
 'regularMarketOpen': 28.64,
 'regularMarketPreviousClose': 28.52,
 'regularMarketVolume': 638745,
 'returnOnAssets': 0.029240001,
 'returnOnEquity': 0.03943,
 'revenueGrowth': 0.059,
 'revenuePerShare': 17.656,
 'sector': 'Communication Services',
 'sectorDisp': 'Communication Services',
 'sectorKey': 'communication-services',
 'shareHolderRightsRisk': 10,
 'sharesOutstanding': 190212992,
 'sharesPercentSharesOut': 0.0047999998,
 'sharesShort': 2715691,
 'sharesShortPreviousMonthDate': 1719532800,
 'sharesShortPriorMonth': 3492229,
 'shortName': 'News Corporation',
 'shortPercentOfFloat': 0.0241,
 'shortRatio': 4.1,
 'state': 'NY',
 'symbol': 'NWS',
 'timeZoneFullName': 'America/New_York',
 'timeZoneShortName': 'EDT',
 'totalCash': 1975000064,
 'totalCashPerShare': 3.474,
 'totalDebt': 4055000064,
 'totalRevenue': 10085000192,
 'trailingAnnualDividendRate': 0.2,
 'trailingAnnualDividendYield': 0.007012623,
 'trailingEps': 0.46,
 'trailingPE': 61.847828,
 'trailingPegRatio': 2.3033,
 'twoHundredDayAverage': 26.11015,
 'underlyingSymbol': 'NWS',
 'uuid': '4f405772-ccce-32c2-815c-c7c78a378930',
 'volume': 638745,
 'website': 'https://www.newscorp.com',
 'zip': '10036'}

Bad data proof

https://finance.yahoo.com/quote/FE/key-statistics/?p=FE

There is forwardPE

yfinance version

0.2.41

Python version

No response

Operating system

No response