Background

Today I’m formally launching the stock return calculator!

Comparing investments is a common activity for investors.  How can you know whether a strategy is working without ample evidence versus an alternative?  Existing calculators are either too limited or inflexible.  I’ve ditched some of the basic assumptions and will allow users to select a list of tickers to compare at a glance.  Choose individual tickers or include an index ETF such as SPY, DOW or QQQ.

I’ve launched a new stock return calculator in the suite of tools offered by Custom Stock Alerts.  Up to 20 years of data is currently available.

Here’s a quick demo of the tool:

 

 

Features

Get started by creating your list of tickers (currently capped at 10).  Set your starting and ending date ranges either by using the date picker UI or by hand typing in a date.  The final data will adjust if you put in a date where the market was not open.  Hit Go!

After the numbers crunch the results table will be populated.  The table will have detailed data on each stock chosen.  Information includes date ranges, start and ending share prices (split adjusted) and a detailed breakdown of a hypothetical $10,000 investment with number of shares, dividends accumulated, total return and annualized return.  The table also features an export button for future reference.

Total Return Chart

Included is also a step by step chart showing the investment value of each stock selected.  Hover over any data point to see the actual stock values over time.  Clicking the menu button on the top right of the chart provides export options.

API Access

For paying members, API access is available to pull stock return information directly into your spreadsheets!  Documentation is forthcoming but here is a quick sample of getting started.  On your “My Account” page, scroll down to the API section.  You will paste this API key into any call you use either within Excel or Google Sheets.

Thus far I’ve created two different API functions that you can call:

  • One to pull a total stock return figure provided a ticker and a start date.
  • One to pull total stock return versus a benchmark.  (Think running Apple with the S&P as the benchmark)

Total Stock Return

Use the following endpoint:
https://api.customstockalerts.com/v1/getStockReturn?symbol=AAPL&startDate=01/01/2010&key=INSERT_YOUR_KEY
At the time of writing, it returns 6.0216 which in percentage form is over a 600% return since the beginning of 2010.  You can verify these results by using the calculator on the front end.

Investment Comparison

Use the following endpoint:
https://api.customstockalerts.com/v1/getStockReturn?symbol=AAPL&startDate=01/01/2010&key=INSERT_YOUR_KEY&compareTo=SPY
At the time of writing, it returns 4.0587 which in percentage form is 400% better than the S&P since the beginning of 2010.  You can verify these results by using the calculator on the front end.

Plug-in your API key, set the startDate to either MM/dd/yyyy format or using the days since 1900.  A lot of times in Excel or Sheets dates will passed as numeric strings such as “43000” which is a valid date string.  Either should work.

How To

In Google Sheets, you can use the “ImportData” function to pull these values into your spreadsheet.

Using the previous example, set your formula to:

=ImportData("https://api.customstockalerts.com/v1/getStockReturn?symbol=AAPL&startDate=01/01/2010&key=INSERT_YOUR_KEY")

In Excel, use the “WebService” function:
=WebService("https://api.customstockalerts.com/v1/getStockReturn?symbol=AAPL&startDate=01/01/2010&key=INSERT_YOUR_KEY")

What Else?

Besides looking for initial feedback, I have a few ideas for enhancement.  One idea is a selectable option for reinvesting dividends or not.

Leave a Comment