Warning: ^NSEI contains missing values. Some functions will not work if objects
contain missing values in the middle of the series. Consider using na.omit(),
na.approx(), na.fill(), etc to remove or replace them.
Hedge pricing
Calculate implied volatility
First we have to extract nifty data using tidyquant or Rquantlib.
Get closing price
Code
# Extract the last closing price directly from nifty_data
closing_price <- nifty_data[.N, close]
closing_price[1] 25966.4
Implied Volatility calculation
Plugin the latest option price for a liquid strike price with a 4 month maturity to get a reasonably accurate implied volatility.
Code
library(quantmod)
library(RQuantLib)
# Define option parameters for a single observation
nifty_price<-25966.4
option_price <- 85 # Current market price of the option
strike_price <- 25966.4*.8 # Strike price of the option
time_to_expiry <- 365/365 # Time to expiration in years
risk_free_rate <- 0.071 # Risk-free interest rate
volatility_guess <- 0.2 # Initial guess for the volatility
# Calculate implied volatility for a put option
vol<- EuropeanOptionImpliedVolatility(type = "put",value =option_price ,underlying = nifty_price,strike = strike_price,dividendYield = 0,riskFreeRate = risk_free_rate,maturity = time_to_expiry,volatility = .2)
vol[1] 0.1794754
attr(,"class")
[1] "EuropeanOptionImpliedVolatility" "ImpliedVolatility"
At present the implied volatility is 18
Option pricing calculation
Aim for a strike less than 10 delta. Plugin the implied volatility and other data.
Code
closing_price<-25966
strike <- 25966 * 0.85 # Strike price of the option
time_to_expiry <- 365/365 # Time to expiration in years
risk_free_rate <- 0.071 # Risk-free interest rate
price<-EuropeanOption(type = "put",underlying = closing_price,strike = strike,dividendYield = 0,riskFreeRate = risk_free_rate,maturity = time_to_expiry,volatility = vol)
cat("Closing price of nifty:\n")Closing price of nifty:
Code
print(closing_price)[1] 25966
Code
cat("Strike price:\n")Strike price:
Code
strike[1] 22071.1
Code
priceConcise summary of valuation for EuropeanOption
value delta gamma vega theta rho divRho
187.8179 -0.0821 0.0000 3937.7416 -188.6070 -2320.5182 2132.7003
Price of a 12 month 8 delta option is 188 for the given strike price
Take home message
Before buying hedge, plugin the market price, strike price, time to maturity, implied volatility and risk free rate to the BS formula and find out the fair value. Then only buy the hedge.
Code
closing<-25966
strikerate <- 21000 # Strike price of the option
time<- 365/365 # Time to expiration in years
risk_free_rate <- 0.071 # Risk-free interest rate
vol<-vol # implied volatility
price<-EuropeanOption(type = "put",underlying = closing,strike = strikerate,dividendYield = 0,riskFreeRate = risk_free_rate,maturity = time,volatility = vol)
priceConcise summary of valuation for EuropeanOption
value delta gamma vega theta rho divRho
98.6349 -0.0477 0.0000 2577.1354 -136.4082 -1336.0278 1237.3930
Code
strikerate[1] 21000
Monetising the hedge
§a passive - at the time of expiry.
§b Empirical multiples of Initial cost.
§a is ideal for long time horizon with potential big drawdown happening once or twice. §b out performs §a if no such tail events occur. In such a situation, even no-hedge strategy performs better than one with a hedge.
For the hedging to outperform a pure buy and hold strategy with out hedging, it should be monitised at 8- 10 times the initial premium or a catastrophy should happen. In any case, the proceedings should be used to buy further far OTM puts and rest may be invested in the crashing asset.