Historical Investing - Shiny Contest Submission

Historical Investing

Authors: Spencer Matthews

Abstract: The Historical Investing app allows users to enter amounts invested in an arbitrary number of stocks of their choice at a past date (including recurring deposits and reinvesting dividends) and to see what the value of that portfolio would be today.

Full Description: # {historicalInvesting}

Travis build status

The goal of historicalInvesting is to allow users to create beautiful charts showing the historical movements of stock prices based on given investments.
It is a shiny app created within the {golem} framework but also includes a couple of functions useful for getting historical prices and dividend data for any stock ticker.


You can access a live version of the app here.

Or, install by following the instructions below and run on your own machine.


You can install the most current version of {historicalInvesting} from github with:

# install.packages("devtools")

Basic Use of the App

Upon opening the app, the start page will appear.

In the left sidebar, you may enter as many tickers (positions) as you would like.
The ticker symbol is entered along with start date and starting amount.
Additionally, a specific amount can be contributed after each specified period of time using the inputs on the second row.
Finally, you can choose to reinvest dividends (default) or not by de-selcting the checkbox.

To add another position, simply click the "Add Position" button and another setup identical to the one described above will appear.
Once all positions have been entered, clicking the "Run Simulation" button will simulate buying those positions at the given dates and their progress through today.

After the "Run Simulation" button is clicked, the app will show the current value of your positions and the total amount contributed in two cards at the top.
Beneath those is the default line chart, and underneath the line chart are widgets that allow for customization of the charts.

Clicking on the "Show Options" button in the line chart box will expand the options which allow for changes to the background, line color, font, etc.
After the chart is customized as desired, it can be downloaded by clicking the "Download PNG" button.

A similar process can be taken with a chart that is split into different panels based on the ticker, so the growth of each ticker can be viewed individually.

I hope you enjoy viewing historical stock results and creating beautiful charts!


The stock price data used in the package and app is obtained from Yahoo Finance.
The dividend data used is from Dividend Information.

Keywords: investing,webscraping,portfolio,golem,charts
Shiny app: https://spencermatthews.shinyapps.io/historicalInvesting/
Repo: GitHub - srmatth/historicalInvesting: Historical Investing Simulator
RStudio Cloud: Posit Cloud


Full image: