Holdings Data#
- morningstar_data.direct.get_holdings(
- investments: List[str] | str | Dict[str, Any] | None = None,
- date: str | None = None,
- start_date: str | None = None,
- end_date: str | None = None,
- investment_ids: List[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:
investments (
Union
, required) –Defines the investments to fetch. Input can be:
Investment IDs (
list
, optional): Investment identifiers, in the format of SecId;Universe or just SecId. E.g., [“F00000YOOK;FO”,”FOUSA00CFV;FO”] or [“F00000YOOK”,”FOUSA00CFV”]. Use the investments function to discover identifiers.Investment List ID (
str
, optional): Saved investment list in Morningstar Direct. Currently, this function does not support lists that combine investments and user-created portfolios. Use the get_investment_lists function to discover saved lists.Search Criteria ID (
str
, optional): Saved search criteria in Morningstar Direct. Use the get_search_criteria function to discover saved search criteria.Search Criteria Condition (
dict
, optional): Search criteria definition. See details in the Reference section below or use the get_search_criteria_conditions function to discover the definition of a saved search criteria.
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.investment_ids (
list
) – DEPRECATED, 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 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 investments parameter is invalid.
Examples
Retrieve holdings for investment “FOUSA00KZH” on “2020-12-31”.
import morningstar_data as md df = md.direct.get_holdings(investments=["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
…