8000 GitHub - mauicode26/Morningstar-API-Addon at aa4d1be5fb41ba0e2b8b1cf10f329db81de72d56
[go: up one dir, main page]

Skip to content

An addon to the Morningstar API found on RapidAPI.com by APIdojo. Makes retrieving data through the API much easier with a ticker-focused interface as opposed to arbitrary 'performance IDs'.

Notifications You must be signed in to change notification settings

mauicode26/Morningstar-API-Addon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Morningstar API Addon (APIdojo/RapidAPI.com)

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.

Purpose

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

Example of use (Getting time series data of a security)

Before (RapidAPI's example request)

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);
});

After (Addon's request)

import sas from './Morningstar-API-Addon.js';

sas.getTimeSeries('AAPL');

Benefits

  1. Concise requests
  2. Use of tickers as opposed to performance IDs
  3. Readable code

Notes (IMPORTANT)

  1. 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).
  2. 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.

Getting started

  1. Clone the repository
  2. 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]';.
  3. 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 the StockAPIService class found in Morningstar-API-Addon.js.

Documentation

StockAPIService.getReturns(ticker)

ticker | Type: String

Returns: Object

Example input

sas.getReturns('AAPL');

Example output

{
  marketReturn5Years: 35.762864,
  ticker: 'AAPL',
  marketReturn1Year: 93.43269,
  securityId: 'E0USA002US',
  exchange: 'XNAS',
  marketReturn3Years: 43.701513
}

About

An addon to the Morningstar API found on RapidAPI.com by APIdojo. Makes retrieving data through the API much easier with a ticker-focused interface as opposed to arbitrary 'performance IDs'.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0