top of page
Writer's pictureJiehwan Yang

Interactive Stock Comparison Tool using Shiny

Updated: Jan 7, 2019

Say you have loaded your portfolio with a bunch of stocks or are searching for stocks to buy. No matter you are doing the former or the latter, or doing both simultaneously, you may wonder how the stocks have performed across a number of years and where they all stand compared to each other in different dimensions.


Now, you can display as many stocks as you want and compare all of them in terms of their price, PER, ROE, ROA, beta, growth over years, you name it.


Here is a quick video of the shiny app I built:


 

Feature Explanation


  • Auto Completion of stock code


The auto completion feature is simply done by the function selectizeInput. my_autocomplete_list is a list of tickers retrieved from a csv file.


  • Interactive Stock Chart



The highchart package does a beautiful job displaying stock data. I also added volume, weighted average, oscillator, sell, and buy level on the chart as well.


  • Line Chart




Highchart package provides a line chart feature as well. As for accessing the growth data, I used the already saved csv file with financial information for each stock. Please refer to my previous post for more information about how to retrieve financial data.


  • Radar Chart

This part was a little more tricky than other features as I had to set clear standards of scoring for different dimensions, e.g., PER, ROE, EPS, ROA, pegRatio, Beta. In terms of scoring, I had to examine the quartiles of all stocks for each variable, divide it into 10 different score ranges, assign each stock a score from 1 to 10 depending on which score range it falls into. For example, AAPL scored 7 on ROE as it fell in a higher ROE score range than that of FB and PEP.

Comments


bottom of page