We created this API to support our own applications and decided to share it with the world. The Modern Portfolio API follows the mathematics and analysis of modern portfolio theory developed by Harry Markowitz. The API presents multiple portfolio allocations based on risk and return characteristics using historical data. It promotes the selection of maximized returns for the least amount of risk as an optimized portfolio. The following documentation describes how to use our free Modern Portfolio API.
The ticker symbols you wish to use. Requires at least two ticker symbols that are separated by a comma (no spaces). This parameter will accept up to 1500 characters. Use Yahoo Finance to find active tickers. For international tickers, simply append the exchange identifier found HERE to the end of the ticker.
Accepted values: 1d, 1wk, 1mo. Returns the end of day [1d], end of week [1wk], or end of month [1mo] data type.
A unit that represents the number of time intervals that will be used in the calculations. For a ten day history use '10'. For a 4 month history use '4'. Will take a value between 4 and 99999. The API will return a lesser amount if there is insufficient data available. For example, if you request 2000 observations but there are only 1000 observations available, the API will use only 1000 observations.
Status, status message, data, average returns, standard deviations, and the covariance matrix are
all returned in JSON format. Status 200 is successful while status 400 is unsuccessful. Data will
supply error message or the data requested from the API. If successful, the Modern Portfolio API
will return many portfolios along the efficient frontier. Each datasets' first number represents
the expected return and last number represents the level of risk (standard deviation). Risk and
return values are relative to the interval you selected (e.g. daily, weekly, monthly). Numbers in
between represent the allocations in percentage of each ticker with respect to the risk and return
of the portfolio. Allocations are in order of the sequence of ticker symbols you supplied. Negative
values represent shorting a ticker. For instance:
[
0.01, <--Portfolio Return
0.6 <--1st Ticker proportion
0.4 <--2nd Ticker proportion
0.03 <--Portfolio Risk (Standard Deviation)
]
The average returns, standard deviations, and covariance matrix are returned the order of the
tickers that are submitted in the URL. The average returns is calculated using a simple average,
and the standard deviation and covaricance matrix are calculated using standard sample formulas.
http://mpt.newtonanalytics.com/?tickers=aa,fb&interval=1d&observations=99
http://mpt.newtonanalytics.com/?tickers=goog,mmm,amzn&interval=1mo&observations=120
All data provided on Newton Analytics or the API is provided for informational purposes only, and is not intended for trading or investing purposes. Seek a duly licensed professional for investment advice.
POWERED by