能否通过pandas datareader从Yahoo Finance获取历史期权数据及相关指标?
Great question—let's break this down clearly for your research project.
Short Answer on Yahoo Finance + pandas-datareader
No, you can't get 10-year historical options data this way.
Yahoo Finance's public API was overhauled a few years back, and pandas-datareader's yahoo module only supports pulling current, real-time option chain data (like available strikes/expirations for the present day). There is no public access to Yahoo's archived historical options data—you won't find price, volume, or open interest records stretching back a decade here, even with third-party workarounds.
Alternative Solutions for 10-Year Historical Options Data
Here are the most reliable paths to get the data you need, sorted by accessibility and use case:
Interactive Brokers (IB) API
- If you have an IB trading account (individuals can easily sign up), the
ib_insynclibrary (a far more user-friendly wrapper for IB's official API) lets you pull massive amounts of historical options data—including prices, volume, open interest—with 10+ year time spans. - Quick example snippet to get you started:
from ib_insync import IB, Option ib = IB() # Connect to IB's TWS/Gateway (make sure it's running locally) ib.connect('127.0.0.1', 7497, clientId=1) # Define your target option contract (e.g., AAPL call option) option = Option('AAPL', '20240119', 150, 'C', 'SMART') # Pull 10 years of daily historical data bars = ib.reqHistoricalData( option, endDateTime='', durationStr='10 Y', barSizeSetting='1 day', whatToShow='OPTION_PRICE', useRTH=True ) - Pros: Free (with an IB account), comprehensive data; Cons: Requires account setup, minor learning curve for the API.
- If you have an IB trading account (individuals can easily sign up), the
Polygon.io API
- A paid data platform with high-quality historical options datasets that easily cover 10-year timeframes. It includes all the metrics you need (price, volume, open interest) and supports bulk downloads for multiple tickers.
- The free tier offers 5,000 monthly calls for small-scale testing; paid plans (starting at $99/month) unlock full access for large research projects. Use the official
polygon-api-clientPython library to integrate it into your workflow.
Nasdaq Data Link (formerly Quandl)
- This platform hosts a range of options datasets: free ones for major index options (like SPX) and paid subscriptions for full individual stock options histories. All data is reliable and spans decades.
- You can even use pandas-datareader to pull data directly from Nasdaq Data Link once you have an API key.
Academic Library Subscriptions (WRDS/OptionMetrics)
- If you're doing academic research, check your university's library resources. Many institutions subscribe to the Wharton Research Data Services (WRDS), which includes the OptionMetrics dataset—this is the gold standard for historical options research, with granular data stretching back decades, all free for affiliated researchers.
Institutional Terminals (Bloomberg/Reuters Eikon)
- For institutional users, Bloomberg Terminal or Reuters Eikon offer the most comprehensive options data coverage globally, including 10+ years of historical records and advanced metrics. However, these are extremely costly and not feasible for individual researchers.
内容的提问来源于stack exchange,提问作者crawboyd

