Morningstar Scenario Analysis API
Stress-test portfolios against historical and hypothetical market scenarios using Morningstar risk engines.
Stress-test portfolios against historical and hypothetical market scenarios using Morningstar risk engines.
openapi: 3.0.1
info:
version: 1.0.0
title: Authorization Tokens Accounts Scenario Analysis API
description: 'Use the `oauth` endpoint to generate the secure, time-limited JSON Web Tokens (JWTs) used to authorize access to APIs and components.</br></br>
To request a token, click Authorize and enter the following credentials:
* Username - Your Client ID.
* Password - Your Client Secret.'
servers:
- url: https://www.us-api.morningstar.com/token
description: PROD US
- url: https://www.emea-api.morningstar.com/token
description: PROD EMEA
- url: https://www.apac-api.morningstar.com/token
description: PROD APAC
security:
- BasicAuth: []
tags:
- name: Scenario Analysis
paths:
/direct-web-services/v1/scenario-analysis/risk-models:
get:
summary: Get risk models
responses:
'200':
$ref: '#/components/responses/ResponseGetRiskModels'
'400':
$ref: '#/components/responses/ResponseBadRequest'
operationId: getRiskModels
tags:
- Scenario Analysis
description: Retrieves the list of available risk models. The response includes a risk model ID, which can be used to request the scenarios defined for that model.
/direct-web-services/v1/scenario-analysis/scenarios:
get:
summary: Get scenarios
parameters:
- name: riskModelId
in: query
description: Specifies the risk model to query.
required: true
schema:
type: string
examples:
riskModelIdExample1:
summary: Global Equity Proprietary Factor Model (USD)
value: morn-glb-eq-usd
- name: scenarioType
in: query
description: Specifies the scenario type to filter results by.
schema:
$ref: '#/components/schemas/InputScenarioType'
enum:
- HistoricalEvent
- MarketShock
responses:
'200':
$ref: '#/components/responses/ResponseGetScenarios'
'400':
$ref: '#/components/responses/ResponseBadRequest'
operationId: getScenarios
tags:
- Scenario Analysis
description: 'Retrieves the list of scenarios defined for the specified risk model. The `HistoricalEvent`scenario type is returned by default. Use the optional `scenarioType` query parameter to override the default setting and return a different scenario type.
The response includes a scenario ID, which can be used to calculate returns or generate portfolio and investment metrics based on the conditions defined for the scenario.'
/direct-web-services/v1/scenario-analysis/returns:
post:
summary: Calculate returns
responses:
'200':
$ref: '#/components/responses/ResponseCalculateReturn'
'400':
$ref: '#/components/responses/ResponseBadRequest'
operationId: calculateReturns
tags:
- Scenario Analysis
description: Calculates scenario returns for the specified investments and portfolios based on the conditions defined for one or more scenarios.
requestBody:
$ref: '#/components/requestBodies/RequestCalculateReturn'
/direct-web-services/v1/scenario-analysis/metrics:
post:
summary: Generate metrics
responses:
'200':
$ref: '#/components/responses/ResponseGenerateMetrics'
'400':
$ref: '#/components/responses/ResponseBadRequest'
operationId: generateMetrics
tags:
- Scenario Analysis
description: Generates performance metrics for the specified portfolios and investments based on the conditions defined for one or more scenarios. Supported metrics include Alpha, Return, Max Drawdown, Standard Deviation, and Tracking Error.
requestBody:
$ref: '#/components/requestBodies/RequestGenerateMetrics'
/scenario-analysis/scenarios:
get:
responses:
'200':
description: OK
'401':
description: Authentication required.
'403':
description: You do not have access permission..
'404':
description: Not found.
'500':
description: Internal server error.
summary: Get all predefined scenarios
description: Get a list of all predefined scenarios. The response will include the unique ID for each scenario. You use the ID with other endpoints to return information based on that scenario. Only scenarios that your account is enabled for will be returned.
operationId: get_scenarios
parameters:
- in: query
description: Unique identifier of a risk model
name: risk-model-id
schema:
type: string
default: morn-glb-eq-usd
tags:
- Scenario Analysis
/scenario-analysis/calculate-cumulative-return:
post:
responses:
'200':
description: OK
'401':
description: Authentication required.
'403':
description: You do not have access permission.
'404':
description: Not found.
'500':
description: Internal server error.
summary: Calculate cumulative returns forecast for funds based on predefined or custom macro schock scenarios
description: Based on a specific risk model and predefined or custom macro shock scenarios, calculate daily cumulative returns forecast for funds. You can include multiple scenarios and one fund in the request, or one scenario and multiple funds. Multiple scenarios and multiple funds cannot be sent in the same request. The response enables you to understand the impact on fund cumulative returns if significant market events are repeated.
operationId: post_cumulative
requestBody:
$ref: '#/components/requestBodies/ScenarioAnalysisModel'
tags:
- Scenario Analysis
/scenario-analysis/calculate-drawdown:
post:
responses:
'200':
description: OK
'401':
description: Authentication required.
'403':
description: You do not have access permission..
'404':
description: Not found.
'500':
description: Internal server error.
summary: Calculate drawdown forecast for a fund based on a predefined or custom macro shock scenarios
description: Based on a specific risk model and predefined or custom macro shock scenarios, calculate daily drawdown forecast for a fund. You can include multiple scenarios and one fund in the request, or one scenario and multiple funds. Multiple scenarios and multiple funds cannot be sent in the same request. The response enables you to understand the impact on the fund drawdown if significant market events are repeated.
operationId: post_drawdown
requestBody:
$ref: '#/components/requestBodies/ScenarioAnalysisModel'
tags:
- Scenario Analysis
/scenario-analysis/calculate-metrics:
post:
responses:
'200':
description: OK
'401':
description: Authentication required.
'403':
description: You do not have access permission..
'404':
description: Not found.
'500':
description: Internal server error.
summary: Calculate metrics forecast for a fund based on predefined or custom macro shock scenarios
description: Based on a specific risk model and predefined or custom macro shock scenarios, calculate metrics forecast for a fund. You can include multiple scenarios and one fund in the request, or one scenario and multiple funds. Multiple scenarios and multiple funds cannot be sent in the same request. The response enables you to understand the impact on the fund metrics if significant market events are repeated.
operationId: post_metrics
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Metrics'
required: true
tags:
- Scenario Analysis
/scenario-analysis/calculate-period-return:
post:
responses:
'200':
description: OK
'401':
description: Authentication required.
'403':
description: You do not have access permission..
'404':
description: Not found.
'500':
description: Internal server error.
summary: Calculate returns forecast for a fund based on predefined or custom macro shock scenarios
description: Based on a specific risk model and predefined or custom macro shock scenarios, calculate returns for a fund during different time periods. You can include multiple scenarios and one fund in the request, or one scenario and multiple funds. Multiple scenarios and multiple funds cannot be sent in the same request. The response enables you to understand the impact on fund returns if significant market events are repeated.
operationId: post_period_return
requestBody:
$ref: '#/components/requestBodies/ScenarioAnalysisModel'
tags:
- Scenario Analysis
/scenario-analysis/calculate-ten-k-growth:
post:
responses:
'200':
description: OK
'401':
description: Authentication required.
'403':
description: You do not have access permission..
'404':
description: Not found.
'500':
description: Internal server error.
summary: Calculate growth forecast for a $10k investment in a fund based on a predefined or custom macro/market shock scenarios
description: Based on a specific risk model and predefined or custom macro/market shock scenarios, calculate growth for a $10k investment in a fund. You can include multiple scenarios and one fund in the request, or one scenario and multiple funds. Multiple scenarios and multiple funds cannot be sent in the same request. The response returns a series investment results forecasts. The forecast frequency depends on the type of scenario - predefined (daily); macro shock (monthly) market shock (weekly).
operationId: post_ten_k_growth
requestBody:
$ref: '#/components/requestBodies/ScenarioAnalysisModel'
tags:
- Scenario Analysis
components:
schemas:
OutputInvestmentMetadata:
type: object
properties:
id:
type: string
description: ID passed in request.
nullable: true
idType:
type: string
description: "\r\nID type passed in request.\r\n\r\nIdType value(s) - \"ISIN\", \"CUSIP\", \"PerformanceId\", \"SecurityId\", \"TradingSymbol\", \"FundCode\", \"MSID\""
nullable: true
performanceId:
type: string
description: Performance ID (if not passed in request).
nullable: true
companyId:
type: string
description: Company ID (if not passed in request).
nullable: true
baseCurrency:
type: string
description: Input base currency used to look up Investment identifier
nullable: true
domicile:
type: string
description: Input domicile used to look up Investment identifier.
nullable: true
exchangeCountry:
type: string
description: Input exchange country used to look up Investment identifier.
nullable: true
exchangeId:
type: string
description: Input exchange id used to look up Investment identifier.
nullable: true
additionalProperties: false
description: Represents an investment that is considered invalid.
ResponseGenerateMetrics:
type: object
properties:
scenarios:
type: array
items:
$ref: '#/components/schemas/OutputMetricsScenario'
nullable: true
metadata:
$ref: '#/components/schemas/OutputMetadata'
additionalProperties: false
InputCalculationType:
enum:
- Cumulative
- Drawdown
- Growth10k
- Monthly
- Period
type: string
description: "\r\nCalculationType defines the type of return in response.\r\n\r\nGrowth10k : A different way of showing cumulative return that highlights the change in value of an initial $10,000 investment\r\n\r\nperiod : Calculate the forecast returns of the scenario for different periods of 1 week, 1 month etc.\r\n\r\ncumulative : Cumulated returns.\r\n\r\ndrawdown : Drawdown of the return which is a measure of decline in an investment or fund from its peak to its trough over a period from the starting date.\r\n\r\nmonthly : Calculate the forecast returns of the scenario in monthly"
ResponseErrorDetails:
type: object
properties:
statusCode:
type: integer
description: Status Code
format: int32
errorCode:
type: string
description: Custom error code
nullable: true
message:
type: string
description: Message
nullable: true
requestId:
type: string
description: RequestId
nullable: true
additionalProperties: false
description: Error details
OutputPerformanceMetrics:
type: object
properties:
return:
type: number
description: "\r\nForecasted returns of the scenario."
format: double
nullable: true
maxDrawdown:
type: number
description: "\r\nMax Drawdown of the forecasted return of the scenario."
format: double
nullable: true
standardDeviation:
type: number
description: "\r\nStandard Deviation of the for the forecasted return of the scenario."
format: double
nullable: true
trackingError:
type: number
description: "\r\nTracking Error vs the benchmark for the forecasted return of the scenario.\r\n\r\nBenchmark is required to obtain Alpha and Tracking Error values."
format: double
nullable: true
alpha:
type: number
description: "\r\nExcess return of the fund vs the benchmark for the forecasted return of the scenario.\r\n\r\nBenchmark is required to obtain Alpha and Tracking Error values."
format: double
nullable: true
peakofMaxDrawdownFromToday:
type: integer
description: "\r\nPeak of the Max Drawdown."
format: int32
nullable: true
valleyofMaxDrawdownFromToday:
type: integer
description: "\r\nValley of the Max Drawdown."
format: int32
nullable: true
maxDrawdownDuration:
type: integer
description: "\r\nThe number of days from the peak to valley."
format: int32
nullable: true
recoveryDuration:
type: integer
description: "\r\nThe number of days from valley back to positive cumulative return, could be NA if it never gets back to positive returns during the scenario period."
format: int32
nullable: true
recoveryFromToday:
type: integer
description: "\r\nThe number of days from start date of the scenario back to positive cumulative return, could be NA if it never gets back to positive returns during the scenario period."
format: int32
nullable: true
var:
type: number
description: "\r\nVaR is a measure of the potential of loss with a given probability."
format: double
nullable: true
cVAR:
type: number
description: "\r\nCVaR is another risk measure that represents the mean loss of a portfolio occurring below the user-specified percentile."
format: double
nullable: true
additionalProperties: false
holding:
properties:
identifier:
type: string
weight:
type: number
type: object
InputInvestment:
required:
- id
type: object
properties:
id:
minLength: 1
type: string
description: Unique identifier of an investment.
idType:
type: string
description: Identifier type.
default: PerformanceId
nullable: true
baseCurrency:
type: string
description: Base currency to use for investment lookup. Accepts 3‑character ISO 4217 currency codes.
nullable: true
domicile:
type: string
description: Domicile to use for investment lookup. Accepts 3-character ISO 3166-1 country codes.
nullable: true
exchangeCountry:
type: string
description: Exchange country to use for investment lookup. Accepts 3-character ISO 3166-1 country codes.
nullable: true
exchangeId:
type: string
description: Exchange identifier to use for investment lookup. See [Exchange IDs](https://developer.morningstar.com/content/hidden-from-navigation/DwsApisExchangeIds.xlsx) document for list of valid values.
nullable: true
examples:
exchangeIdExample1:
summary: NASDAQ - ALL Markets (NAS)
value: EX$$$$XNAS
exchangeIdExample2:
summary: London Stock Exchange (LSE)
value: EX$$$$XLON
additionalProperties: false
OutputSecurityType:
type: string
description: The security type
enum:
- BD
- BK
- CA
- CASH
- CIT
- CP
- CT
- CU
- CZ
- DF
- EI
- FC
- FE
- FG
- FH
- FI
- FM
- FO
- FV
- GA
- H1
- HD
- IF
- LP
- MG
- MO
- P1
- PI
- PO
- PS
- R1
- S1
- SA
- SC
- SP
- ST
- V1
- VA
- VH
- VL
- VP
- VS
- XI
x-enumDescriptions:
BD: Bonds
BK: 529 Benchmark
CA: Category Average/SectorAverages
CASH: Cash
CIT: Collective Investment Trusts
CP: College Saving Plans
CT: College Saving Portfolios
CU: Exchange Rates/Currency Exchange
CZ: Collective Investment Trusts
DF: Restricted Investors
EI: Economics Series
FC: Closed End Funds
FE: Exchange Traded Funds
FG: FG
FH: Hedge Funds
FI: Unit Investment Trust
FM: Money Market Funds
FO: Open End Fund
FV: Insurance Product Fund
GA: GRPA
H1: HFR Hedge Fund
HD: Australian Hybrid
IF: IF
LP: US Variable Life
MG: Strategies
MO: Models
P1: UK Life and Pension Policies
PI: Special Pooled Funds for Unregistered VA
PO: MF Objective
PS: European Pension/Life Fund Wrappers
R1: Global Restricted Funds
S1: UBS Separate Accounts
SA: Separate Accounts
SC: Custom Fund
SP: Private Funds
ST: Stocks
V1: UK Life and Pension Funds
VA: US Variable Annuity Subaccounts
VH: VH
VL: US Variable Life Subaccounts/VL Subaccount
VP: US Variable Annuities/VA Policy
VS: VS
XI: Market Indexes
Holdings:
required:
- id
properties:
holdings:
type: array
items:
$ref: '#/components/schemas/holding'
id:
type: string
type: object
OutputIdentifierType:
enum:
- SecurityId
- CUSIP
- TradingSymbol
- FundCode
- ISIN
- PerformanceId
- MSID
- SEDOL
- Ticker
type: string
description: Security identifier type
OutputHoldingMetadata:
type: object
properties:
identifier:
type: string
nullable: true
identifierType:
$ref: '#/components/schemas/OutputIdentifierType'
baseCurrency:
type: string
nullable: true
exchangeCountry:
type: string
nullable: true
domicile:
type: string
nullable: true
additionalProperties: false
ResponseCalculateReturn:
type: object
properties:
scenarios:
type: array
items:
$ref: '#/components/schemas/OutputReturnsScenario'
nullable: true
metadata:
$ref: '#/components/schemas/OutputMetadata'
additionalProperties: false
OutputReturn:
type: object
properties:
date:
type: string
description: "\r\nReturn Date."
nullable: true
period:
type: string
description: "\r\nReturn Period."
nullable: true
value:
type: number
description: "\r\nReturn Value."
format: double
additionalProperties: false
OutputMetricsScenario:
type: object
properties:
id:
type: string
description: "\r\nScenario Id."
nullable: true
name:
type: string
description: "\r\nScenario Name."
nullable: true
definition:
type: string
description: "\r\nScenario Definition."
nullable: true
shockDate:
type: string
description: "\r\n\"shockDate\" indicates when the forecast of the scenario analysis would starts. It is the last month end of the risk premium data."
nullable: true
duration:
type: integer
description: "\r\nScenario Duration."
format: int32
durationUnit:
type: string
description: "\r\nScenario DurationUnit."
nullable: true
investments:
type: array
items:
$ref: '#/components/schemas/OutputMetricsInvestment'
description: "\r\nList of Investments."
nullable: true
portfolios:
type: array
items:
$ref: '#/components/schemas/OutputMetricsPortfolio'
description: "\r\nList of Portfolios."
nullable: true
additionalProperties: false
OutputScenario:
type: object
properties:
id:
type: string
description: Unique identifier of a scenario.
nullable: true
name:
type: string
description: Display name of the scenario.
nullable: true
groupName:
type: string
description: Name of the group to which the scenario belongs.
nullable: true
startDate:
type: string
description: Date on which the period represented by an historical event scenario begins.
nullable: true
endDate:
type: string
description: Date on which the historical period represented by the scenario ends.
nullable: true
lastModifiedDate:
type: string
description: Date on which the scenario was last modified.
nullable: true
createdDate:
type: string
description: Date market shock scenario was created.
nullable: true
definition:
type: string
description: Specification of the scenario — the market conditions it applies, such as the index, shock magnitude, and duration.
nullable: true
shortDescription:
type: string
description: Brief description of the scenario, suitable for display alongside `name`.
nullable: true
additionalProperties: false
OutputIdentifiers:
type: object
properties:
performanceId:
type: string
description: Performance ID passed in the request or returned based on the values passed to identify an investment.
nullable: true
securityId:
type: string
description: Morningstar security ID passed in the request used to look up investment identifiers.
nullable: true
tradingSymbol:
type: string
description: Trading symbol passed in the request used to look up investment identifiers.
nullable: true
fundCode:
type: string
description: Fund code passed in the request used to look up investment identifiers.
nullable: true
isin:
type: string
description: ISIN passed in the request and used to look up investment identifiers.
nullable: true
cusip:
type: string
description: CUSIP passed in the request used to look up investment identifiers.
nullable: true
additionalProperties: false
description: The ID and ID type passed in the request and the corresponding Morningstar investment identifiers are returned.
InputPortfolio:
required:
- holdings
- name
type: object
properties:
holdings:
type: array
items:
$ref: '#/components/schemas/InputHolding'
name:
type: string
description: Get or set portfolio name
nullable: true
additionalProperties: false
OutputPortfolioMetadata:
type: object
properties:
name:
type: string
nullable: true
holdings:
type: array
items:
$ref: '#/components/schemas/OutputHoldingMetadata'
nullable: true
additionalProperties: false
InputHolding:
type: object
properties:
weight:
type: number
description: "Get or set the Weight\r\n1. min value = 0\r\n2. max value = 100"
format: double
nullable: true
cusip:
type: string
description: Get or set the CUSIP
nullable: true
fundCode:
type: string
description: Get or set the FundCode
nullable: true
isin:
type: string
description: Get or set the ISIN
nullable: true
performanceId:
type: string
description: Get or set the PerformanceId
nullable: true
securityId:
type: string
description: Get or set the SecurityId
nullable: true
tradingSymbol:
type: string
description: Get or set the TradingSymbol
nullable: true
additionalProperties: false
OutputMessage:
type: object
properties:
investments:
type: array
items:
$ref: '#/components/schemas/OutputInvestmentMetadata'
description: List of invalid holdings.
nullable: true
portfolios:
type: array
items:
$ref: '#/components/schemas/OutputPortfolioMetadata'
nullable: true
type:
$ref: '#/components/schemas/OutputMessageType'
message:
type: string
description: Message text.
nullable: true
code:
type: string
description: Unique identifier of a message.
nullable: true
additionalProperties: false
ResponseGetScenarios:
type: object
properties:
scenarios:
type: array
items:
$ref: '#/components/schemas/OutputScenario'
nullable: true
scenarioType:
type: string
description: "\r\nScenarioType."
nullable: true
scenarioTypeName:
type: string
description: "\r\nScenarioTypeName."
nullable: true
metadata:
$ref: '#/components/schemas/OutputMetadata'
additionalProperties: false
Metrics:
required:
- riskModelId
- scenarios
properties:
riskModelId:
type: string
example: morn-glb-eq-usd
investments:
type: array
description: Investment id refers to performance ids, identifying the funds to be analysis on, separated by "," when passing multiple.
example:
- id: 0P0000058R
type: PerformanceId
items:
$ref: '#/components/schemas/investment'
scenarios:
type: array
description: Scenario id, internal pre-defined scenario identities(scenario001 ~ scenario009), separated by "," when passing multiple scenarios.
example:
- scenario001
- scenario002
items:
type: string
benchmark:
description: The benchmark's securityId for the analysing fund. Which will be required for calculating the alpha and tracking error.
example:
id: NB
allOf:
- $ref: '#/components/schemas/benchmark'
portfolios:
type: array
example:
- id: abc
holdings:
- identifier: 0P0000058R
weight: 60
- identifier: 0P000001RB
weight: 40
- id: '123'
holdings:
- identifier: 0P0000058R
weight: 50
- identifier: 0P000001RB
weight: 50
items:
$ref: '#/components/schemas/Holdings'
type: object
OutputLookupFilters:
type: object
properties:
baseCurrency:
type: string
description: Input base currency used to look up Investment identifier
nullable: true
domicile:
type: string
description: Input domicile used to look up Investment identifier.
nullable: true
exchangeCountry:
type: string
description: Input exchange country used to look up Investment identifier.
nullable: true
exchangeId:
type: string
description: Input exchange id used to look up Investment identifier.
nullable: true
additionalProperties: false
description: Information passed in request and used to look up an investment's Morningstar Investment identifier.
investment:
properties:
id:
type: string
type:
type: string
type: object
benchmark:
properties:
id:
type: string
type:
type: string
type: object
OutputReturnsScenario:
type: object
properties:
id:
type: string
description: Unique identifier of scenario applied in this calculation.
nullable: true
name:
type: string
description: Display name of scenario applied in this calculation.
nullable: true
definition:
type: string
description: Specification of the scenario — the market conditions applied in this calculation, such as the index, shock magnitude, and duration.
nullable: true
calculateType:
type: string
description: Type of calculation performed for this scenario.
nullable: true
shockDate:
type: string
description: Date on which the scenario analysis forecast begins. This is the last month end of the risk premium data.
format: date
duration:
type: integer
description: Length of the scenario forecast, beginning at `shockDate`. Expressed in the unit given by `durationUnit`.
format: int32
durationUnit:
type: string
description: Unit of time in which `duration` is expressed.
nullable: true
investments:
type: array
items:
$ref: '#/components/schemas/OutputReturnsInvestment'
description: Forecast results for each investment included in the request, calculated under this scenario.
nullable: true
portfolios:
type: array
items:
$ref: '#/components/schemas/OutputReturnsPortfolio'
description: Forecast results for each portfolio included in the request, calculated under this scenario.
nullable: true
additionalProperties: false
ResponseGetRiskModels:
type: object
properties:
riskModels:
type: array
items:
$ref: '#/components/schemas/OutputRiskModel'
nullable: true
metadata:
$ref: '#/components/schemas/OutputMetadata'
additionalProperties: false
RequestGenerateMetrics:
type: object
properties:
riskMode
# --- truncated at 32 KB (69 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/morningstar/refs/heads/main/openapi/morningstar-scenario-analysis-api-openapi.yml