export the daily valuation of 40 portfolios since inception in Excel using API

I couldn't get exporting portfolio list through API with received following guide on this. Can you please help me with that or instruct me?

,, The only option now to get daily returns for a portfolio since inception would be using the PAM API in a multi-step process. First, run a request for each portfolio using the API method /user-data/portfolio-management/v1/portfolio-analytics/return-statistics. 40 individual requests would have to be run for 40 portfolios. For each portfolio you would then need to take the output and transfer it to Excel. This transfer can be done in one of two ways: 1. Saved as a file in JSON format. You would then need to extract the data from each file into Excel using Power Query under Data | Get Data. or, 2. Run the requests in API Playground and copy and paste from the table output rendered in API Playground into Excel. The copy and paste method is probably easier for anyone not familiar with Power Query."

Best Answer

  • nick.zincone
    Answer ✓

    Hi @damian.dardzinski

    Have you seen the article that utilizes the PAM APIs?

    Enhancing Portfolio Visualization: Exploring APIs with Python and Jupyter | Devportal (lseg.com)

    The article, and the associated source code, greatly simplify the action of retrieving Portfolio Analytics via a convenient package included within the source code called 'pam' that was developed for the article but can be used in any PAM project. In that article, there is a convenient function that does provide the ability to pull down statistics for multiple portfolios:

    1724708754228.png

    And this call captures the entire result set within a single dataframe that looks something like this:

    1724708992737.png

    And from here, you can export to Excel with a single call:

    df.to_excel("output.xlsx")