|
From: Michele dL <mdi...@gm...> - 2022-07-04 13:34:18
|
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
>>
>
|