imf_reader.sdr.read_announcements

Module to get SDR data from the IMF website

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

Attributes

BASE_URL

MAIN_PAGE_URL

Functions

read_tsv(→ pandas.DataFrame)

Read a tsv file from url and return a dataframe

clean_df(→ pandas.DataFrame)

Clean the SDR dataframe

format_date(→ str)

Return a date as year-month-day where day is the last day in the month

get_holdings_and_allocations_data(year, month)

Get sdr allocations and holdings data for a given month and year

fetch_latest_allocations_holdings_date(→ tuple[int, int])

Get the latest available SDR allocation holdings date.

fetch_allocations_holdings(→ pandas.DataFrame)

Fetch SDR holdings and allocations data for a given date. If date is not specified, it fetches data for the latest date

Module Contents

imf_reader.sdr.read_announcements.BASE_URL = 'https://www.imf.org/external/np/fin/tad/'
imf_reader.sdr.read_announcements.MAIN_PAGE_URL = 'https://www.imf.org/external/np/fin/tad/extsdr1.aspx'
imf_reader.sdr.read_announcements.read_tsv(url: str) pandas.DataFrame

Read a tsv file from url and return a dataframe

imf_reader.sdr.read_announcements.clean_df(df: pandas.DataFrame) pandas.DataFrame

Clean the SDR dataframe

imf_reader.sdr.read_announcements.format_date(month: int, year: int) str

Return a date as year-month-day where day is the last day in the month

imf_reader.sdr.read_announcements.get_holdings_and_allocations_data(year: int, month: int)

Get sdr allocations and holdings data for a given month and year

imf_reader.sdr.read_announcements.fetch_latest_allocations_holdings_date() tuple[int, int]

Get the latest available SDR allocation holdings date. :returns: A tuple containing the year and month of the latest SDR data. :rtype: tuple[int, int]

imf_reader.sdr.read_announcements.fetch_allocations_holdings(date: tuple[int, int] | None = None) pandas.DataFrame

Fetch SDR holdings and allocations data for a given date. If date is not specified, it fetches data for the latest date

Parameters:
  • date – tuple[int, int]. The year and month to get allocations and holdings data for. e.g. (2024, 11) for November 2024.

  • None (If)

  • fetched. (the latest announcements released are)

Returns:

A dataframe with the SDR allocations and holdings data