OpenBB yfinance Extension

raw JSON →
1.6.2 verified Sat May 09 auth: no python

OpenBB Platform extension that provides stock market data from Yahoo Finance via the yfinance library. Version 1.6.2, released monthly.

pip install openbb-yfinance
error ModuleNotFoundError: No module named 'openbb_yfinance'
cause Extension not installed or installed in wrong environment.
fix
Run 'pip install openbb-yfinance' in the same environment as openbb.
error RuntimeError: Provider 'yfinance' is not installed. Please install the corresponding provider package.
cause openbb-yfinance not installed after openbb core.
fix
Install the extension: pip install openbb-yfinance and restart the kernel.
error ValueError: 'symbol' must be a valid ticker with no spaces
cause Invalid ticker symbol format.
fix
Use uppercase ticker without spaces or special characters, e.g. 'AAPL'.
breaking OpenBB v4 changed the import structure. Code written for v3 must be rewritten.
fix Use the new router-based API: obb.equity.price.historical(...) instead of obb.equity.historical(...).
deprecated The 'provider' parameter is no longer accepted in most commands; yfinance is auto-detected.
fix Remove provider='yfinance' from calls. The extension is loaded automatically.
breaking Yahoo Finance data may be delayed or missing due to API restrictions; not suitable for real-time trading.
fix Use with caution for non-critical analysis.

Initialize OpenBB and retrieve historical stock data using the yfinance extension.

from openbb import obb

# Set API keys if needed (not strictly required for yfinance)
# obb.user.preferences.output_type = 'dataframe'

# Fetch historical data for Apple
result = obb.equity.price.historical(
    symbol='AAPL',
    start_date='2024-01-01',
    end_date='2024-12-31'
)
print(result.to_df().head())