{"library":"yfinance","title":"yfinance","description":"yfinance is a popular open-source Python library designed to access and retrieve financial market data from Yahoo! Finance. It simplifies fetching historical prices, financial statements, dividends, splits, and other relevant information for stocks, indices, and securities. The library is actively maintained with frequent updates, enabling users to efficiently perform financial analyses and gain insights.","status":"active","version":"1.2.0","language":"en","source_language":"en","source_url":"https://github.com/ranaroussi/yfinance","tags":["finance","stock market","data","yahoo finance"],"install":[{"cmd":"pip install yfinance","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Essential for DataFrame data structures returned by the library.","package":"pandas"},{"reason":"Underpins pandas for numerical operations.","package":"numpy"},{"reason":"Handles HTTP requests to fetch data from Yahoo! Finance.","package":"requests"},{"reason":"For asynchronous operations.","package":"multitasking"},{"reason":"Used for parsing HTML content, likely in scraping scenarios.","package":"beautifulsoup4"},{"reason":"A newer, more robust HTTP client sometimes used for enhanced request handling.","package":"curl-cffi"}],"imports":[{"symbol":"yfinance","correct":"import yfinance as yf"}],"quickstart":{"code":"import yfinance as yf\nimport pandas as pd\n\n# Download historical data for a single ticker (e.g., Apple)\nticker_symbol = \"AAPL\"\ndata = yf.download(ticker_symbol, start=\"2023-01-01\", end=\"2023-12-31\")\n\nprint(f\"Downloaded {len(data)} rows for {ticker_symbol}:\")\nprint(data.head())\n\n# Access information about a ticker\nticker = yf.Ticker(ticker_symbol)\ninfo = ticker.info\nprint(f\"\\nMarket Cap for {ticker_symbol}: {info.get('marketCap')}\")","lang":"python","description":"This quickstart demonstrates how to download historical stock data for a given ticker symbol and how to access fundamental information about a company using the Ticker object."},"warnings":[{"fix":"If you need to modify the DataFrame, make a copy first: `df = yf.history().copy()` or use DataFrame methods that return a new DataFrame.","message":"As of version 1.2.0, the DataFrame returned by `yf.history()` is consolidated, which might cause 'read-only' errors in existing code if you attempt to modify it in place.","severity":"breaking","affected_versions":">=1.2.0"},{"fix":"Adapt your code to handle Multi-Index DataFrames (e.g., using `.xs()` or `.droplevel()`) and rely on the automatically adjusted OHLC values. If migrating from older versions, verify your data processing logic.","message":"Around version 0.2.51 (December 2024), the data structure for downloaded data changed, often introducing a Multi-Index DataFrame. Additionally, the explicit 'Adjusted Close' column was removed as Open, High, Low, and Close prices are now automatically adjusted for dividends and splits.","severity":"breaking","affected_versions":">=0.2.51 (likely applies to 1.x releases as well, upgrading from older 0.2.x)"},{"fix":"Refer to the official yfinance documentation for the updated configuration methods (e.g., `https://ranaroussi.github.io/yfinance/advanced/config.html`).","message":"Version 1.0 introduced deprecation warnings for the old configuration method.","severity":"deprecated","affected_versions":">=1.0"},{"fix":"Stay updated with the latest library versions and community discussions. Implement robust error handling (e.g., try-except blocks) in your code.","message":"yfinance is an unofficial library that scrapes data from Yahoo Finance. As such, its functionality is subject to breaking if Yahoo Finance changes its website layout or API endpoints. Issues like cookie reuse or DNS blocking have historically occurred.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Be aware of these time limitations when requesting intraday data. For longer historical periods, use daily or larger intervals.","message":"Intraday data (intervals less than 1 day) has significant limitations: 1-minute data is only available for the last 7 days, and any intraday interval data is only available for the last 60 days. End-of-day data typically has a much longer history.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-05T00:00:00.000Z","next_check":"2026-07-04T00:00:00.000Z"}