Pular para conteúdo

Anbima Data

intraday_ettj()

Retrieves and processes the intraday Brazilian yield curve data from ANBIMA.

This function fetches the most recent intraday yield curve data published by ANBIMA, containing real rates (IPCA-indexed), nominal rates, and implied inflation at various vertices (time points). The curve is published at around 12:30 PM BRT.

Returns:

Type Description
DataFrame

pl.DataFrame: A DataFrame containing the intraday ETTJ data.

DataFrame columns
  • date: Reference date of the yield curve
  • vertex: Time point in business days
  • nominal_rate: Zero-coupon nominal interest rate
  • real_rate: Zero-coupon real interest rate (IPCA-indexed)
  • implied_inflation: Implied inflation rate (break-even inflation)
Note

All rates are expressed in decimal format (e.g., 0.12 for 12%).

Source code in pyield/anbima/ettj_intraday.py
def intraday_ettj() -> pl.DataFrame:
    """
    Retrieves and processes the intraday Brazilian yield curve data from ANBIMA.

    This function fetches the most recent intraday yield curve data published by ANBIMA,
    containing real rates (IPCA-indexed), nominal rates, and implied inflation
    at various vertices (time points). The curve is published at around 12:30 PM BRT.

    Returns:
        pl.DataFrame: A DataFrame containing the intraday ETTJ data.

    DataFrame columns:
        - date: Reference date of the yield curve
        - vertex: Time point in business days
        - nominal_rate: Zero-coupon nominal interest rate
        - real_rate: Zero-coupon real interest rate (IPCA-indexed)
        - implied_inflation: Implied inflation rate (break-even inflation)

    Note:
        All rates are expressed in decimal format (e.g., 0.12 for 12%).
    """
    api_text = _fetch_intraday_text()

    # --- Extração da Tabela 1: PREFIXADOS ---
    data_ref, tabela_pre, tabela_ipca = _extract_date_and_tables(api_text)

    df_pre = _parse_intraday_table(tabela_pre)
    df_pre = df_pre.rename({"D0": "nominal_rate"})

    df_ipca = _parse_intraday_table(tabela_ipca)
    df_ipca = df_ipca.rename({"D0": "real_rate"})

    df = df_pre.join(df_ipca, on="Vertices", how="right")
    df = df.rename({"Vertices": "vertex"})

    df = df.with_columns(
        # convertendo de % para decimal e arredondando
        (pl.col("real_rate") / 100).round(ROUND_DIGITS),
        (pl.col("nominal_rate") / 100).round(ROUND_DIGITS),
        pl.lit(data_ref).alias("date"),
    ).with_columns(
        ((pl.col("nominal_rate") + 1) / (pl.col("real_rate") + 1) - 1)
        .round(ROUND_DIGITS)
        .alias("implied_inflation"),
    )
    column_order = ["date", "vertex", "nominal_rate", "real_rate", "implied_inflation"]
    return df.select(column_order)

last_ettj()

Retrieves and processes the latest Brazilian yield curve data from ANBIMA.

This function fetches the most recent yield curve data published by ANBIMA, containing real rates (IPCA-indexed), nominal rates, and implied inflation at various vertices (time points).

Returns:

Type Description
DataFrame

pl.DataFrame: A DataFrame containing the latest ETTJ data.

DataFrame columns
  • date: Reference date of the yield curve
  • vertex: Time point in business days
  • nominal_rate: Zero-coupon nominal interest rate
  • real_rate: Zero-coupon real interest rate (IPCA-indexed)
  • implied_inflation: Implied inflation rate (break-even inflation)
Note

All rates are expressed in decimal format (e.g., 0.12 for 12%).

Source code in pyield/anbima/ettj_last.py
def last_ettj() -> pl.DataFrame:
    """
    Retrieves and processes the latest Brazilian yield curve data from ANBIMA.

    This function fetches the most recent yield curve data published by ANBIMA,
    containing real rates (IPCA-indexed), nominal rates, and implied inflation
    at various vertices (time points).

    Returns:
        pl.DataFrame: A DataFrame containing the latest ETTJ data.

    DataFrame columns:
        - date: Reference date of the yield curve
        - vertex: Time point in business days
        - nominal_rate: Zero-coupon nominal interest rate
        - real_rate: Zero-coupon real interest rate (IPCA-indexed)
        - implied_inflation: Implied inflation rate (break-even inflation)

    Note:
        All rates are expressed in decimal format (e.g., 0.12 for 12%).
    """
    text = _get_last_content_text()
    reference_date = _get_reference_date(text)
    text = _filter_ettf_text(text)
    df = _convert_text_to_df(text, reference_date)
    df = _process_df(df)
    return df

last_ima(ima_type=None)

Fetch and process the last IMA market data available from ANBIMA.

This function processes the data into a structured DataFrame. It handles conversion of date formats, renames columns to English, and converts certain numeric columns to integer types. In the event of an error during data fetching or processing, an empty DataFrame is returned.

Parameters:

Name Type Description Default
ima_type str

Type of IMA index to filter the data. If None, all IMA indexes are returned. Defaults to None.

None

Returns:

Type Description
DataFrame

pl.DataFrame: A DataFrame containing the IMA data.

DataFrame columns
  • Date: reference date of the data.
  • IMAType: type of IMA index.
  • BondType: type of bond.
  • Maturity: bond maturity date.
  • SelicCode: bond code in the SELIC system.
  • ISIN: international Securities Identification Number.
  • BDToMat: business days to maturity.
  • Duration: duration of the bond in business years (252 days/year).
  • IndicativeRate: indicative rate.
  • Price: bond price.
  • InterestPrice: interest price.
  • DV01: DV01 in R$.
  • PMR: average repurchase term.
  • Weight: weight of the bond in the index.
  • Convexity: convexity of the bond.
  • TheoreticalQuantity: theoretical quantity.
  • NumberOfOperations: number of operations.
  • NegotiatedQuantity: negotiated quantity.
  • NegotiatedValue: negotiated value.
  • MarketQuantity: market quantity.
  • MarketDV01: market DV01 in R$.
  • MarketValue: market value in R$.

Raises:

Type Description
Exception

Logs error and returns an empty DataFrame if any error occurs during fetching or processing.

Source code in pyield/anbima/ima.py
def last_ima(ima_type: ima_types | None = None) -> pl.DataFrame:
    """
    Fetch and process the last IMA market data available from ANBIMA.

    This function processes the data into a structured DataFrame.
    It handles conversion of date formats, renames columns to English, and converts
    certain numeric columns to integer types. In the event of an error during data
    fetching or processing, an empty DataFrame is returned.

    Args:
        ima_type (str, optional): Type of IMA index to filter the data. If None, all
            IMA indexes are returned. Defaults to None.

    Returns:
        pl.DataFrame: A DataFrame containing the IMA data.

    DataFrame columns:
        - Date: reference date of the data.
        - IMAType: type of IMA index.
        - BondType: type of bond.
        - Maturity: bond maturity date.
        - SelicCode: bond code in the SELIC system.
        - ISIN: international Securities Identification Number.
        - BDToMat: business days to maturity.
        - Duration: duration of the bond in business years (252 days/year).
        - IndicativeRate: indicative rate.
        - Price: bond price.
        - InterestPrice: interest price.
        - DV01: DV01 in R$.
        - PMR: average repurchase term.
        - Weight: weight of the bond in the index.
        - Convexity: convexity of the bond.
        - TheoreticalQuantity: theoretical quantity.
        - NumberOfOperations: number of operations.
        - NegotiatedQuantity: negotiated quantity.
        - NegotiatedValue: negotiated value.
        - MarketQuantity: market quantity.
        - MarketDV01: market DV01 in R$.
        - MarketValue: market value in R$.

    Raises:
        Exception: Logs error and returns an empty DataFrame if any error occurs during
            fetching or processing.
    """
    try:
        ima_text = _fetch_last_ima_text()
        df = _parse_df(ima_text)
        df = _process_df(df)
        df = _reorder_columns(df)
        if ima_type is not None:
            df = df.filter(pl.col("IMAType") == ima_type)
        df = df.sort(["IMAType", "BondType", "Maturity"])
        return df
    except Exception as e:
        logger.exception(f"Error fetching or processing the last IMA data: {e}")
        return pl.DataFrame()

tpf_data(date, bond_type=None, fetch_from_source=False)

Recupera os dados do mercado secundário de TPF da ANBIMA.

Esta função busca taxas indicativas e outros dados de títulos públicos brasileiros. A obtenção dos dados segue uma hierarquia de fontes para otimizar o desempenho e o acesso.

Parameters:

Name Type Description Default
date DateScalar

A data de referência para os dados (ex: '2024-06-14').

required
bond_type str

Filtra os resultados por um tipo de título específico (ex: 'LTN', 'NTN-B'). Por padrão, retorna todos os tipos.

None
fetch_from_source bool

Se True, força a função a ignorar o cache e buscar os dados diretamente da fonte (ANBIMA). Padrão é False.

False

Returns:

Type Description
DataFrame

pl.DataFrame: Um DataFrame contendo os dados solicitados. Retorna um DataFrame vazio se não houver dados para a data especificada (ex: finais de semana, feriados ou datas futuras).

Examples:

>>> from pyield import anbima
>>> anbima.tpf_data(date="22-08-2025")
shape: (49, 14)
┌───────────────┬──────────┬───────────┬───────────────┬───┬───────────┬───────────┬────────────────┬──────────┐
│ ReferenceDate ┆ BondType ┆ SelicCode ┆ IssueBaseDate ┆ … ┆ BidRate   ┆ AskRate   ┆ IndicativeRate ┆ DIRate   │
│ ---           ┆ ---      ┆ ---       ┆ ---           ┆   ┆ ---       ┆ ---       ┆ ---            ┆ ---      │
│ date          ┆ str      ┆ i64       ┆ date          ┆   ┆ f64       ┆ f64       ┆ f64            ┆ f64      │
╞═══════════════╪══════════╪═══════════╪═══════════════╪═══╪═══════════╪═══════════╪════════════════╪══════════╡
│ 2025-08-22    ┆ LFT      ┆ 210100    ┆ 2000-07-01    ┆ … ┆ 0.000198  ┆ 0.0001    ┆ 0.000165       ┆ 0.14906  │
│ 2025-08-22    ┆ LFT      ┆ 210100    ┆ 2000-07-01    ┆ … ┆ -0.000053 ┆ -0.000156 ┆ -0.000116      ┆ 0.14843  │
│ 2025-08-22    ┆ LFT      ┆ 210100    ┆ 2000-07-01    ┆ … ┆ -0.000053 ┆ -0.000143 ┆ -0.000107      ┆ 0.1436   │
│ 2025-08-22    ┆ LFT      ┆ 210100    ┆ 2000-07-01    ┆ … ┆ 0.000309  ┆ 0.000292  ┆ 0.000302       ┆ 0.138189 │
│ 2025-08-22    ┆ LFT      ┆ 210100    ┆ 2000-07-01    ┆ … ┆ 0.000421  ┆ 0.000399  ┆ 0.000411       ┆ 0.134548 │
│ …             ┆ …        ┆ …         ┆ …             ┆ … ┆ …         ┆ …         ┆ …              ┆ …        │
│ 2025-08-22    ┆ NTN-F    ┆ 950199    ┆ 2016-01-15    ┆ … ┆ 0.139379  ┆ 0.139163  ┆ 0.139268       ┆ 0.13959  │
│ 2025-08-22    ┆ NTN-F    ┆ 950199    ┆ 2018-01-05    ┆ … ┆ 0.134252  ┆ 0.134018  ┆ 0.13414        ┆ 0.1327   │
│ 2025-08-22    ┆ NTN-F    ┆ 950199    ┆ 2020-01-10    ┆ … ┆ 0.13846   ┆ 0.138355  ┆ 0.13841        ┆ 0.13626  │
│ 2025-08-22    ┆ NTN-F    ┆ 950199    ┆ 2022-01-07    ┆ … ┆ 0.139503  ┆ 0.139321  ┆ 0.139398       ┆ 0.13807  │
│ 2025-08-22    ┆ NTN-F    ┆ 950199    ┆ 2024-01-05    ┆ … ┆ 0.140673  ┆ 0.140566  ┆ 0.140633       ┆ 0.13845  │
└───────────────┴──────────┴───────────┴───────────────┴───┴───────────┴───────────┴────────────────┴──────────┘
Data columns
  • BondType: Tipo do título público (e.g., 'LTN', 'NTN-B').
  • ReferenceDate: Data de referência dos dados.
  • SelicCode: Código do título no SELIC.
  • IssueBaseDate: Data base ou de emissão do título.
  • MaturityDate: Data de vencimento do título.
  • BDToMat: Número de dias úteis entre a data de referência e o vencimento.
  • Duration: Macaulay Duration do título em anos.
  • DV01: Variação financeira no preço do título (em BRL) para uma mudança de 1 basis point (0,01%) na taxa de juros.
  • DV01USD: O mesmo que DV01, mas convertido para USD pela PTAX do dia.
  • Price: Preço Unitário (PU) do título na data de referência.
  • BidRate: Taxa de compra em formato decimal (e.g., 0.10 para 10%).
  • AskRate: Taxa de venda em formato decimal.
  • IndicativeRate: Taxa indicativa em formato decimal.
  • DIRate: Taxa DI interpolada (flatforward) no vencimento do título.
  • StdDev: Desvio padrão da taxa indicativa.
  • LowerBoundRateD0: Limite inferior do intervalo indicativo para D+0.
  • UpperBoundRateD0: Limite superior do intervalo indicativo para D+0.
  • LowerBoundRateD1: Limite inferior do intervalo indicativo para D+1.
  • UpperBoundRateD1: Limite superior do intervalo indicativo para D+1.
  • Criteria: Critério utilizado pela ANBIMA para o cálculo.
Notes

A fonte dos dados segue a seguinte hierarquia:

  1. Cache Local (Padrão): Fornece acesso rápido a dados históricos desde 01/01/2020. É utilizado por padrão (fetch_from_source=False).
  2. Site Público da ANBIMA: Acessado quando fetch_from_source=True, disponibiliza os dados dos últimos 5 dias úteis.
  3. Rede RTM da ANBIMA: Acessada quando fetch_from_source=True para datas com mais de 5 dias úteis. O acesso ao histórico completo requer uma conexão à rede RTM. Sem ela, a consulta para datas antigas retornará um DataFrame vazio.
Source code in pyield/anbima/tpf.py
def tpf_data(
    date: DateScalar,
    bond_type: BOND_TYPES | None = None,
    fetch_from_source: bool = False,
) -> pl.DataFrame:
    """Recupera os dados do mercado secundário de TPF da ANBIMA.

    Esta função busca taxas indicativas e outros dados de títulos públicos
    brasileiros. A obtenção dos dados segue uma hierarquia de fontes para
    otimizar o desempenho e o acesso.

    Args:
        date (DateScalar): A data de referência para os dados (ex: '2024-06-14').
        bond_type (str, optional): Filtra os resultados por um tipo de título
            específico (ex: 'LTN', 'NTN-B'). Por padrão, retorna todos os tipos.
        fetch_from_source (bool, optional): Se True, força a função a ignorar o
            cache e buscar os dados diretamente da fonte (ANBIMA).
            Padrão é False.

    Returns:
        pl.DataFrame: Um DataFrame contendo os dados solicitados.
            Retorna um DataFrame vazio se não houver dados para a data especificada (ex:
            finais de semana, feriados ou datas futuras).

    Examples:
        >>> from pyield import anbima
        >>> anbima.tpf_data(date="22-08-2025")
        shape: (49, 14)
        ┌───────────────┬──────────┬───────────┬───────────────┬───┬───────────┬───────────┬────────────────┬──────────┐
        │ ReferenceDate ┆ BondType ┆ SelicCode ┆ IssueBaseDate ┆ … ┆ BidRate   ┆ AskRate   ┆ IndicativeRate ┆ DIRate   │
        │ ---           ┆ ---      ┆ ---       ┆ ---           ┆   ┆ ---       ┆ ---       ┆ ---            ┆ ---      │
        │ date          ┆ str      ┆ i64       ┆ date          ┆   ┆ f64       ┆ f64       ┆ f64            ┆ f64      │
        ╞═══════════════╪══════════╪═══════════╪═══════════════╪═══╪═══════════╪═══════════╪════════════════╪══════════╡
        │ 2025-08-22    ┆ LFT      ┆ 210100    ┆ 2000-07-01    ┆ … ┆ 0.000198  ┆ 0.0001    ┆ 0.000165       ┆ 0.14906  │
        │ 2025-08-22    ┆ LFT      ┆ 210100    ┆ 2000-07-01    ┆ … ┆ -0.000053 ┆ -0.000156 ┆ -0.000116      ┆ 0.14843  │
        │ 2025-08-22    ┆ LFT      ┆ 210100    ┆ 2000-07-01    ┆ … ┆ -0.000053 ┆ -0.000143 ┆ -0.000107      ┆ 0.1436   │
        │ 2025-08-22    ┆ LFT      ┆ 210100    ┆ 2000-07-01    ┆ … ┆ 0.000309  ┆ 0.000292  ┆ 0.000302       ┆ 0.138189 │
        │ 2025-08-22    ┆ LFT      ┆ 210100    ┆ 2000-07-01    ┆ … ┆ 0.000421  ┆ 0.000399  ┆ 0.000411       ┆ 0.134548 │
        │ …             ┆ …        ┆ …         ┆ …             ┆ … ┆ …         ┆ …         ┆ …              ┆ …        │
        │ 2025-08-22    ┆ NTN-F    ┆ 950199    ┆ 2016-01-15    ┆ … ┆ 0.139379  ┆ 0.139163  ┆ 0.139268       ┆ 0.13959  │
        │ 2025-08-22    ┆ NTN-F    ┆ 950199    ┆ 2018-01-05    ┆ … ┆ 0.134252  ┆ 0.134018  ┆ 0.13414        ┆ 0.1327   │
        │ 2025-08-22    ┆ NTN-F    ┆ 950199    ┆ 2020-01-10    ┆ … ┆ 0.13846   ┆ 0.138355  ┆ 0.13841        ┆ 0.13626  │
        │ 2025-08-22    ┆ NTN-F    ┆ 950199    ┆ 2022-01-07    ┆ … ┆ 0.139503  ┆ 0.139321  ┆ 0.139398       ┆ 0.13807  │
        │ 2025-08-22    ┆ NTN-F    ┆ 950199    ┆ 2024-01-05    ┆ … ┆ 0.140673  ┆ 0.140566  ┆ 0.140633       ┆ 0.13845  │
        └───────────────┴──────────┴───────────┴───────────────┴───┴───────────┴───────────┴────────────────┴──────────┘

    Data columns:
        - BondType: Tipo do título público (e.g., 'LTN', 'NTN-B').
        - ReferenceDate: Data de referência dos dados.
        - SelicCode: Código do título no SELIC.
        - IssueBaseDate: Data base ou de emissão do título.
        - MaturityDate: Data de vencimento do título.
        - BDToMat: Número de dias úteis entre a data de referência e o vencimento.
        - Duration: Macaulay Duration do título em anos.
        - DV01: Variação financeira no preço do título (em BRL) para uma
            mudança de 1 basis point (0,01%) na taxa de juros.
        - DV01USD: O mesmo que DV01, mas convertido para USD pela PTAX do dia.
        - Price: Preço Unitário (PU) do título na data de referência.
        - BidRate: Taxa de compra em formato decimal (e.g., 0.10 para 10%).
        - AskRate: Taxa de venda em formato decimal.
        - IndicativeRate: Taxa indicativa em formato decimal.
        - DIRate: Taxa DI interpolada (flatforward) no vencimento do título.
        - StdDev: Desvio padrão da taxa indicativa.
        - LowerBoundRateD0: Limite inferior do intervalo indicativo para D+0.
        - UpperBoundRateD0: Limite superior do intervalo indicativo para D+0.
        - LowerBoundRateD1: Limite inferior do intervalo indicativo para D+1.
        - UpperBoundRateD1: Limite superior do intervalo indicativo para D+1.
        - Criteria: Critério utilizado pela ANBIMA para o cálculo.

    Notes:
        A fonte dos dados segue a seguinte hierarquia:

        1.  **Cache Local (Padrão):** Fornece acesso rápido a dados históricos
            desde 01/01/2020. É utilizado por padrão (`fetch_from_source=False`).
        2.  **Site Público da ANBIMA:** Acessado quando `fetch_from_source=True`,
            disponibiliza os dados dos últimos 5 dias úteis.
        3.  **Rede RTM da ANBIMA:** Acessada quando `fetch_from_source=True` para
            datas com mais de 5 dias úteis. O acesso ao histórico completo
            requer uma conexão à rede RTM. Sem ela, a consulta para datas
            antigas retornará um DataFrame vazio.
    """  # noqa
    if has_null_args(date):
        return pl.DataFrame()
    date = convert_dates(date)
    _validate_not_future_date(date)

    if fetch_from_source:
        # Try to fetch the data directly from the source (ANBIMA)
        df = _fetch_tpf_data(date)
    else:
        # Otherwise, get the data from the local cache
        df = get_cached_dataset("tpf").filter(pl.col("ReferenceDate") == date)

    if df.is_empty():
        return pl.DataFrame()

    if bond_type:
        norm_bond_type = _bond_type_mapping(bond_type)
        df = df.filter(pl.col("BondType").is_in(norm_bond_type))

    return df.sort(["ReferenceDate", "BondType", "MaturityDate"])

tpf_difusao(data_referencia)

Obtém a TPF Difusão da Anbima para uma data de referência específica.

Parameters:

Name Type Description Default
data_referencia str | date | datetime

Data de referência (ex: "DD/MM/AAAA").

required

Returns:

Type Description
DataFrame

pl.DataFrame: DataFrame com os dados. Retorna um DataFrame vazio se não houver dados ou em caso de erro.

Output Columns
  • data_hora_referencia (datetime): Data e hora de referência da taxa.
  • provedor (string): Provedor dos dados.
  • titulo (string): Nome do título (ex: LFT, LTN).
  • data_vencimento (date): Data de vencimento do título.
  • codigo_isin (string): Código ISIN do título.
  • dias_uteis (int): Dias úteis entre a data de referência e o vencimento.
  • taxa_indicativa_anterior (float): Taxa indicativa de fechamento D-1 (decimal).
  • taxa_venda (float): Taxa de oferta de venda (Ask rate) (decimal).
  • taxa_compra (float): Taxa de oferta de compra (Bid rate) (decimal).
  • taxa_media (float): Média entre a taxa de compra e venda (decimal).
  • taxa_ultima (float): Última taxa negociada (decimal).
Source code in pyield/anbima/difusao.py
def tpf_difusao(data_referencia: DateScalar) -> pl.DataFrame:
    """
    Obtém a TPF Difusão da Anbima para uma data de referência específica.

    Args:
        data_referencia (str | dt.date | dt.datetime):
            Data de referência (ex: "DD/MM/AAAA").

    Returns:
        pl.DataFrame: DataFrame com os dados. Retorna um DataFrame vazio se
            não houver dados ou em caso de erro.

    Output Columns:
        * data_hora_referencia (datetime): Data e hora de referência da taxa.
        * provedor (string): Provedor dos dados.
        * titulo (string): Nome do título (ex: LFT, LTN).
        * data_vencimento (date): Data de vencimento do título.
        * codigo_isin (string): Código ISIN do título.
        * dias_uteis (int): Dias úteis entre a data de referência e o vencimento.
        * taxa_indicativa_anterior (float): Taxa indicativa de fechamento D-1 (decimal).
        * taxa_venda (float): Taxa de oferta de venda (Ask rate) (decimal).
        * taxa_compra (float): Taxa de oferta de compra (Bid rate) (decimal).
        * taxa_media (float): Média entre a taxa de compra e venda (decimal).
        * taxa_ultima (float): Última taxa negociada (decimal).
    """
    if has_null_args(data_referencia):
        logger.warning("Nenhuma data fornecida. Retornando DataFrame vazio.")
        return pl.DataFrame()
    data_str = cv.convert_dates(data_referencia)
    csv_data = _fetch_url_data(data_str)

    if csv_data is None:
        logger.warning("Nenhum dado foi retornado para a data '%s'.", data_str)
        return pl.DataFrame()

    try:
        df = _process_csv_data(csv_data)
        return df
    except Exception as e:
        logger.error("Falha ao processar o CSV para a data '%s': %s", data_str, e)
        return pl.DataFrame()

tpf_maturities(date, bond_type)

Retrieve existing maturity dates for a given bond type on a specific date.

Parameters:

Name Type Description Default
date DateScalar

The reference date for maturity dates.

required
bond_type str

The bond type to filter by (e.g., 'PRE' for both 'LTN' and 'NTN-F', or specify 'LTN' or 'NTN-F' directly).

required

Returns:

Type Description
Series

pl.Series: A Series containing unique maturity dates for the specified bond type(s).

Examples:

>>> from pyield import anbima
>>> anbima.tpf_maturities(date="22-08-2025", bond_type="PRE")
shape: (18,)
Series: 'MaturityDate' [date]
[
    2025-10-01
    2026-01-01
    2026-04-01
    2026-07-01
    2026-10-01

    2030-01-01
    2031-01-01
    2032-01-01
    2033-01-01
    2035-01-01
]
Source code in pyield/anbima/tpf.py
def tpf_maturities(
    date: DateScalar,
    bond_type: str,
) -> pl.Series:
    """Retrieve existing maturity dates for a given bond type on a specific date.

    Args:
        date (DateScalar): The reference date for maturity dates.
        bond_type (str): The bond type to filter by (e.g., 'PRE' for both 'LTN'
            and 'NTN-F', or specify 'LTN' or 'NTN-F' directly).

    Returns:
        pl.Series: A Series containing unique maturity dates for the
            specified bond type(s).

    Examples:
        >>> from pyield import anbima
        >>> anbima.tpf_maturities(date="22-08-2025", bond_type="PRE")
        shape: (18,)
        Series: 'MaturityDate' [date]
        [
            2025-10-01
            2026-01-01
            2026-04-01
            2026-07-01
            2026-10-01

            2030-01-01
            2031-01-01
            2032-01-01
            2033-01-01
            2035-01-01
        ]

    """
    return tpf_data(date, bond_type).get_column("MaturityDate").unique().sort()