Hello,
there seems to be no documentation in the library. However, I think
the definition of the instrument and the implemented formula were described
in the Haug book, so you might be able to look it up in there.
Hope this helps,
Luigi
On Wed, Aug 31, 2022 at 3:34 PM Ashish Bansal <ash...@gm...>
wrote:
> Hi all,
>
> Thanks to *Ignacio Anguita* for exposing the Partial Time Barrier to
> SWIG.
>
> I have a query on the partial time barrier code. The partial time barrier
> takes the following parameters:
> PartialTimeBarrierOption
> <https://rkapl123.github.io/QLAnnotatedSource/da/dff/class_quant_lib_1_1_partial_time_barrier_option.html#ab8da08fcc53903a7acc616bad018c41f>
> (PartialBarrier::Type
> <https://rkapl123.github.io/QLAnnotatedSource/de/d3f/struct_quant_lib_1_1_barrier.html#a1d1cfd8ffb84e947f82999c682b666a7>
> barrierType, PartialBarrier::Range
> <https://rkapl123.github.io/QLAnnotatedSource/dd/d8c/struct_quant_lib_1_1_partial_barrier.html#a1b00d070baaf3fae8b605e1b7c578c11>
> barrierRange, Real
> <https://rkapl123.github.io/QLAnnotatedSource/d6/d59/group__types.html#ga4bdf4bfe76b9ffa6fa64c47d8bfa0c78>
> barrier, Real
> <https://rkapl123.github.io/QLAnnotatedSource/d6/d59/group__types.html#ga4bdf4bfe76b9ffa6fa64c47d8bfa0c78>
> rebate, Date
> <https://rkapl123.github.io/QLAnnotatedSource/db/d60/class_quant_lib_1_1_date.html> coverEventDate,
> const ext::shared_ptr< StrikedTypePayoff
> <https://rkapl123.github.io/QLAnnotatedSource/d1/d0d/class_quant_lib_1_1_striked_type_payoff.html> >
> &payoff
> <https://rkapl123.github.io/QLAnnotatedSource/d2/df1/class_quant_lib_1_1_option.html#a90fda1cc5aac8151c1c05c22a130ba44>,
> const ext::shared_ptr< Exercise
> <https://rkapl123.github.io/QLAnnotatedSource/dd/db4/class_quant_lib_1_1_exercise.html> >
> &exercise
> <https://rkapl123.github.io/QLAnnotatedSource/d2/df1/class_quant_lib_1_1_option.html#a4522b2c0857c9f8a24a7f9bf9600a3e0>
> )
>
> https://rkapl123.github.io/QLAnnotatedSource/da/dff/class_quant_lib_1_1_partial_time_barrier_option.html
>
> Here most of the parameters are the same as barrier options except Barrier
> Range and coverEventDate.
>
> Could you guide me on the following:
> 1. What is *coverEventDate*?
> 2. *barrierRange* seems to be the barrier range when the barrier is
> active. In it Start and end date are self explanatory and looks like
> barrier period start and end. What does EndB1 and EndB2 mean? These are
> important for knock-out barriers as per the code. Pasting the code below.
> 3. Lastly, could we run this code for barrier trades with a barrierRange
> of 1 day i.e. same date in Start and End/EndB1. I need to price the barrier
> option where the barrier is only active on the expiry date; kind of a
> European option where the strike for exercise check is different from
> strike for settlement.
>
> Barrier range code:
> ====================================================================
> Range
> <https://rkapl123.github.io/QLAnnotatedSource/dd/d8c/struct_quant_lib_1_1_partial_barrier.html#a1b00d070baaf3fae8b605e1b7c578c11>
> { Start
> <https://rkapl123.github.io/QLAnnotatedSource/dd/d8c/struct_quant_lib_1_1_partial_barrier.html#a1b00d070baaf3fae8b605e1b7c578c11abd5f9c956752ce4dc707b4624b3a36f7>
> , End
> <https://rkapl123.github.io/QLAnnotatedSource/dd/d8c/struct_quant_lib_1_1_partial_barrier.html#a1b00d070baaf3fae8b605e1b7c578c11a667876a6f108081ad524d7d29d23d506>
> , EndB1
> <https://rkapl123.github.io/QLAnnotatedSource/dd/d8c/struct_quant_lib_1_1_partial_barrier.html#a1b00d070baaf3fae8b605e1b7c578c11a30c5d1087c14b857484dfb4cad6e28d2>
> , EndB2
> <https://rkapl123.github.io/QLAnnotatedSource/dd/d8c/struct_quant_lib_1_1_partial_barrier.html#a1b00d070baaf3fae8b605e1b7c578c11abbc2243a0c6f322be3cf6fe2c57fbc93>
> }
>
> https://rkapl123.github.io/QLAnnotatedSource/dd/d8c/struct_quant_lib_1_1_partial_barrier.html#a1b00d070baaf3fae8b605e1b7c578c11abd5f9c956752ce4dc707b4624b3a36f7
>
> ----------------------------------------------------------------------------------------------------------------------------------
> // checking barrier type and suitable barrier range
> 61 switch (barrierType) {
> 62 case PartialBarrier::DownIn
> <https://rkapl123.github.io/QLAnnotatedSource/de/d3f/struct_quant_lib_1_1_barrier.html#a1d1cfd8ffb84e947f82999c682b666a7a6ab88de83b4e4e5bb228513984281c5f>
> :
> 63 case PartialBarrier::UpIn
> <https://rkapl123.github.io/QLAnnotatedSource/de/d3f/struct_quant_lib_1_1_barrier.html#a1d1cfd8ffb84e947f82999c682b666a7a8f909ed7a2ba7d90bc6cc0c0d06d6f43>
> :
> 64 QL_REQUIRE(barrierRange == PartialBarrier::Start
> <https://rkapl123.github.io/QLAnnotatedSource/dd/d8c/struct_quant_lib_1_1_partial_barrier.html#a1b00d070baaf3fae8b605e1b7c578c11abd5f9c956752ce4dc707b4624b3a36f7>
> ||
> 65 barrierRange == PartialBarrier::End
> <https://rkapl123.github.io/QLAnnotatedSource/dd/d8c/struct_quant_lib_1_1_partial_barrier.html#a1b00d070baaf3fae8b605e1b7c578c11a667876a6f108081ad524d7d29d23d506>
> ,
> 66 "in-barrier requires Start or End range");
> 67 break;
> 68 case PartialBarrier::DownOut
> <https://rkapl123.github.io/QLAnnotatedSource/de/d3f/struct_quant_lib_1_1_barrier.html#a1d1cfd8ffb84e947f82999c682b666a7a9defe9c8312773f17477f4a17f4c8292>
> :
> 69 case PartialBarrier::UpOut
> <https://rkapl123.github.io/QLAnnotatedSource/de/d3f/struct_quant_lib_1_1_barrier.html#a1d1cfd8ffb84e947f82999c682b666a7aebd63d98ea3bbdd87adceafd229d6edc>
> :
> 70 QL_REQUIRE(barrierRange == PartialBarrier::Start
> <https://rkapl123.github.io/QLAnnotatedSource/dd/d8c/struct_quant_lib_1_1_partial_barrier.html#a1b00d070baaf3fae8b605e1b7c578c11abd5f9c956752ce4dc707b4624b3a36f7>
> ||
> 71 barrierRange == PartialBarrier::EndB1
> <https://rkapl123.github.io/QLAnnotatedSource/dd/d8c/struct_quant_lib_1_1_partial_barrier.html#a1b00d070baaf3fae8b605e1b7c578c11a30c5d1087c14b857484dfb4cad6e28d2>
> ||
> 72 barrierRange == PartialBarrier::EndB2
> <https://rkapl123.github.io/QLAnnotatedSource/dd/d8c/struct_quant_lib_1_1_partial_barrier.html#a1b00d070baaf3fae8b605e1b7c578c11abbc2243a0c6f322be3cf6fe2c57fbc93>
> ,
> 73 "out-barrier requires Start, EndB1 or EndB2 range");
> 74 break;
> 75 default:
> 76 QL_FAIL("unknown barrier type");
>
> https://rkapl123.github.io/QLAnnotatedSource/de/d9b/partialtimebarrieroption_8cpp_source.html
> ==========================================================================
>
> Thanks in advance.
>
> Regards,
> Ashish
>
> _______________________________________________
> QuantLib-users mailing list
> Qua...@li...
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
|