imf_reader.sdr.read_interest_rate ================================= .. py:module:: imf_reader.sdr.read_interest_rate .. autoapi-nested-parse:: Module to read SDR interest and exchange rates from the IMF website Attributes ---------- .. autoapisummary:: imf_reader.sdr.read_interest_rate.BASE_URL Functions --------- .. autoapisummary:: imf_reader.sdr.read_interest_rate.get_interest_rates_data imf_reader.sdr.read_interest_rate.preprocess_data imf_reader.sdr.read_interest_rate._filter_data imf_reader.sdr.read_interest_rate._format_data imf_reader.sdr.read_interest_rate.clean_data imf_reader.sdr.read_interest_rate.fetch_interest_rates Module Contents --------------- .. py:data:: BASE_URL :type: str :value: 'https://www.imf.org/external/np/fin/data/sdr_ir.aspx' .. py:function:: get_interest_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:: _filter_data(df: pandas.DataFrame) -> pandas.DataFrame Filter the DataFrame to separate rows for dates and SDR interest rates. .. py:function:: _format_data(df: pandas.DataFrame) -> pandas.DataFrame Format the filtered DataFrame into a clean DataFrame with interest rates and dates. .. py:function:: clean_data(df: pandas.DataFrame) -> pandas.DataFrame Cleaning/parsing steps for the data. split tab separated value into separate columns, rename columns, assign types, and additional formatting .. py:function:: fetch_interest_rates() -> pandas.DataFrame Fetch the historic SDR interest rates from the IMF The SDR interest rate is based on the sum of the multiplicative products in SDR terms of the currency amounts in the SDR valuation basket, the level of the interest rate on the financial instrument of each component currency in the basket, and the exchange rate of each currency against the SDR. The SDR interest rate for the current week is released on Sunday morning, Washington D.C. time. :returns: A DataFrame with the historical SDR interest rates