Application Center - Maplesoft

App Preview:

An Interactive Stock Quote Importer

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application

An Interactive Stock Quote Importer



Financial engineers and quantitative analysts often exploit network services to retrieve stock quotes.  A large number of services exist, including paid-for real-time feeds from Bloomberg and Reuters.  Yahoo, however, provide a free service that is delayed by fifteen minutes.


The Interactive Stock Quote Importer in this worksheet will import quotes (including historical data) from Yahoo for a series of user-specified NYSE stock symbols.  This application



provides text fields for specifying up to five ticker symbols,


allows the user to pick those quantities they want to import with check boxes,


summarises the data in a table,


assigns the values to variables for further processing and analysis.


Within Maple, the data is summarised in a table, or can be accessed as variables.  If, for example, GSK has been specified, simply type in GSK[ and then press CTRL+SPACE for a list of accessible properties.  Several examples are given below the Importer.


The worksheet concludes by optimizing an asset portfolio by maximising the Sharpe Ratio with imported historical data.


The applications of this worksheet include ranking companies by financial information (i.e. earnings per share, market capitlization etc), plotting historical data, generating moving averages, and optimizing asset portfolios.  


Interactive Stock Quote Importer

Enter NYSE Stock Symbols


















Optimizing Asset Allocation by Maximizing the Sharpe Ratio

The Sharpe ratio quantifies how effectively a portfolio of risky assets uses risk to maximise return.  It is defined as follows.




The expected portfolio return is predicted from historic data, the standard deviation of the asset mix is traditionally used as a proxy for risk (or volatility) and the risk free return is the return that can be expected from a zero-risk investment (i.e. the interest on US Treasury Bills or the redemption yield on UK gilts).  A higher Sharpe Ratio essentially signifies a more risk efficient portfolio.

Maximize the Sharpe Ratio

For a stock mix of GSK, XOM, WMT and KO, the asset mix that maximizes the Sharpe Ratio is



Hence the portfolio composition that best uses risk to maximize return consists of 74% XOM, 23% WMT and 3% KO.  This calculation is sensitive to the data used.


Legal Notice: © Maplesoft, a division of Waterloo Maple Inc. 2011. Maplesoft and Maple are trademarks of Waterloo Maple Inc. This application may contain errors and Maplesoft is not liable for any damages resulting from the use of this material. This application is intended for non-commercial, non-profit use only. Contact Maplesoft for permission if you wish to use this application in for-profit activities.