In arrears adjustment

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

In arrears adjustment

Peter Caspers-4
Hi,

I think the in arrears adjustment in couponpricer.cpp is computed
slightly wrong. Shouldn't it be like in the adjusted code below?

Thanks, Peter

ql/cashflows/couponpricer.cpp

              // see Hull, 4th ed., page 550
              QL_REQUIRE(!capletVolatility().empty(),
                         "missing optionlet volatility");
              Date d1 = coupon_->fixingDate(),
+                 d2 = coupon_->index()->valueDate(d1),
                   referenceDate = capletVolatility()->referenceDate();
              if (d1 <= referenceDate) {
                  adjustement = 0.0;
              } else {
-                Date d2 = coupon_->index()->maturityDate(d1);
-                Time tau =
coupon_->index()->dayCounter().yearFraction(d1, d2);
+                Date d3 = coupon_->index()->maturityDate(d2);
+                Time tau =
coupon_->index()->dayCounter().yearFraction(d2, d3);
                  Real variance = capletVolatility()->blackVariance(d1,
fixing);
                  adjustement = fixing*fixing*variance*tau/(1.0+fixing*tau);
              }



------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: In arrears adjustment

pan zhou
http://www.xfcbbs.com/plugin.php?id=dsu_paulpromotionpro:dsu_paulpromotionpro

On Sat, Nov 3, 2012 at 2:09 PM, Peter Caspers <[hidden email]> wrote:
Hi,

I think the in arrears adjustment in couponpricer.cpp is computed
slightly wrong. Shouldn't it be like in the adjusted code below?

Thanks, Peter

ql/cashflows/couponpricer.cpp

              // see Hull, 4th ed., page 550
              QL_REQUIRE(!capletVolatility().empty(),
                         "missing optionlet volatility");
              Date d1 = coupon_->fixingDate(),
+                 d2 = coupon_->index()->valueDate(d1),
                   referenceDate = capletVolatility()->referenceDate();
              if (d1 <= referenceDate) {
                  adjustement = 0.0;
              } else {
-                Date d2 = coupon_->index()->maturityDate(d1);
-                Time tau =
coupon_->index()->dayCounter().yearFraction(d1, d2);
+                Date d3 = coupon_->index()->maturityDate(d2);
+                Time tau =
coupon_->index()->dayCounter().yearFraction(d2, d3);
                  Real variance = capletVolatility()->blackVariance(d1,
fixing);
                  adjustement = fixing*fixing*variance*tau/(1.0+fixing*tau);
              }



------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev


------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: In arrears adjustment

Luigi Ballabio
In reply to this post by Peter Caspers-4
Hi Peter,
    yes, your changes look correct to me.  Can anyone else validate
them?  Ferdinando?

Luigi

On Sat, Nov 3, 2012 at 7:09 PM, Peter Caspers <[hidden email]> wrote:

> Hi,
>
> I think the in arrears adjustment in couponpricer.cpp is computed
> slightly wrong. Shouldn't it be like in the adjusted code below?
>
> Thanks, Peter
>
> ql/cashflows/couponpricer.cpp
>
>               // see Hull, 4th ed., page 550
>               QL_REQUIRE(!capletVolatility().empty(),
>                          "missing optionlet volatility");
>               Date d1 = coupon_->fixingDate(),
> +                 d2 = coupon_->index()->valueDate(d1),
>                    referenceDate = capletVolatility()->referenceDate();
>               if (d1 <= referenceDate) {
>                   adjustement = 0.0;
>               } else {
> -                Date d2 = coupon_->index()->maturityDate(d1);
> -                Time tau =
> coupon_->index()->dayCounter().yearFraction(d1, d2);
> +                Date d3 = coupon_->index()->maturityDate(d2);
> +                Time tau =
> coupon_->index()->dayCounter().yearFraction(d2, d3);
>                   Real variance = capletVolatility()->blackVariance(d1,
> fixing);
>                   adjustement = fixing*fixing*variance*tau/(1.0+fixing*tau);
>               }
>
>
>
> ------------------------------------------------------------------------------
> LogMeIn Central: Instant, anywhere, Remote PC access and management.
> Stay in control, update software, and manage PCs from one command center
> Diagnose problems and improve visibility into emerging IT issues
> Automate, monitor and manage. Do more in less time with Central
> http://p.sf.net/sfu/logmein12331_d2d
> _______________________________________________
> QuantLib-dev mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-dev

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_nov
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: In arrears adjustment

Luigi Ballabio
In reply to this post by Peter Caspers-4
Peter,
    I committed the fix.  Thanks for the heads-up.

Luigi

On Sat, Nov 3, 2012 at 7:09 PM, Peter Caspers <[hidden email]> wrote:

> Hi,
>
> I think the in arrears adjustment in couponpricer.cpp is computed
> slightly wrong. Shouldn't it be like in the adjusted code below?
>
> Thanks, Peter
>
> ql/cashflows/couponpricer.cpp
>
>               // see Hull, 4th ed., page 550
>               QL_REQUIRE(!capletVolatility().empty(),
>                          "missing optionlet volatility");
>               Date d1 = coupon_->fixingDate(),
> +                 d2 = coupon_->index()->valueDate(d1),
>                    referenceDate = capletVolatility()->referenceDate();
>               if (d1 <= referenceDate) {
>                   adjustement = 0.0;
>               } else {
> -                Date d2 = coupon_->index()->maturityDate(d1);
> -                Time tau =
> coupon_->index()->dayCounter().yearFraction(d1, d2);
> +                Date d3 = coupon_->index()->maturityDate(d2);
> +                Time tau =
> coupon_->index()->dayCounter().yearFraction(d2, d3);
>                   Real variance = capletVolatility()->blackVariance(d1,
> fixing);
>                   adjustement = fixing*fixing*variance*tau/(1.0+fixing*tau);
>               }
>
>
>
> ------------------------------------------------------------------------------
> LogMeIn Central: Instant, anywhere, Remote PC access and management.
> Stay in control, update software, and manage PCs from one command center
> Diagnose problems and improve visibility into emerging IT issues
> Automate, monitor and manage. Do more in less time with Central
> http://p.sf.net/sfu/logmein12331_d2d
> _______________________________________________
> QuantLib-dev mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-dev

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev