How can I use API to authomatically download funds' holdings informations?

Options

Hi everyone, I am a researcher at the Catholic University of Milan, currently working on a project that involves historical holdings data for U.S. actively managed mutual funds. Specifically, I require the full holdings information (not just the top 3 holdings) for all such mutual funds, on a quarterly basis over the past 20 years, if available. I would like to ask whether it is possible to retrieve this data using an API. Given the volume of data involved, I understand that it may not be feasible to extract everything in a single call. I would therefore like to ask if it is possible to build a Python routine to download the data in blocks (e.g., retrieving the full time series for 10 mutual funds at a time) and then append the results automatically—without having to perform the process manually. I have attached a screenshot of the code I have been using so far. Thank you in advance for your support. Best regards, Mema Myftar

Best Answers

Answers

  • MyftarMema
    MyftarMema Newcomer

    Thank you for your reply? Can you please give me an example with a split? and how can I use python to retrieve those data? I have never downloaded python using APIs.
    To conclude, I would like also to ask which entry column should I use to obtain informations that I need.
    This the code I used so far:

    import refinitiv.data as rd

    rd.open_session()

    df = rd.get_data(

        universe = ['LP40215045'],

        fields = [

            'TR.FundName',

            'TR.FundHoldingName(StartNum=1,EndNum=200)',

            'TR.FundHoldingRIC(StartNum=1,EndNum=200)',

            'TR.FdInvestorPctPortfolio(SDate=2021-12-31,EDate=2024-12-31,StartNum=1,EndNum=200,Frq=Q)'

        ]

    )

     display(df)

    df.to_excel('provats.xlsx')


    Best regards,

    Mema Myftar

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    I can run the code. The output looks like this.

    image.png

    You can use the Data Item Browser tool to search for fields and parameters.

    Otherwise, you can contact the Helpdesk support team via LSEG Support and ask for the Excel formula, such as =RDP.Data, that can be used to retrieve the required data.

    Then, we can use the same fields and parameters with the get_data method.

  • MyftarMema
    MyftarMema Newcomer

    Thank you for your support. What software did you use to run the code?

    As you can see from the output, the fund name does not appear in every row—it is only shown once and left blank in subsequent rows. Would it be possible to adjust the code or output structure so that the fund name is repeated in each row for easier processing?

    Additionally, could you please provide an example of how to build a Python routine that splits a large request into smaller blocks, in order to avoid server-side processing timeouts?

    For instance, I would like to retrieve full holdings for multiple mutual funds by querying 10 at a time, and then merge the results programmatically.

    Thank you in advance.

    Best regards,

    Mema Myftar