Peer Group#

morningstar_data.direct.get_peer_group_breakpoints(
investments: List[str] | str,
data_points: List[Dict[str, Any]] | DataFrame,
order: Order = Order.ASC,
percentiles: List[int] | None = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100],
methodology: PeerGroupMethodology | None = None,
) DataFrame#

Returns peer group breakpoints for the specified list of investments and data points.

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

  • data_points (Union, optional) –

    Defines the data points to fetch. If not provided and investments are specified with a list ID or search criteria ID, the corresponding bound dataset will be used.

    • Data Point IDs (List[Dict], optional): A list of dictionaries, each defining a data point and its (optional) associated settings. The optional alias attribute can be added to each data point and will be used in the response, e.g., [{“datapointId”: “41”, “alias”: “Z1”}. Use get_data_set_details to discover data point identifiers from a saved data set.

    • Data Point Settings (DataFrame, optional): A DataFrame of data point identifiers and their associated settings. Use the get_data_set_details function to discover data point settings from a saved data set.

  • order (md.direct.data_type.Order, optional) – Breakpoint order, can be set to md.direct.data_type.Order.DESC (descending) or md.direct.dats_type.Order.ASC (ascending, default).

  • percentiles (list, optional) – Percentiles default to a list [1,2,3,…,100] if not provided, values should be within 1-100 range.

  • methodology (md.direct.data_type.PeerGroupMethodology, optional) – Breakpoint calculation methodology, can be set to md.direct.data_type.PeerGroupMethodology.MORNINGSTAR or md.direct.data_type.PeerGroupMethodology.SIMPLE. Defaults to the global setting “Custom Peer Group Ranking” in Morningstar Direct if not provided.

Returns:

A DataFrame object with peer group breakpoint data. The columns include the alias that the user input in the data_points parameter.

Return type:

DataFrame

Examples:

Get peer group breakpoint data for the standard deviation data point.

import morningstar_data as md

df = md.direct.get_peer_group_breakpoints(
        investments='740284aa-fcd3-43f6-99d1-8f3d4a179fcc',
        data_points=[
            {"datapointId": "41", "alias": "Z1"},
            {"datapointId": "41", "alias": "Z2", "startDate": "2021-07-01", "endDate": "2021-12-31", "windowType": "2", "windowSize": "3", "stepSize": "2"}
        ],
        order=md.direct.data_type.Order.ASC,
        percentiles=[25, 50, 75, 100]
    )
df
Output:

Alias

StartDate

EndDate

25

50

75

100

Z1

2019-04-01

2022-03-31

17.301437

12.720889

7.055372

-3.460187

Z2

2021-07-01

2021-09-30

1.827371

-0.804269

-4.899745

-52.143678

Z2

2021-09-01

2021-11-30

-0.030321

-4.336051

-10.618009

-40.980480

Errors:

AccessDeniedError: Raised when the user lacks permission or is not authorized to access the resource.

BadRequestException: Raised due to invalid/incorrect request, malformed request syntax, or deceptive request routing.

NetworkExceptionError: Raised when there is an issue with the internet connection or if the request is made from an unsecure network.

ResourceNotFoundError: Raised when the requested resource does not exist in Direct.