I've been working out some European option values, largely using the code in http://quantlib.org/reference/_equity_option_8cpp-example.html . However, the code in those examples accepts Dates as time parameters. In particular, these constructors:
FlatForward(Date settlementDate, Real riskFreeRate, DayCounter dayCounter);
FlatForward(Date settlementDate, Real dividendYield, DayCounter dayCounter);
BlackConstantVol(Date settlementDate, Real volatility, DayCounter dayCounter);
However, I'd like to use arbitary periods, such as 0.1 of a year, as lengths of time til maturity. Converting these to dates may result in rounding to the nearest day and affect the results. Also, I want to avoid leap years/month lengths/public holidays etc from affecting any results. I attempted to use the period class but it seemed to take only integer values of years and days.
Ideally I'd want the option to use the above constructors like the following:
This way I do not have to worry about the implimentation of the calendar affecting my results. And also I could choose arbitary lengths, instead of being constrained to day boundaries.
If anyone knows a way to solve/work around this issue, help would be much appreciated.