How to get all fields from MUNICIPAL_INSTRUMENTS through refinitiv.data API

Hi all,

I'm currently using the following code through refinitiv.data API to download data from Views.MUNICIPAL_INSTRUMENTS:

rd.discovery.search(view=search.Views.MUNICIPAL_INSTRUMENTS, select = "IssuerName, MaturityDate, IssueDate, MuniState, CUSIP, ISIN, AssetType, RatingType, SPRating, MoodysRating", top = 20)

However, since this dataset has more than 700 fields, and I was asked to download all the fields to check which ones we need, is there any way to modify the code so that I can download all the fields?

I've tried something like select = "all" but it doesn't work.

Best Answer

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    Answer ✓

    @lei.chen6

    You can the search.metadata to get all fields in the MUNICIPAL_INSTRUMENTS view. Then, create a string that contains all fields from the response.data.df, as shown below.

    response = search.metadata.Definition(
        view = search.Views.MUNICIPAL_INSTRUMENTS # Required parameter
    ).get_data()

    fields = ",".join(response.data.df.reset_index()["level_0"].to_list())
    df = rd.discovery.search(view=search.Views.MUNICIPAL_INSTRUMENTS, select = fields, top = 20)
    df

Answers