question

Upvotes
1 0 0 0

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.

#technologypython apifilterdownload-file
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
27.2k 65 17 14

Hello @lei.chen6

Thank you for reaching out to us. Please check my colleague's answer on this Retrieve all available fields in rd.content.search old post that might help you.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Thanks! I'll take a look
Upvotes
85.2k 290 53 77

@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
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Thank you so much for your kind suggestion. I'll try it.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.