imf_reader.sdr.read_exchange_rate ================================= .. py:module:: imf_reader.sdr.read_exchange_rate .. autoapi-nested-parse:: 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 ---------- .. autoapisummary:: imf_reader.sdr.read_exchange_rate.BASE_URL Functions --------- .. autoapisummary:: imf_reader.sdr.read_exchange_rate.get_exchange_rates_data imf_reader.sdr.read_exchange_rate.preprocess_data imf_reader.sdr.read_exchange_rate.extract_exchange_series imf_reader.sdr.read_exchange_rate.extract_dates_series imf_reader.sdr.read_exchange_rate.parse_data imf_reader.sdr.read_exchange_rate.fetch_exchange_rates Module Contents --------------- .. py:data:: BASE_URL :value: 'https://www.imf.org/external/np/fin/data/rms_sdrv.aspx' .. py:function:: get_exchange_rates_data() Read the data from the IMF website .. py:function:: preprocess_data(df: pandas.DataFrame) Preprocess the input DataFrame by splitting columns and setting headers. .. py:function:: extract_exchange_series(df: pandas.DataFrame, col_val: str) Extract the exchange rate series for the given column value. .. py:function:: extract_dates_series(df: pandas.DataFrame) Extract the dates series from the DataFrame. .. py:function:: parse_data(df: pandas.DataFrame, unit_basis: Literal['SDR', 'USD']) Parse the data from the IMF website .. py:function:: 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 :param 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