Skip to content

IpcEndpoint

cl_forge.cmf.IpcEndpoint dataclass

IpcEndpoint(api_key: str)

Bases: CmfEndpoint[IpcRecord]

Client for the CMF IPC (Índice de Precios al Consumidor) endpoints.

Parameters:

Name Type Description Default
api_key str

CMF API key.

required
Source code in src/cl_forge/core/endpoints.py
def __init__(self, api_key: str) -> None:
    """
    Initialize the IPC endpoint client.

    Parameters
    ----------
    api_key : str
        CMF API key.
    """
    super().__init__(api_key, "/ipc", IpcRecord, "IPCs")

current

current() -> IpcRecord

Get the latest available IPC value.

Returns:

Type Description
IpcRecord

The latest IPC record.

Source code in src/cl_forge/core/endpoints.py
def current(self) -> IpcRecord:
    """
    Get the latest available IPC value.

    Returns
    -------
    IpcRecord
        The latest IPC record.
    """
    return super().current()

year

year(year: int | None = None) -> list[IpcRecord]

Get the IPC values for a given year.

Parameters:

Name Type Description Default
year int | None

The year for which to retrieve IPC values. If None, defaults to the current year.

None

Returns:

Type Description
list[IpcRecord]

A list of IPC records for the specified year.

Source code in src/cl_forge/core/endpoints.py
def year(self, year: int | None = None) -> list[IpcRecord]:
    """
    Get the IPC values for a given year.

    Parameters
    ----------
    year : int | None
        The year for which to retrieve IPC values. If None, defaults to the
        current year.

    Returns
    -------
    list[IpcRecord]
        A list of IPC records for the specified year.
    """
    return super().year(year)