okama.Indicator

class Indicator(symbol='USA_CAPE10.RATIO', first_date=None, last_date=None)

Bases: MacroABC

Macroeconomic indicators and ratios.

Parameters:
symbol: str

Symbol is unique series of letters with namespace after dot (USA_CAPE10.RATIO).

first_datestr, default None

First date of the values time series (2020-01).

last_datestr, default None

Last date of the values time series (2022-03).

Methods & Attributes

describe([years])

Generate descriptive statistics for YTD and given periods. Statistics includes: - arithmetic mean - median - max and min values.

set_values_monthly(date, value)

Set monthly value for the past or future date.

values_monthly

Return values time series historical monthly data.

describe(years=(1, 5, 10))

Generate descriptive statistics for YTD and given periods. Statistics includes:

  • arithmetic mean

  • median

  • max and min values

Parameters:
yearstuple of (int,), default (1, 5, 10)

List of periods for the statistics.

Returns:
DataFrame

Table of descriptive statistics for a list of assets.

set_values_monthly(date, value)

Set monthly value for the past or future date.

The date should be in month period format (“2023-12”). T The result stored only in the class instance. It can be used to analyze inflation with forecast or corrected data.

Examples

>>> infl = ok.Inflation('USD.INFL', last_date='2022-04')
>>> infl.values_monthly.tail()  # last 5 months statistics
date
2021-12    0.0031
2022-01    0.0084
2022-02    0.0091
2022-03    0.0134
2022-04    0.0056
Freq: M, Name: USD.INFL, dtype: float64
>>> infl.set_values_monthly(date='2024-05', value=0.09)  # set forecasted inflation value
>>> infl.values_monthly.tail()  # check the statistics again (May data is available now)
date
2022-01    0.0084
2022-02    0.0091
2022-03    0.0134
2022-04    0.0056
2024-05    0.0900
Freq: M, Name: USD.INFL, dtype: float64
property values_monthly

Return values time series historical monthly data.

Returns:
Series

Time series of values historical data (monthly).