plotImpliedVol: Plots the Volatility Skew given a dataframe of options data

Description Usage Arguments Author(s) References Examples

View source: R/b76.r

Description

Given a dataframe with the columns
1) strike # the option strike - in $
2) type # either c for call option or p for a put option
3) optionPrice # the option price - in $
4) futurePrice # the price of the underlying future - in $
5) time_to_expiry

plotImpliedVol() plots the Implied Volatility across Call & Put options and option time to expiry.

Risk Free Rate r is taken from 3-Month US T-Bills of the specified date argument

Usage

1
plotImpliedVol(df, date="2019-09-18", mode="B")

Arguments

df

Data Frame with 5 columns:
1) strike ("numeric" or "double")
2) type ("string")
3) optionPrice ("numeric" or "double")
4) futurePrice ("numeric" or "double")
5) time_to_expiry ("numeric" or "double")

date

Date of option data ("character" in format "yyyy-mm-dd" including quotes)

mode

Specify plots based on different mode types
1) "C" plots Implied Volatility of Call options across varying time to expiry
2) "P" plots Implied Volatility of Put options across varying time to expiry
3) default - "B" plots Implied Volatility of options across varying time to expiry
4) "CP" plots Implied Volatility of Call options against Strike options without varying across time to expiry

Author(s)

Jason Yip

References

https://www.glynholton.com/notes/black_1976/

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
df = data.frame(
      strike = c(50, 23, 48, 24, 52, 20,51,22,49),
      type = c("C","P","C","P","C","P","C","P","C"),
      optionPrice = c(1.62,0.01,1.62,0.01,1.62,0.01,1.5,0.02,1.7),
      futurePrice = c(48.03, 48.03,48.03, 48.03,48.03, 48.03, 48.03, 48.03, 48.03),
      time_to_expiry = c(0.1423, 0.1423,0.1323, 0.1323,0.1223, 0.1223, 0.12, 0.11, 0.15))

plotImpliedVol(df, date="2018-09-18", mode="B")
plotImpliedVol(df, date="2018-09-18", mode="C")
plotImpliedVol(df, date="2018-09-18", mode="P")
plotImpliedVol(df, date="2018-09-18", mode="CP")

jasonyip184/b76 documentation built on May 28, 2019, 7:35 a.m.