Displaying 1 result from an estimated 1 matches for "expiry_dt".
Did you mean:
expiry_day
2011 Jan 12
1
snowfall
...e to maturity for the option
require(fCalendar,quietly=TRUE) #Trying to calculate the trading days
require(fractalrock,quietly=TRUE) #Just to calculate the trading days
myFinCenter="Asia/Singapore"
getTimeToMaturity <- function(x){
tryCatch({
toDt <- as.Date(as.character(x['EXPIRY_DT']), "%Y-%m-%d")
#Expiry Date
fromDt <- as.Date(as.character(x['TIMESTAMP']), "%Y-%m-%d")
#Trade Timestamp
NoOfDays <- NROW(getTradingDates(toDt,fromDt))
return(NoOfDays/252)
},
error = function (ex){
#print (paste("Error in",toDt,fromDt))...