lballabio / QuantLib

The QuantLib C++ library
http://quantlib.org
Other
5.36k stars 1.79k forks source link

FD American Barrier Engine #322

Closed tournierjc closed 5 years ago

tournierjc commented 7 years ago

Hello,

I was wondering why the current FdBlackScholesBarrierEngine is limited to European Exercise?

Removing from FdBlackScholesBarrierEngine and FdBlackScholesRebateEngine :

QL_REQUIRE(arguments_.exercise->type() == Exercise::European,
                   "only european style option are supported");

And replacing in FdBlackScholesBarrierEngine :

boost::shared_ptr<FdmStepConditionComposite> conditions(
            boost::make_shared<FdmStepConditionComposite>(stoppingTimes, stepConditions));

By :

const boost::shared_ptr<FdmStepConditionComposite> conditions =
            FdmStepConditionComposite::vanillaComposite(
                                arguments_.cashFlow, arguments_.exercise, 
                                mesher, calculator, 
                                process_->riskFreeRate()->referenceDate(),
                                process_->riskFreeRate()->dayCounter());

Should make it works correctly.

Maybe @klausspanderen it the best one to answer?

klausspanderen commented 7 years ago

Hi

IMO this is going to work for DownOut and UpOut barrier options. I would also change the boundary condition to match the max out of rebate and the option payoff at the barrier. By doing so we'd avoid large first and second order derivatives at the boundary.

I'm not so sure for DownIn and UpIn barrier options. They are priced as

DownIn = Option - DownOut UpIn = Option - UpOut

and out of the top of my head I'd say that this decomposition does not hold true for American and Bermudan option.

tournierjc commented 7 years ago

Hello Klaus,

Thanks for your reply. You're right for the Down & In and Up & In barriers, this doesn't work.

It seems a workaround is explained in "P. Wilmott: Derivatives, The Theory and Pratice of Financial Engineering", regarding a time dependant boundary condition.

I'll look into it.

klausspanderen commented 7 years ago

Independent of the outcome I'd suggest to apply your changes to DownOut and UpOut barrier options.

lballabio commented 7 years ago

I agree. Instead of deleting the QL_REQUIRE, you can use it to check that the exercise type and the barrier type are compatible, after which you can change the step conditions safely. Are you willing to submit a pull request?

tournierjc commented 7 years ago

Hello Luigi,

I'll do as you suggest and make a PR. I'm a QLNet developer, so I'll backport it to Quantlib the best way I can.

lballabio commented 7 years ago

Ok, no problem.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 5 years ago

This issue has been automatically closed as stale.