FinanceDataReader is a Python library for retrieving various financial data, including stock prices, stock lists for multiple markets (Korea, US, etc.), and macroeconomic data. It currently supports version 0.9.110 and is actively maintained with frequent updates to adapt to changing data sources and improve functionality.
pip install finance-datareaderVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to fetch stock listings for KOSPI and historical daily prices for specific tickers like Samsung Electronics (005930) and Apple (AAPL) using `FinanceDataReader`.
Always validate the returned DataFrame (e.g., check `df.empty`, `df.index.min()`, `df.index.max()`) to ensure the data aligns with expectations. Consider trying alternative data sources if available, or a different library for specific data needs.
Ensure you are using the latest version of `finance-datareader` (`pip install --upgrade finance-datareader`). If an issue persists, check the GitHub issues page for similar reports or open a new one. Consider implementing retry logic for critical data fetching.
For large requests, consider breaking them into smaller chunks or implementing caching. For multiple tickers, explore if the data source supports batch requests (though `FinanceDataReader` typically handles one ticker at a time). Use a local data store if you frequently access the same data.
Double-check the ticker symbol and date range for correctness. Ensure `finance-datareader` is updated to the latest version (`pip install --upgrade finance-datareader`). If the problem persists, the data source may have changed or the data is genuinely unavailable.
Install the library: `pip install finance-datareader`. Ensure the import statement is `import FinanceDataReader as fdr`.
Ensure dates are provided as strings in 'YYYY-MM-DD' format, or as `datetime.date` or `pandas.Timestamp` objects. For example: `fdr.DataReader('005930', '2023-01-01', '2023-12-31')`.