Displaying 1 result from an estimated 1 matches for "gettimetomatur".
2011 Jan 12
1
snowfall
...parallel (not sure if this is an efficient
implementation):
#Function to calculate the time 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/...