S&P500 Dashboard

[This article was first published on R – NYC Data Science Academy Blog, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

S&P500 Dashboard

This is my Shiny Dashboard for stocks listed on S&P500. Using R shiny to give a visualized general insight of market and using ARIMA model to analyze risk for a single stock.


When I worked as a trader. I found that it was really inconvenient to do the daily market research because the information on the mainstream website could be confusing and overwhelming sometime. As a result, it was difficult to find a single website that can give me all the information that I prefer to use. So, I usually had to check many different websites at the same time to extract the information that I was interested in. Even though I successfully finished gathering all information together, I might not be able to get a big picture of the whole market because there were so many noises in the information I gathered. So, I made this dashboard which can help me to extract information and do the basic fundamental analysis for me.


This is a dashboard for the S&P 500 stock market to give the user a general insight of stock market. And it is based on the  R studio Shiny package.  The main dataset comes from Kaggle. What’s more, I use Alpha Vantage API to get the price movement of sector ETFs listed on SPDR. In order to process the dataset, I use dplyr and tidyr. Besides, in order to visualize market major trend, I also use ggplot2, plotly, word cloud, and googlevis. Then, I use ARIMA model to do price risk analysis. If you are interested in, this is the link to my Github, and this is the output of my ShinyApp.IO.

App Detail

Word Cloud

Based on web scraping and word cloud visualization, this page can give users the hot words that were discussed on any date that has Nasdaq historical news page. Users only need to copy the URL of Nasdaq news page and paste in the URL input. The word cloud will change automatically.

Main tab

There are four plots on this page. All of them are based on the sector user choose. Following will introduce the details of each plot.



Users can choose the date they are interested in by using the date selector in the sidebar.The size of each node is based on the volume of the ETF or stock. And the color means the gain or loss of each ETF or stock. Users can use click on ETF nodes to zoom in and check the stocks that are listed in the selected sector.

2.Barplot and Heatmap


Users can choose the indicator and the sector they are interested in and plot on the bar plot. Both of sector and indicator can be chosen in the sidebar. At the same time, the correlation between each stock and the SPY will be plot as a heat map.

3.Price movement

Users can choose the stock they are interested in and plot them as candlestick on these two plots. Users can also select the two SMA they prefer to use.

Time Series Analysis

Time series analysis for the stock users chose. Using three parameters of ARIMA model to make visualized model test process. I include basic tests for ARIMA model. They are Box-test and Shapiro-test for the residuals of the model. By default, users can use 200 points to construct the model and use the rest 50 points to test model. The result of this accuracy test is displayed by using MAPE, MPE etc indicators. Users can choose which they prefer.

Future Improvement

I will make the word cloud can be controlled by using the date in the sidebar after I find a good website which has API or URL that can be parsed by only using a date. I also will include the natural language analysis for the news analysis. For the time analysis part, I will put the result of the optimized model by using auto.arima in R package.










To leave a comment for the author, please follow the link and comment on their blog: R – NYC Data Science Academy Blog.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.