Getting to Know Option Behavior
===============================
author: Matt Brigida, date: 10/06/2014
### Answer the questions in your own markdown file and submit the html.
```{r, message=FALSE}
library(IBrokers)
library(quantmod)
tws <- twsConnect()
```
First we'll create stock and option objects for the SPY ETF. The option on SPY is a call expiring 10/31/2014 with a $196.50 strike.
```{r}
spy <- twsEquity("SPY", "SMART")
spy.opt <- twsOption(local = '', expiry = '20141031', strike = '196.5', right = 'C', symbol = 'SPY')
```
Next we'll pull price data for both the stock and option at 5 minute intervals over the last 6 days.
```{r, message=FALSE, cache=TRUE}
spy.d <- reqHistoricalData(tws, spy, barSize="5 mins", duration="6 D")
Sys.sleep(3)
spy.opt.d <- reqHistoricalData(tws, spy.opt, barSize="5 mins", duration="6 D")
data.p <- merge(spy.d[,6], spy.opt.d[,6], join="inner")
names(data.p) <- c("stock", "option")
```
We'll convert the price data into arithmetic returns.
```{r}
data.r <- xts(apply(data.p, 2, Delt)[-1,], order.by=index(data)[-1])
```
Here are plots of the absolute value of returns (volatility).
```{r}
chartSeries(abs(data.r$stock))
chartSeries(abs(data.r$option))
```
### What do you notice about the relative volatilities?
```{r}
apply(data.r, 2, sd)
```
### Do the same for some other option and underlying stock (the resulting charts should be in your html submission).
Consider the results of the following regressions.
Regression of the change in the option price on the change in the stock price.
```{r}
summary(lm(diff(data.p$option)[-1] ~ diff(data.p$stock)[-1]))
```
Regression of the **percent** change in the option price on the change in the stock price.
```{r}
summary(lm(data.r$option ~ data.r$stock))
```
### Can you draw any conclusion from these regressions?