Posted by
Ken Anderson-2 on
URL: http://quantlib.414.s1.nabble.com/Problem-pricing-options-in-the-past-tp4501.html
I'm using the SWIG for Java of the latest download, and I have a problem with pricing options in the past. If I use current or future dates, it works fine, but the value is always zero in the past. Here's the code:
Date todaysDate = new Date(17,Month.February, 2006);
Date settlementDate = new Date(21, Month.February, 2006);
Date exerciseDate = new Date(24, Month.May, 2006);
DayCounter fixed365 = new Actual365Fixed();
EuropeanExercise exercise = new EuropeanExercise(exerciseDate);
PlainVanillaPayoff payoff = new PlainVanillaPayoff(Option.Type.Call, 58.0);
SimpleQuote underlyingQuote = new SimpleQuote(60.0);
FlatForward flatDividentTS = new FlatForward(settlementDate, 0.0, fixed365);
FlatForward flatTermStructure = new FlatForward(settlementDate, .06, fixed365);
BlackConstantVol flatVolTS = new BlackConstantVol(settlementDate, .20, fixed365);
BlackScholesProcess process = new BlackScholesProcess(new QuoteHandle(underlyingQuote),
new YieldTermStructureHandle(flatDividentTS),
new YieldTermStructureHandle(flatTermStructure),
new BlackVolTermStructureHandle(flatVolTS));
VanillaOption euroOption = new VanillaOption(process, payoff, exercise, new AnalyticEuropeanEngine());
System.out.println("Value: "+euroOption.NPV());
System.out.println("Delta: "+euroOption.delta());
The code above works OK, but if you change the dates to be 2005, it fails with 0.0 NPV and 0.0 delta. Any ideas?
Thanks,
Ken