DISCLAIMER: This is purely an addon to APIDojo.net's Morningstar API found on RapidAPI.com. There is no affiliation between myself or any other party involved in the production of the API. The whole point of this addon is to make accessing the Morningstar API simpler and more fluid.
This addon is intended to help with accessing the Morningstar API provided by APIdojo on RapidAPI.com. Additionally, documentation for accessing the endpoints is provided below.
Furthermore, much of the API requires the user to know performance IDs of securities in order to get info on them. A big benefit of this addon is that the performance ID retrieval process is automated and allows for seamless requesting of tickers rather than performance IDs. On the contrary, a couple downsides to this method are listed in the Example of use section.
Note: There is a chance that some methods within the addon may not work over time depending on updates made to the API so I will be sure to make updates if requests come in. Thanks for understanding!
The API can be found here: https://rapidapi.com/apidojo/api/morning-star/endpoints
import axios from "axios";
const options = {
method: 'GET',
url: 'https://morning-star.p.rapidapi.com/market/v2/get-time-series',
params: {performanceIds: '0P0000OQN8,0P000000GY'},
headers: {
'x-rapidapi-key': '[API KEY GOES HERE]',
'x-rapidapi-host': 'morning-star.p.rapidapi.com'
}
};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
import sas from './Morningstar-API-Addon.js';
sas.getTimeSeries('AAPL');
- Concise requests
- Use of tickers as opposed to performance IDs
- Readable code
- Any request involving a ticker will almost always use up two requests instead of one (in case you are worried about requests made to the API for pricing purposes). The reason for this is that the ticker must first be cross-referenced to a performance ID (the API primarily runs off of performance IDs rather than tickers).
- Many of the methods in this addon only allow get requests of a single ticker. This is different from the API as you are able to request multiple performance IDs directly through the API. A future update will allow for ticker clustering. In other words, you will be able to request multiple tickers at a time.
- Clone the repository
- At the top of Morningstar-API-Addon.js , input your API key (must get it through RapidAPI) within the brackets here:
const api_key = '[API KEY GOES HERE]';
. - Utilize any of the methods in Morningstar-API-Addon.js by calling them through the
sas
variable in app.js.sas
is an instance of theStockAPIService
class found in Morningstar-API-Addon.js.
ticker
| Type: String
Returns: Object
sas.getReturns('AAPL');
{
marketReturn5Years: 35.762864,
ticker: 'AAPL',
marketReturn1Year: 93.43269,
securityId: 'E0USA002US',
exchange: 'XNAS',
marketReturn3Years: 43.701513
}