I and my co-authors are trying to download the details of holdings portfolios of mutual funds. We can download the fund holdings for active funds (like LP40004027-AMG Boston Common Global Impact) by using the python code given below. This code gives the Fund Security Owned Name, Fund Security Owned RIC, Fund Investor Shares Held, Fund Investor Value Held and Fund Investor Percent Portfolio.
Unfortunately, these “field” names given below do not work for inactive bonds such as LP40217756 (LP40217756^G21). However, when I look at the details of this inactive fund on LSEG Workspace I can find the fund holdings details under “Derived Holdings” Heading. Are there any other field names I can use to download these Derived Holdings details for inactive funds?
Thank you very much for your help in advance.
Python Code:
import lseg.data as ld
import pandas as pd
# Open a session (desktop or platform, as appropriate)
ld.open_session() # or ld.open_session(name="desktop.workspace") etc
def get_fund_holdings_lipper(lipper_id: str, report_date: str):
"""
Try to retrieve mutual fund holdings using LDL high-level interface.
Returns a pandas DataFrame or None.
"""
fields = [
"TR.FdSecurityOwnedName",
"TR.FdSecurityOwnedRIC",
"TR.FdInvestorSharesHeld",
"TR.FdInvestorValueHeld",
"TR.FdInvestorPctPortfolio"
]
# Parameters mapping: SDate, EDate or date filters; here we use the same date as start=end
params = {
"SDate": report_date,
"EDate": report_date,
"Frq": "D"
}
# Universe: which “instrument” to query. We use the fund identifier (Lipper ID).
universe = [lipper_id]
df = ld.get_data(universe, fields, params)
if df is None or df.empty:
print("No holdings data returned via get_data for", lipper_id, report_date)
return None
return df
# Example usage
lipper = "LP40004027"
date = "2009-12-31"
df_holdings = get_fund_holdings_lipper(lipper, date)
print(df_holdings)