imf_reader.sdr.read_exchange_rate

Module to read exchange rate data from the IMF’s Special Drawing Rights (SDR) Valuation dataset.

Read about SDR valuation at: https://www.imf.org/external/np/fin/data/rms_sdrv.aspx

Attributes

BASE_URL

Functions

get_exchange_rates_data()

Read the data from the IMF website

preprocess_data(df)

Preprocess the input DataFrame by splitting columns and setting headers.

extract_exchange_series(df, col_val)

Extract the exchange rate series for the given column value.

extract_dates_series(df)

Extract the dates series from the DataFrame.

parse_data(df, unit_basis)

Parse the data from the IMF website

fetch_exchange_rates(→ pandas.DataFrame)

Fetch the historic SDR exchange rates from the IMF

Module Contents

imf_reader.sdr.read_exchange_rate.BASE_URL = 'https://www.imf.org/external/np/fin/data/rms_sdrv.aspx'
imf_reader.sdr.read_exchange_rate.get_exchange_rates_data()

Read the data from the IMF website

imf_reader.sdr.read_exchange_rate.preprocess_data(df: pandas.DataFrame)

Preprocess the input DataFrame by splitting columns and setting headers.

imf_reader.sdr.read_exchange_rate.extract_exchange_series(df: pandas.DataFrame, col_val: str)

Extract the exchange rate series for the given column value.

imf_reader.sdr.read_exchange_rate.extract_dates_series(df: pandas.DataFrame)

Extract the dates series from the DataFrame.

imf_reader.sdr.read_exchange_rate.parse_data(df: pandas.DataFrame, unit_basis: Literal['SDR', 'USD'])

Parse the data from the IMF website

imf_reader.sdr.read_exchange_rate.fetch_exchange_rates(unit_basis: Literal['SDR', 'USD'] = 'SDR') pandas.DataFrame

Fetch the historic SDR exchange rates from the IMF

The currency value of the SDR is determined by summing the values in U.S. dollars, based on market exchange rates, of a basket of major currencies (the U.S. dollar, Euro, Japanese yen, pound sterling and the Chinese renminbi). The SDR currency value is calculated daily except on IMF holidays, or whenever the IMF is closed for business, or on an ad-hoc basis to facilitate unscheduled IMF operations. The SDR valuation basket is reviewed and adjusted every five years.

Read more at: https://www.imf.org/en/About/Factsheets/Sheets/2023/special-drawing-rights-sdr

Parameters:

unit_basis – The unit basis for the exchange rate. Default is “SDR” i.e. 1 SDR in USD. Other option is “USD” i.e. 1 USD in SDR

Returns:

A DataFrame with the exchange rate data