Skip to main content

cpi

Get Consumer Price Index (CPI).

Returns either the rescaled index value, or a rate of change (inflation).

Examples

from openbb import obb
obb.economy.cpi(country='japan,china,turkey', provider='fred')
# Use the `transform` parameter to define the reference period for the change in values. Default is YoY.
obb.economy.cpi(country='united_states,united_kingdom', transform='period', provider='oecd')

Parameters

NameTypeDescriptionDefaultOptional
countryUnion[str, List[str]]The country to get data. Multiple items allowed for provider(s): fred, oecd.united_statesTrue
transformLiteral['index', 'yoy', 'period']Transformation of the CPI data. Period represents the change since previous. Defaults to change from one year ago (yoy).yoyTrue
frequencyLiteral['annual', 'quarter', 'monthly']The frequency of the data.monthlyTrue
harmonizedboolIf true, returns harmonized data.FalseTrue
start_dateUnion[date, str]Start date of the data, in YYYY-MM-DD format.NoneTrue
end_dateUnion[date, str]End date of the data, in YYYY-MM-DD format.NoneTrue

Returns

OBBject
results : List[ConsumerPriceIndex]
Serializable results.

provider : Optional[Literal['fred', 'oecd']]
Provider name.

warnings : Optional[List[Warning_]]
List of warnings.

chart : Optional[Chart]
Chart object.

extra : Dict[str, Any]
Extra info.

Data

NameTypeDescription
dateUnion[date, str]The date of the data.
countrystrNone
valuefloatCPI index value or period change.