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

Not Receiving Updated data in .info #2042

Open irtaza23 opened 2 months ago

irtaza23 commented 2 months ago

Describe bug

I queried data for MSFT but the data looks the same using the .info. This was done over multiple intervals, for example I ran my code to extract the data after 5 minutes, and in comparison both of the data looks the same. I have tried the same for AMD and AAPL but get the same results. I have also tried retrieving data after a 20 minutes gap but the data is exactly the same as before. Another question I have is, does .history() return current day data? If not, what's the latest data you can get from it?

Simple code that reproduces your problem

import yfinance as yf

Stock symbol

ticker = "MSFT"

Connect to the stock

stock = yf.Ticker(ticker)

Get stock info

stock_info = stock.info

Display stock info

display(stock_info)

Debug log

import yfinance as yf yf.enable_debug_mode()

Stock symbol

ticker = "MSFT"

Connect to the stock

stock = yf.Ticker(ticker)

Get stock info

stock_info = stock.info

DEBUG get_raw_json(): https://query2.finance.yahoo.com/v10/finance/quoteSummary/MSFT DEBUG Entering get() DEBUG url=https://query2.finance.yahoo.com/v10/finance/quoteSummary/MSFT DEBUG params={'modules': 'financialData,quoteType,defaultKeyStatistics,assetProfile,summaryDetail', 'corsDomain': 'finance.yahoo.com', 'formatted': 'false', 'symbol': 'MSFT'} 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()

{'address1': 'One Microsoft Way', 'city': 'Redmond', 'state': 'WA', 'zip': '98052-6399', 'country': 'United States', 'phone': '425 882 8080', 'website': 'https://www.microsoft.com/', 'industry': 'Software - Infrastructure', 'industryKey': 'software-infrastructure', 'industryDisp': 'Software - Infrastructure', 'sector': 'Technology', 'sectorKey': 'technology', 'sectorDisp': 'Technology', 'longBusinessSummary': 'Microsoft Corporation develops and supports software, services, devices and solutions worldwide. The Productivity and Business Processes segment offers office, exchange, SharePoint, Microsoft Teams, office 365 Security and Compliance, Microsoft viva, and Microsoft 365 copilot; and office consumer services, such as Microsoft 365 consumer subscriptions, Office licensed on-premises, and other office services. This segment also provides LinkedIn; and dynamics business solutions, including Dynamics 365, a set of intelligent, cloud-based applications across ERP, CRM, power apps, and power automate; and on-premises ERP and CRM applications. The Intelligent Cloud segment offers server products and cloud services, such as azure and other cloud services; SQL and windows server, visual studio, system center, and related client access licenses, as well as nuance and GitHub; and enterprise services including enterprise support services, industry solutions, and nuance professional services. The More Personal Computing segment offers Windows, including windows OEM licensing and other non-volume licensing of the Windows operating system; Windows commercial comprising volume licensing of the Windows operating system, windows cloud services, and other Windows commercial offerings; patent licensing; and windows Internet of Things; and devices, such as surface, HoloLens, and PC accessories. Additionally, this segment provides gaming, which includes Xbox hardware and content, and first- and third-party content; Xbox game pass and other subscriptions, cloud gaming, advertising, third-party disc royalties, and other cloud services; and search and news advertising, which includes Bing, Microsoft News and Edge, and third-party affiliates. The company sells its products through OEMs, distributors, and resellers; and directly through digital marketplaces, online, and retail stores. The company was founded in 1975 and is headquartered in Redmond, Washington.', 'fullTimeEmployees': 228000, 'companyOfficers': [{'maxAge': 1, 'name': 'Mr. Satya Nadella', 'age': 56, 'title': 'Chairman & CEO', 'yearBorn': 1967, 'fiscalYear': 2023, 'totalPay': 9276400, 'exercisedValue': 0, 'unexercisedValue': 0}, {'maxAge': 1, 'name': 'Mr. Bradford L. Smith LCA', 'age': 64, 'title': 'President & Vice Chairman', 'yearBorn': 1959, 'fiscalYear': 2023, 'totalPay': 3591277, 'exercisedValue': 0, 'unexercisedValue': 0}, {'maxAge': 1, 'name': 'Ms. Amy E. Hood', 'age': 51, 'title': 'Executive VP & CFO', 'yearBorn': 1972, 'fiscalYear': 2023, 'totalPay': 3452196, 'exercisedValue': 0, 'unexercisedValue': 0}, {'maxAge': 1, 'name': 'Mr. Judson B. Althoff', 'age': 50, 'title': 'Executive VP & Chief Commercial Officer', 'yearBorn': 1973, 'fiscalYear': 2023, 'totalPay': 3355797, 'exercisedValue': 0, 'unexercisedValue': 0}, {'maxAge': 1, 'name': 'Mr. Christopher David Young', 'age': 51, 'title': 'Executive Vice President of Business Development, Strategy & Ventures', 'yearBorn': 1972, 'fiscalYear': 2023, 'totalPay': 2460507, 'exercisedValue': 0, 'unexercisedValue': 0}, {'maxAge': 1, 'name': 'Ms. Alice L. Jolla', 'age': 57, 'title': 'Corporate VP & Chief Accounting Officer', 'yearBorn': 1966, 'fiscalYear': 2023, 'exercisedValue': 0, 'unexercisedValue': 0}, {'maxAge': 1, 'name': 'Mr. James Kevin Scott', 'age': 51, 'title': 'Executive VP of AI & CTO', 'yearBorn': 1972, 'fiscalYear': 2023, 'exercisedValue': 0, 'unexercisedValue': 0}, {'maxAge': 1, 'name': 'Brett Iversen', 'title': 'Vice President of Investor Relations', 'fiscalYear': 2023, 'exercisedValue': 0, 'unexercisedValue': 0}, {'maxAge': 1, 'name': 'Mr. Hossein Nowbar', 'title': 'Chief Legal Officer', 'fiscalYear': 2023, 'exercisedValue': 0, 'unexercisedValue': 0}, {'maxAge': 1, 'name': 'Mr. Frank X. Shaw', 'title': 'Chief Communications Officer', 'fiscalYear': 2023, 'exercisedValue': 0, 'unexercisedValue': 0}], 'auditRisk': 2, 'boardRisk': 5, 'compensationRisk': 2, 'shareHolderRightsRisk': 2, 'overallRisk': 1, 'governanceEpochDate': 1724803200, 'compensationAsOfEpochDate': 1703980800, 'irWebsite': 'http://www.microsoft.com/investor/default.aspx', 'maxAge': 86400, 'priceHint': 2, 'previousClose': 413.12, 'open': 415.6, 'dayLow': 412.13, 'dayHigh': 417.45, 'regularMarketPreviousClose': 413.12, 'regularMarketOpen': 415.6, 'regularMarketDayLow': 412.13, 'regularMarketDayHigh': 417.45, 'dividendRate': 3.0, 'dividendYield': 0.0072000003, 'exDividendDate': 1723680000, 'payoutRatio': 0.2483, 'fiveYearAvgDividendYield': 0.9, 'beta': 0.896, 'trailingPE': 35.320915, 'forwardPE': 27.389364, 'volume': 24308324, 'regularMarketVolume': 24308324, 'averageVolume': 19598866, 'averageVolume10days': 16841650, 'averageDailyVolume10Day': 16841650, 'marketCap': 3100618260480, 'fiftyTwoWeekLow': 309.45, 'fiftyTwoWeekHigh': 468.35, 'priceToSalesTrailing12Months': 12.649285, 'fiftyDayAverage': 431.47, 'twoHundredDayAverage': 410.67886, 'trailingAnnualDividendRate': 3.0, 'trailingAnnualDividendYield': 0.0072618127, 'currency': 'USD', 'enterpriseValue': 3122938511360, 'profitMargins': 0.35956, 'floatShares': 7422929449, 'sharesOutstanding': 7433039872, 'sharesShort': 54789102, 'sharesShortPriorMonth': 61931266, 'sharesShortPreviousMonthDate': 1721001600, 'dateShortInterest': 1723680000, 'sharesPercentSharesOut': 0.0074, 'heldPercentInsiders': 0.00053, 'heldPercentInstitutions': 0.73735, 'shortRatio': 2.37, 'shortPercentOfFloat': 0.0074, 'impliedSharesOutstanding': 7433039872, 'bookValue': 36.115, 'priceToBook': 11.550325, 'lastFiscalYearEnd': 1719705600, 'nextFiscalYearEnd': 1751241600, 'mostRecentQuarter': 1719705600, 'earningsQuarterlyGrowth': 0.097, 'netIncomeToCommon': 88135999488, 'trailingEps': 11.81, 'forwardEps': 15.23, 'pegRatio': 2.18, 'lastSplitFactor': '2:1', 'lastSplitDate': 1045526400, 'enterpriseToRevenue': 12.74, 'enterpriseToEbitda': 24.128, '52WeekChange': 0.25060713, 'SandP52WeekChange': 0.2560848, 'lastDividendValue': 0.75, 'lastDividendDate': 1723680000, 'exchange': 'NMS', 'quoteType': 'EQUITY', 'symbol': 'MSFT', 'underlyingSymbol': 'MSFT', 'shortName': 'Microsoft Corporation', 'longName': 'Microsoft Corporation', 'firstTradeDateEpochUtc': 511108200, 'timeZoneFullName': 'America/New_York', 'timeZoneShortName': 'EDT', 'uuid': 'b004b3ec-de24-385e-b2c1-923f10d3fb62', 'messageBoardId': 'finmb_21835', 'gmtOffSetMilliseconds': -14400000, 'currentPrice': 417.14, 'targetHighPrice': 600.0, 'targetLowPrice': 440.0, 'targetMeanPrice': 496.67, 'targetMedianPrice': 500.0, 'recommendationMean': 1.7, 'recommendationKey': 'buy', 'numberOfAnalystOpinions': 47, 'totalCash': 75531001856, 'totalCashPerShare': 10.162, 'ebitda': 129433001984, 'totalDebt': 97851998208, 'quickRatio': 1.141, 'currentRatio': 1.275, 'totalRevenue': 245122007040, 'debtToEquity': 36.447, 'revenuePerShare': 32.986, 'returnOnAssets': 0.14802, 'returnOnEquity': 0.37133, 'freeCashflow': 56705249280, 'operatingCashflow': 118547996672, 'earningsGrowth': 0.097, 'revenueGrowth': 0.152, 'grossMargins': 0.69764, 'ebitdaMargins': 0.52804, 'operatingMargins': 0.43143, 'financialCurrency': 'USD', 'trailingPegRatio': 2.2497}

Bad data proof

No response

yfinance version

0.2.43

Python version

No response

Operating system

No response

ValueRaider commented 2 months ago

but the data is exactly the same as before.

What should change?