|
I am getting exception "Negative or null underlying given" while trying to use quantlib Options. Please see below code -
shared_ptr<OneAssetOption> optionPtr;
shared_ptr<StrikedTypePayoff> payoffPtr;
shared_ptr<Exercise> exercisePtr;
payoffPtr.reset(CreatePayoff());
exercisePtr.reset(new EuropeanExercise(maturity));
optionPtr.reset(new VanillaOption(payoffPtr, exercisePtr));
optionPtr->setPricingEngine(enginePtr);
optionPtr->NPV();
optionPtr->delta();
I am new to Quantlib Options so the question might be very basic but please let me know what am I missing.
Thanks!
|