bcb_fx_rates: Fetch Banco Central do Brasil (BCB) exchange rates

View source: R/bcb.R

bcb_fx_ratesR Documentation

Fetch Banco Central do Brasil (BCB) exchange rates

Description

Retrieve PTAX foreign exchange reference rates from the Banco Central do Brasil Olinda API. The rates are the closing (Fechamento) bid and ask quotations expressed in Brazilian real (BRL) per unit of the foreign currency.

Usage

bcb_fx_rates(currency, start_date, end_date = NULL)

Arguments

currency

(character())
One or more ISO 4217 currency codes (e.g. "USD", c("USD", "EUR")). See bcb_currencies() for the available currencies.

start_date

(Date(1) | character(1))
Start date of the data (e.g., "2024-01-01").

end_date

(NULL | Date(1) | character(1))
End date of the data, in the same format as start_date. If NULL, the start_date is used. Default NULL.

Details

Rates are published only on business days, so weekends and holidays return no rows.

Value

A data.table::data.table() with columns date, currency, bid, and ask.

Source

https://dadosabertos.bcb.gov.br/

See Also

Other data: banxico_data(), bbk_data(), bbk_series(), bcb_data(), bcb_expectations(), bcb_inflation(), bcb_selic(), bcb_top5(), bde_data(), bde_latest(), bdf_codelist(), bdf_data(), bdf_dataset(), bdp_data(), bis_data(), boc_data(), boe_data(), boi_data(), boj_data(), cnb_czeonia(), cnb_data(), cnb_fx_other_rates(), cnb_fx_rates(), cnb_pribor(), ecb_data(), nbp_fx_rates(), nbp_gold(), nob_data(), onb_data(), snb_data(), srb_cross_rates(), srb_data()

Examples



# fetch USD/BRL closing rates
bcb_fx_rates("USD", start_date = "2024-01-01", end_date = "2024-01-31")

# fetch multiple currencies
bcb_fx_rates(c("USD", "EUR"), start_date = "2024-01-01", end_date = "2024-01-31")



bbk documentation built on Aug. 28, 2026, 5:07 p.m.