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,
) DataFrame#

Get asset flow data for a market of investments or specific investments within a market.

The investments can be provided in one of the following ways:

  • Investment IDs

  • List ID

  • Search Criteria ID

  • Search Criteria Condition

Data points must be provided in the form of a DataFrame that also includes settings. Data points can be identified using get_asset_flow_data_points.

Parameters:
  • investments (Union, optional) –

    Can be provided in one of the following ways:

    • Investment IDs (list, optional): An array of investment codes. Use this for an ad hoc approach to selecting investments, rather than using a list or a search. The investment code format is secid;universe. For example: [“F00000YOOK;FO”,”FOUSA00CFV;FO”].

    • List ID (str, optional): The unique identifier of the saved investment list from the Workspace module in Morningstar Direct. The format is GUID. For example, “EBE416A3-03E0-4215-9B83-8D098D2A9C0D”.

    • Search Criteria ID (str, optional): The unique identifier of a saved search criteria from Morningstar Direct. The id string is numeric. For example, “9009”.

    • Search Criteria Condition (dict, optional): The detailed search criteria. The dictionary must include the keys universeId and criteria. For example:

      SEARCH_CRITERIA_CONDITION = {"universeId": "cz",
              "subUniverseId": "",
              "subUniverseName": "",
              "securityStatus": "activeonly",
              "useDefinedPrimary": False,
              "criteria": [{"relation": "", "field": "HU338", "operator": "=", "value": "1"},
                              {"relation": "AND", "field": "HU863", "operator": "=", "value": "1"}]}
      

  • market_id (str) – A code representing a broad market of investments. For example, US Open-end & ETF ex MM ex FoF. Use the get_asset_flow_markets function to retrieve a full list of codes, or view the documentation here.

  • data_point_settings (DataFrame) – A DataFrame of data points with all defined settings, including Total Net Assets, Estimated Net Flow, Organic Growth Rate, Market Appreciation. Each row represents a data point. Each column is a configurable setting. This DataFrame can be obtained by retrieving a data set, or by retrieving data point settings.

Returns:

A DataFrame object with asset flow data. The DataFrame columns include investmentId and data point name that user input in parameter data_point_settings.

Return type:

DataFrame

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 user lacks authentication.

BadRequestError: Raised when the user does not provide a properly formatted request.

ForbiddenError: Triggered when user lacks permission to access a resource.

InternalServerError: Raised when the server encounters an error it does not know how to handle.

NetworkError: 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 all available data points related to asset flows.

Returns:

A DataFrame object with asset flow data points data. The DataFrame columns include:

  • datapointId

  • datapointName

  • asOfDate

  • alias

  • startDate

  • endDate

  • frequency

Return type:

DataFrame

Examples

Get Morningstar data set under FO universe.

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 all investment markets that can be used to retrieve asset flow data. For example, US Open-end & ETFs ex MM ex FoF.

Returns:

A DataFrame object with asset flow markets data. The DataFrame columns include:

  • marketId

  • marketName

  • currency

Return type:

DataFrame

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 user lacks authentication.

BadRequestError: Raised when the user does not provide a properly formatted request.

ForbiddenError: Triggered when user lacks permission to access a resource.

InternalServerError: Raised when the server encounters an error it does not know how to handle.

NetworkError: 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.