knitr::opts_chunk$set(collapse=TRUE, # hadley comment = "#>", # hadley error=TRUE, purl=FALSE, # to be able to see errors fig.width=7.25, fig.height=6) # nice-sized pictures
library(ustreasuries)
PV <- 9000 FV <- 13000 years <- 3 # geometric # ========= (geometric <- CAGR(9000, 13000, years, type="geometric")) 9000 * (1 + geometric) ** years # continuous # ========== (continuous <- CAGR(9000, 13000, years, type="continuous")) 9000 * exp(continuous * years)
discrete <- 0.04 freq <- 2 # 4% compounded semi annually (continuous <- r_continuous(discrete, freq))
PV <- 9000 FV <- 13000 years <- 3 freq <- 2 # compounding frequency = 2 => semi-annual (continuous <- CAGR(PV, FV, years, type="continuous")) (discrete <- r_discrete(continuous, freq)) PV * (1 + discrete / freq) ** (freq * years) PV * exp(continuous * years)
PV <- 9000 FV <- 13000 years <- 3 freq <- 2 # compounding frequency = 2 => semi-annual (continuous <- CAGR(PV, FV, years, type="continuous")) (discrete <- r_discrete(continuous, freq)) (df_continuous <- discount_factor(continuous, years)) (df_discrete <- discount_factor(discrete, years, freq)) FV * df_continuous FV * df_discrete all.equal(df_continuous, df_discrete) # df_continuous == df_discrete
# Hull 7th edition Ch 17 P 357 Stock <- 49 Exercise <- 50 Time <- 20/52 Interest <- 0.05 Yield <- 0 sigma <- 0.20 EC = EuroCall(Stock, Exercise, Time, Interest, Yield, sigma) EP = EuroPut(Stock, Exercise, Time, Interest, Yield, sigma) PC = CallParity(Stock, Exercise, Time, Interest, Yield, EP) PP = PutParity(Stock, Exercise, Time, Interest, Yield, EC) writeLines(paste0("European Call Price:\t", EC, "\n", "Call Parity Price:\t\t", PC, "\n", "Difference:\t\t\t\t", EC-PC, "\n\n", "European Put Price:\t", EP, "\n", "Put Parity Price:\t\t", PP, "\n", "Difference:\t\t\t\t ", EP-PP))
Interest <- 0.05 Yield <- 0.10 sigma <- 0.20 deltaT <- 5 RiskNeutralProb(Interest, Yield, sigma, deltaT)
# Hull 7th edition Ch 5 P 103 # =========================== Spot <- 40 Time <- 0.25 Interest <- 0.05 Yield <- 0 Income <- 0 ForwardPrice(Spot, Time, Interest, Yield, Income) # Hull 7th edition Ch 5 P 105 # =========================== Spot <- 900 Time <- 0.75 Interest <- 0.04 Yield <- 0 Income <- 40 * exp(-0.03 * 4/12) # PV(40) = 39.60 ForwardPrice(Spot, Time, Interest, Yield, Income) # Hull 7th edition Ch 5 P 107 # =========================== Spot <- 25 Time <- 0.50 Interest <- 0.10 # convert 0.04 discrete to continuous Yield_d <- 0.04 Yield <- r_continuous(Yield_d, 2) Income <- 0 ForwardPrice(Spot, Time, Interest, Yield, Income)
# Investopia: Intrinsic Value # http://www.investopedia.com/terms/i/intrinsicvalue.asp Stock <- 25 # S_0 Exercise <- 15 # K IntrinsicValueCall(Stock, Exercise) # 10
# Investopia: Intrinsic Value # http://www.investopedia.com/terms/i/intrinsicvalue.asp Stock <- 15 # S_0 Exercise <- 25 # K IntrinsicValuePut(Stock, Exercise) # 10
# http://www.call-options.com/in-the-money.html Stock <- 37.75 # S_0 Exercise <- 35 # K InTheMoneyCall(Stock, Exercise) # TRUE
# http://www.call-options.com/in-the-money.html Stock <- 35 # S_0 Exercise <- 37.50 # K InTheMoneyPut(Stock, Exercise) # TRUE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.