2 min read

Week36 - stockchartR

Week36 - stockchartR

This Week’s Widget - stockchartR

I intentionally do not talk much finance here at Building Widgets, but for those who are unaware of TimelyPortfolio, finance pays the bills for me. Although d3.js was released in 2010 (see this first Github commit, we did not see robust finance-targeted d3.js visualization libraries until last year. Now suddenly we have three really solid, very well-built options.

  1. techan.js
  2. d3fc
  3. react-stockcharts

I have wanted to htmlwidget-ize all of these but to do a good job on any of them would require at least a month of dedicated effort. However, I just couldn’t resist doing a sparse teaser implementation of react-stockcharts. I chose this one only because I have not done a React htmlwidget yet. I strongly encourage the interested reader to check out all three of the options listed above. Also, please, please let me know if you want to collaborate on a htmlwidget for any of these. All of them are great.

Installation

devtools::install_github("timelyportfolio/stockchartR")

Examples

As of now, this sparse wrapper provides a finance-based time scale, pan+zoom interaction, candlestick plotting, and a volume bar chart. I’ll say one more time just to be clear that react-stockcharts does much, much more.

# devtools::install_github("timelyportfolio/stockchartR")
library(stockchartR)
library(quantmod)

iwm <- getSymbols("IWM", auto.assign=FALSE, from="2014-01-01")
stockchart(adjustOHLC(iwm))

source: Yahoo! Finance

Thanks

Ragu Ramaswamy, thanks for your really fine work on react-stockcharts. I can’t wait to implement and take advantage of all that you have built into this amazing library.

As always, thanks to

  • Ramnath Vaidyanathan and RStudio for htmlwidgets
  • all the contributors to R and JavaScript