View source: R/finite_difference_explicit.R
finite_difference_explicit | R Documentation |
The finite_difference_explicit function calculate option price using finite difference.
finite_difference_explicit(ds, dt, I, rate, volatility, End_Time, FUN, ..., is_modificate = FALSE)
ds |
numeric value, step size of the asset price. |
dt |
numeric value, step size of the time. |
I |
numeric value, number of steps in the stock price. |
rate |
numeric value, risk free rate in the model rate >= 0. |
volatility |
numeric value, volatility of the model, vol > 0. |
End_Time |
numeric value, end time of the option. |
FUN |
the function to be applied, payoff option. |
... |
arguments to FUN. |
is_modificate |
logical value, determines whether FUN payoff is from modified payoff or not, see 'Details'. |
When is_modificate is TRUE (so when as FUN is used option_linear_payoff, option_convex_payoff, option_concave_payoff or option_modificate_payoff),
there no need to write an risk free rate argument in ..., this argument is taken from rate argument.
Return of this option is a matrix. Rows determines changes of the option prices over time, when we price of the asset is not changing.
The price of the asset increases as the rows increase. Time to exercise of the option increases as the columns increase. For example first column
shows payoff price.
A numeric matrix, calculated price of the option using finite difference method, see 'Details'.
ds <- finding_parameters(100, 0.3, 600, 5)[1] dt <- finding_parameters(100, 0.3, 600, 5)[2] finite_difference_explicit(ds, dt, 600, 0, 0.3, 1, call_payoff, 100) finite_difference_explicit(ds, dt, 600, 0, volatility = 0.3, 1, FUN = option_modificate_payoff, const = 120, drift = 0.1, vol = 0.3, p = 1, call_payoff, 100, is_modificate = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.