Asset Flow Data#
- morningstar_data.direct.get_asset_flow(
- market_id: str,
- data_point_settings: DataFrame,
- investments: List[str] | str | Dict[str, Any] | None = None,
- dry_run: bool | None = False,
Get asset flow data for a market of investments or specific investments within a market
- Parameters:
market_id (
str
) – A numeric code representing a broad market of investments. For example, the code for “US Open-end & ETF ex MM ex FoF” is “5”. Use the get_asset_flow_markets function to retrieve a full list of codes.data_point_settings (
DataFrame
) – A DataFrame of data points with defined settings. Each row represents a data point. Each column is a configurable setting. This DataFrame can be obtained by retrieving asset flow data points, or by retrieving data point settings.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. 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 of get_investment_data or use the get_search_criteria_conditions function to discover the definition of a saved search criteria.
dry_run (
bool
, optional) – When True, the query will not be executed. Instead, a DryRunResults object will be returned with details about the query’s impact on daily cell limit usage. When True, the ‘investments’ parameter must be a list containing at least one element.
- Returns:
There are two return types:
DataFrame: A DataFrame object with asset flow data. DataFrame columns include
investmentId
and data point names, as provided indata_point_settings
.DryRunResults: Returned if dry_run=True is passed
estimated_cells_used: Number of cells by this query
daily_cells_remaining_before: How many cells are remaining in your daily cell limit before running this query
daily_cells_remaining_after: How many cells would be remaining in your daily cell limit after running this query
daily_cell_limit: Your total daily cell limit
- Examples:
import morningstar_data as md import pandas ASSET_FLOW_DATA_POINT_SETTINGS = [ { "datapointId": "TNA0M", "datapointName": "Total Net Assets-Market Value(Share Class)", "asOfDate": "2021-08-30", "alias": "Total Net Assets-Market Value(Share Class)", "startDate": None, "endDate": None, "frequency": None, } ] settings = pandas.DataFrame(ASSET_FLOW_DATA_POINT_SETTINGS) df = md.direct.get_asset_flow( investments=["F000010HRO"], market_id="165", data_point_settings=settings ) df
- Output:
investmentId
Total Net Assets-Market Value(Share Class) - 2021-06-30
F000010HRO
0.00188
- Errors:
AccessDeniedError: Raised when the user is not authenticated.
BadRequestError: Raised when the user does not provide a properly formatted request.
ForbiddenError: Raised when the user does not have permission to access the requested resource.
InternalServerError: Raised when the server encounters an unhandled error.
NetworkExceptionError: Raised when the request fails to reach the server due to a network error.
ResourceNotFoundError: Raised when the requested resource does not exist in Direct.
- morningstar_data.direct.get_asset_flow_data_points() DataFrame #
- Returns:
Returns all available data points related to asset flows.
DataFrame: A DataFrame object with asset flow data points data. DataFrame columns include:
datapointId
datapointName
asOfDate
alias
startDate
endDate
frequency
- Examples:
import morningstar_data as md df = md.direct.get_asset_flow_data_points() df
- Output:
datapointId
datapointName
asOfDate
alias
startDate
endDate
frequency
TNA0M
XXX
2021-09-30
Total Net Assets-Market Value(Share Class)
None
None
None
…
- morningstar_data.direct.get_asset_flow_markets() DataFrame #
- Returns:
Returns all investment markets that can be used to retrieve asset flow data. For example, “US Open-end & ETFs ex MM ex FoF”.
DataFrame: A DataFrame object with asset flow markets data. DataFrame columns include:
marketId
marketName
currency
- Examples:
import morningstar_data as md df = md.direct.get_asset_flow_markets() df
- Output:
marketId
marketName
currency
5
US Open-end & ETF ex MM ex FoF
USD
6
US Open-end, ETF, and MM ex FoF
USD
…
- Errors:
AccessDeniedError: Raised when the user is not authenticated.
BadRequestError: Raised when the user does not provide a properly formatted request.
ForbiddenError: Raised when the user does not have permission to access the requested resource.
InternalServerError: Raised when the server encounters an unhandled error.
NetworkExceptionError: Raised when the request fails to reach the server due to a network error.
ResourceNotFoundError: Raised when the requested resource does not exist in Direct.