What is the best and easiest way to create a single dataframe with time series of NAV of funds and close of equities or indexes using a lseg formula such as get_data or get_history ? i can't easily have both in the same dataframe.
thks
Thank you for reaching out to us.
You can use the get_history method in the LSEG Data Library for Pyton to retrieve historical data. For example:
df = ld.get_history(universe=["CRUD.L"], fields=["TR.FundNav","TR.PriceClose"], start="2024-11-01", end="2024-12-03") df
The output is:
The examples are on GitHub. You can use the Data Item Browser tool to search for other fields.
Thank you very much. This is helpful ! How can I do in the case I want to add the following rics to get in the same dataframe the times series : EUR= ; US10YT=RR ?
@Jul
The universe parameter accepts an array of items. For example:
universe=["EUR=","US10YT=RR","IBM.N"]
The fields parameter accepts an arry of fields. For example:
fields=["TR.FundNav","TR.PriceClose"]
You can add other RICs in the universe parameter and add other fields in the fields parameters.
However It returns an error message :
LDError: Backend error. 400 Bad Request Requested universes: ['.SXAP', '.SX7P', 'EUR=', 'US10YT=RR']. Requested fields: ['TR.FUNDNAV', 'TR.PRICECLOSE'].
And if I try to get only EUR= and US10YT=RR and US2YT=RR the error message is the following :
LDError: Unable to collect data for the field 'TR.FundNAV' and some specific identifier(s). Requested universes: ['EUR=', 'US10YT=RR', 'US2YT=RR']. Requested fields: ['TR.FUNDNAV', 'TR.PRICECLOSE']
Everything works well as long as I don't try to get EUR= or US10YT=RR
It sounds like I should use another field, but which one ?
I got this data.
The error is:
[{"code":416,"col":2,"message":"Unable to collect data for the field 'TR.FundNAV' and some specific identifier(s).","row":0},
You can use the Data Item Browser tool to search fields.
Otherwise, you can contact the helpdesk support team via MyAccount and ask for fields that can provide the required data.