Description Usage Arguments Details Value Author(s) See Also
View source: R/compute_implied_volatility.R
append_implied_volatility
returns a dataframe with European Option implied volatilities
1 2 | append_implied_volatility(df, risk_free_rate = 0.01,
initial_volatility_guess = 0.5)
|
df |
Dataframe with columns named type, value, underlying, strike, and maturity |
risk_free_rate |
Risk-free rate (number, default: 0.01) |
initial_volatility_guess |
Initial guess for the volatility (number, default: 0.5) |
This function computes the volatilty of a European Option for each row
in the dataframe that is passed to it. It will do so using the
compute_implied_volatility
function in this package, which is a
wrapper around the EuropeanOptionImpliedVolatility
function from the
RQUantLib
package.
The columns in the dataframe should be as follows:
- type
: One of the two values: 'call' or 'put' (string)
- value
: Value of the option (number)
- underlying
: Current price of the underlying (number)
- strike
: Strike price of the option (number)
- maturity
: Time to maturity in fractional years (number)
TODO: Model/financial restrictions on the parameters should be made clear here...
The EuropeanOptionImpliedVolatility
function asks for a
dividend_yield
which we assume to be 0 as this is not a stock.
Fore more information about RQuantLib: https://cran.r-project.org/web/packages/RQuantLib/RQuantLib.pdf
For more information about QuantLib: http://quantlib.org/index.shtml
implied volatility of a European Option appended (dataframe)
John Dole <jdoleiv@gmail.com>
EuropeanOptionImpliedVolatility
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.