Holdings Data#
- morningstar_data.direct.get_holdings(
- investment_ids: List[str],
- date: str | None = None,
- start_date: str | None = None,
- end_date: str | None = None,
Returns holdings for the specified investments and date or date range. If the date is not specified, the function uses the latest portfolio date by default.
- Parameters:
investment_ids (
list
) – A list of investment IDs. The investment ID format is SecId;Universe or just SecId. For example: [“F00000YOOK;FO”,”FOUSA00CFV;FO”] or [“F00000YOOK”,”FOUSA00CFV”].date (
str
, optional) – The portfolio date for which to retrieve data. The format is YYYY-MM-DD. For example, “2020-01-01”. If a date is provided, then the start_date and end_date parameters are ignored. An exception is thrown if start_date or end_date is provided along with date.start_date (
str
, optional) – The start date for retrieving data. The format is YYYY-MM-DD. For example, “2020-01-01”. An exception is thrown if date is provided along with start_date.end_date (
str
, optional) – The end date 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”. An exception is thrown if date is provided along with end_date.
- Returns:
A DataFrame object with holdings data. DataFrame columns include:
investmentId
masterPortfolioId
portfolioDate
holdingId
bondId
name
secId
isin
cusip
weight
shares
marketValue
sharesChanged
currency
ticker
detailHoldingType
- Return type:
DataFrame
- Raises:
ValueErrorException – Raised when the investment_ids parameter is invalid.
Examples
Retrieve holdings for investment “FOUSA00KZH” on “2020-12-31”.
import morningstar_data as md df = md.direct.get_holdings(investment_ids=["FOUSA00KZH"], date="2020-12-31") df
- Output:
investmentId
masterPortfolioId
…
ticker
detailHoldingType
FOUSA00KZH
6079
…
CBRE
EQUITY
FOUSA00KZH
6079
…
GOOGL
EQUITY
…
- morningstar_data.direct.get_holding_dates(
- investment_ids: List[str],
Returns all dates with available holdings data for the given investment.
- Parameters:
investment_ids (
list
) – A list of investment IDs. The investment ID format is SecId;Universe or just SecId. For example: [“F00000YOOK;FO”,”FOUSA00CFV;FO”] or [“F00000YOOK”,”FOUSA00CFV”].- Returns:
A DataFrame object with portfolio date data. DataFrame columns include:
- Return type:
DataFrame
secId
masterPortfolioId
date
suppression
suppressionHoldingNumber
Examples
Retrieve portfolio dates for investment “FOUSA00KZH”.
import morningstar_data as md df = md.direct.get_holding_dates(investment_ids=["FOUSA06JNH"]) df
- Output:
secId
masterPortfolioId
date
suppression
suppressionHoldingNumber
FOUSA06JNH
210311
2021-08-31
False
None
FOUSA06JNH
210311
2021-07-31
False
None
…