|
From: Jonathan S. <sw...@gm...> - 2022-07-04 20:58:58
|
Hi Michele,
If you want your new FdHestonPartialTimeBarrierEngine to operate on
PartialTimeBarrierOption then it should be parameterized on
PartialTimeBarrierOption::arguments and ::results just like
AnalyticPartialTimeBarrierOptionEngine is.
Whether or not you need to make a new DividendPartialTimeBarrierOption
depends on your modeling requirements and whether PartialTimeBarrierOption
already has everything you need or not.
For the pricing logic in FdHestonPartialTimeBarrierEngine, do you have a
paper or other source that you can refer to? If not, then perhaps someone
else on this mailing list can help point you in the right direction - I’m
afraid I have not worked with this combination of model and instrument
before.
2022년 7월 4일 (월) 22:34, Michele dL <mdi...@gm...>님이 작성:
> Hi Jonathan,
>
> Thanks for your answer. This is what I did indeed. I have a copy of
> fdhestonbarrierengine.hpp and fdhestonbarrierengine.cpp as follows:
>
> Header file:
> class FdHestonPartialTimeBarrierEngine
> : public GenericModelEngine<HestonModel,
> DividendBarrierOption::arguments,
> DividendBarrierOption::results> {
> public:
> // Constructor
> explicit FdHestonPartialTimeBarrierEngine(
> const ext::shared_ptr<HestonModel>& model,
> Size tGrid = 100,
> Size xGrid = 100,
> Size vGrid = 50,
> Size dampingSteps = 0,
> const FdmSchemeDesc& schemeDesc = FdmSchemeDesc::Hundsdorfer(),
> ext::shared_ptr<LocalVolTermStructure> leverageFct =
> ext::shared_ptr<LocalVolTermStructure>(),
> Real mixingFactor = 1.0);
>
> void calculate() const override;
>
> private:
> const Size tGrid_, xGrid_, vGrid_, dampingSteps_;
> const FdmSchemeDesc schemeDesc_;
> const ext::shared_ptr<LocalVolTermStructure> leverageFct_;
> const Real mixingFactor_;
> };
>
> Source file:
> FdHestonPartialTimeBarrierEngine::FdHestonPartialTimeBarrierEngine(const
> ext::shared_ptr<HestonModel>& model,
> Size tGrid,
> Size xGrid,
> Size vGrid,
> Size dampingSteps,
> const FdmSchemeDesc&
> schemeDesc,
>
> ext::shared_ptr<LocalVolTermStructure> leverageFct,
> const Real mixingFactor)
> : GenericModelEngine<HestonModel,
> DividendBarrierOption::arguments,
> DividendBarrierOption::results>(model),
> tGrid_(tGrid), xGrid_(xGrid), vGrid_(vGrid),
> dampingSteps_(dampingSteps),
> schemeDesc_(schemeDesc), leverageFct_(std::move(leverageFct)),
> mixingFactor_(mixingFactor) {
> std::cout<<" HestonBarrierEngine \n";
> }
>
> Probably the error arises from the wrong pricing logic. Here I'm using
> DividendBarrierOption and I have not created a
> DividendPartialTimeBarrierOption. Maybe this is the problem?
>
> Thanks,
> Michele
>
> Il giorno lun 4 lug 2022 alle ore 13:31 Jonathan Sweemer <
> sw...@gm...> ha scritto:
>
>> Hi Michele,
>>
>> When you say that you "replaced" DividendBarrierOption arguments and
>> results with PartialTimeBarrierOption, do you mean that you modified the
>> existing fdhestonbarrierengine.hpp file?
>>
>> If that's what you mean, then you'll first have to create a copy of
>> fdhestonbarrierengine.hpp and give your class a new name such as
>> FdHestonPartialTimeBarrierEngine and then also copy the cpp file and modify
>> the code to implement the pricing logic.
>>
>> If that's not what you mean then could you share your code along with the
>> full compiler error that you're seeing?
>>
>> On Mon, Jul 4, 2022 at 8:21 PM Michele dL <mdi...@gm...> wrote:
>>
>>> Hi all,
>>>
>>> I'm trying to use the Heston model to price a window barrier option.
>>>
>>> With standard barrier option under BSM model one could use the
>>> analytical engine with the following inheritance
>>> class AnalyticPartialTimeBarrierOptionEngine
>>> : public PartialTimeBarrierOption::engine
>>>
>>>
>>> In my case, I would like to use something similar to the
>>> fdHestonBarrierEngine
>>>
>>> class FdHestonBarrierEngine
>>> : public GenericModelEngine<HestonModel,
>>> DividendBarrierOption::arguments,
>>> DividendBarrierOption::results>
>>>
>>> However, in this case a problem with argument arises. I tried in vain
>>> replacing DividentBarrierOption::arguments and
>>> DividentBarrierOption::results with PartialTimeBarrierOption::arguments and
>>> PartialTimeBarrierOption::results, respectively.
>>> It seems that inside the engine it requires arguments_.cashFlow which is
>>> not defined inside PartialTimeBarrierOption.
>>>
>>> Can anyone suggest any possible fix to use PartialTimeBarrierOption with
>>> fdHestonBarrierEngine, please?
>>>
>>> Thanks
>>>
>>> _______________________________________________
>>> QuantLib-users mailing list
>>> Qua...@li...
>>> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>>>
>>
|