Module macrobond_data_api.common.types.start_or_end_point

Classes

class StartOrEndPoint (time: str, mode: CalendarDateMode | None)

Defines a start or endpoint of a data intervall. Use this constructor, or one of the static methods of this class.

Parameters

time : str
  • A year, ex. "2010"
  • A year and month, ex. "2010-05"
  • A full date on the format "2010-05-19"
  • A reference relative the end of the interval
    • +/-n, a number of observations, ex. "-10"
    • +/-nd, a number of calendar days, ex. "-30d"
    • +/-nw, a number of weeks, ex. "-7w"
    • +/-nm, a number of months, ex. "-3m"
    • +/-nq, a number of quarters, ex "-2q"
    • +/-ny, a number of years, ex "-5y"
mode : CalendarDateMode
Defines how the automatic start or end is calculated.

Static methods

def data_in_all_series() ‑> StartOrEndPoint

Create a start or endpoint as the first or last point where thers is data in all series.

def data_in_any_series() ‑> StartOrEndPoint

Create a start or endpoint as the first or last point where thers is data in any series.

def point_in_time(yyyy_or_datetime: int | datetime.datetime, mm: int = None, dd: int = None) ‑> StartOrEndPoint

Create a start or endpoint as a full or partial date.

Parameters

yyyy_or_datetime : Union[int, datetime]
A datetime or a year. If it is a year, the mm and dd parameters will be used too, if specified.
mm : int
An optional month 1-12
dd : int
An optional day 1-31
def relative_to_days(days: int, mode: CalendarDateMode = None) ‑> StartOrEndPoint

Create a start or endpoint as a number of days relative the end of the intervall.

def relative_to_months(months: int, mode: CalendarDateMode = None) ‑> StartOrEndPoint

Create a start or endpoint as a number of months relative the end of the intervall.

def relative_to_observations(observations: int, mode: CalendarDateMode = None) ‑> StartOrEndPoint

Create a start or endpoint as a number of observations relative the end of the intervall.

def relative_to_quarters(quarters: int, mode: CalendarDateMode = None) ‑> StartOrEndPoint

Create a start or endpoint as a number of quarters relative the end of the intervall.

def relative_to_weeks(weeks: int, mode: CalendarDateMode = None) ‑> StartOrEndPoint

Create a start or endpoint as a number of weeks relative the end of the intervall.

def relative_to_years(years: int, mode: CalendarDateMode = None) ‑> StartOrEndPoint

Create a start or endpoint as a number of years relative the end of the intervall.

Instance variables

var mode
var time