Portfolio Data#
- morningstar_data.direct.portfolio.get_data(
- portfolio_id: str,
- data_set_id: str | PortfolioDataSet | None = None,
- currency: str | None = None,
- start_date: str | None = None,
- end_date: str | None = None,
- data_point_settings: DataFrame | None = None,
Returns data for the given portfolio. Users will need to specify a portfolio ID and a list of data points.
- Parameters:
portfolio_id (
str
) – A portfolio ID.data_set_id (
str
, optional) – The unique identifier of a portfolio data set. Available data sets can be retrieved using the portfolio data sets function. For example, ‘1’.currency (
str
, optional) – The currency of the data point values, when applicable.start_date (
str
, optional) – The start date of a data range for retrieving data. The format is YYYY-MM-DD. For example, ‘2020-01-01’.end_date (
str
, optional) – The end date of data range for retrieving data. If no value is provided for end_date, current date will be used. The format is YYYY-MM-DD. For example, ‘2020-01-01’.data_point_settings (
DataFrame
, optional) – A DataFrame of data points with all defined settings. Each row represents a data point. Each column is a configurable setting. Users can get this DataFrame by retrieving a data set or data point settings for a given data point ID(s). Users can update setting values in this DataFrame if desired. Additionally, the priority of currency/start_date/end_date in data_point_settings is lower than the priority of the currency/start_date/end_date parameters.
- Returns:
A DataFrame object with portfolio data.
- Return type:
DataFrame
Examples
Get portfolio data based on portfolio ID and data set ID.
import morningstar_data as md df = md.direct.portfolio.get_data(portfolio_id="8c6de08f-a668-4e78-a688-3d809aeb29b7;UA", data_set_id="1") df
- Output:
Name
Base Currency
Portfolio Date
…
Total Ret Annlzd 10 Yr (Year-End)
Total Ret Annlzd 15 Yr (Year-End)
test1
US Dollar
2022-02-28
…
None
None
…