Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
hudde committed Jan 31, 2024
1 parent b51fe60 commit 1328fe9
Showing 1 changed file with 2 additions and 25 deletions.
27 changes: 2 additions & 25 deletions R/Malliavin_Geometric_Asian_Greeks.R
Original file line number Diff line number Diff line change
Expand Up @@ -185,33 +185,10 @@ Malliavin_Geometric_Asian_Greeks <- function(

} #delta


if ("rho" %in% greek) {
rho <-
result[i, "rho"] <-
(W_T/volatility - time_to_maturity) %>%
E_paths()

rho_geom_fd <-
-time_to_maturity * exp(-r*time_to_maturity) * payoff(I_0_geom, exercise_price) +
(time_to_maturity/2) * exp(-(r - dividend_yield) * time_to_maturity) *
dpayoff(I_0_geom, exercise_price) * I_0_geom

cont <-
rho_geom_fd -
BS_Geometric_Asian_Greeks(
initial_price = initial_price,
exercise_price = exercise_price,
r = r,
time_to_maturity = time_to_maturity,
volatility = volatility,
dividend_yield = dividend_yield,
payoff = payoff_name,
greek = "rho"
)

model <- lm(rho ~ cont)

result[i, "rho"] <- model$coefficients["(Intercept)"]
E()
} #rho

if ("theta" %in% greek) {
Expand Down

0 comments on commit 1328fe9

Please sign in to comment.