Skip to main content

index

Get data on selected indices over time [Source: Yahoo Finance]

Source Code: [link]

openbb.economy.index(indices: list, interval: str = "1d", start_date: int = None, end_date: int = None, column: str = "Adj Close", returns: bool = False)

Parameters

NameTypeDescriptionDefaultOptional
indiceslistA list of indices to get data. Available indices can be accessed through economy.available_indices().NoneFalse
intervalstrValid intervals: 1m,2m,5m,15m,30m,60m,90m,1h,1d,5d,1wk,1mo,3mo
Intraday data cannot extend last 60 days
1dTrue
start_datestrThe starting date, format "YEAR-MONTH-DAY", i.e. 2010-12-31.NoneTrue
end_datestrThe end date, format "YEAR-MONTH-DAY", i.e. 2020-06-05.NoneTrue
columnstrWhich column to load in, by default "Adjusted Close".Adj CloseTrue
returnsboolFlag to show cumulative returns on indexFalseTrue

Returns

TypeDescription
pd.DataframeDataframe with historical data on selected indices.

Examples

from openbb_terminal.sdk import openbb
openbb.economy.available_indices()
openbb.economy.index(["^GSPC", "sp400"])