I previously wrote about some ad hoc R code for downloading Option Chain data from Google Finance. I finally wrapped it up into a package called flipsideR, which is now available via GitHub. Since I last wrote on this topic I’ve also added support for downloading option data from the Australian Securities Exchange (ASX).
Installation
Installation is straightforward using devtools.
> library(devtools) > install_github('DataWookie/flipsideR')
You’re ready to roll!
Functionality
As I mentioned previously, there’s already functionality in quantmod for retrieving option chain data.
> library(quantmod) > AAPL = getOptionChain('AAPL') > head(AAPL$calls) Strike Last Chg Bid Ask Vol OI AAPL160205C00070000 70 25.71 2.06 26.95 27.25 1 53 AAPL160205C00075000 75 20.50 0.00 21.95 22.25 1 2 AAPL160205C00080000 80 15.65 1.85 16.95 17.25 75 50 AAPL160205C00085000 85 10.61 1.42 11.95 12.25 151 44 AAPL160205C00086000 86 10.72 3.47 10.95 11.25 99 52 AAPL160205C00087000 87 10.30 0.00 9.95 10.25 1 1 > head(AAPL$puts) Strike Last Chg Bid Ask Vol OI AAPL160205P00070000 70.0 0.01 0.00 0.00 0.02 13 428 AAPL160205P00075000 75.0 0.02 0.00 0.00 0.02 2 464 AAPL160205P00080000 80.0 0.02 -0.02 0.00 0.04 156 2774 AAPL160205P00083000 83.0 0.01 -0.06 0.01 0.05 102 625 AAPL160205P00085000 85.0 0.03 -0.07 0.03 0.04 1390 2999 AAPL160205P00085500 85.5 0.05 -0.15 0.02 0.06 10 248 > detach('package:quantmod', unload = TRUE)
The data that you’ll …read more
Source:: r-bloggers.com