Re: Question on convertible bond (with discretesdividends)

Posted by benoit houzelle on
URL: http://quantlib.414.s1.nabble.com/Question-on-convertible-bond-with-discretesdividends-tp6450p6451.html

Sorry in the last code the discount was computed in the loop ... Delicta juventutis meæ 
if the discount is computed out of the loop the computation time is roughly the same
 
I don't know what you call a patch so I send you the cpp file
 
Regards,
 
 

--- En date de : Jeu 10.12.09, Luigi Ballabio <[hidden email]> a écrit :

De: Luigi Ballabio <[hidden email]>
Objet: Re: [Quantlib-users] Question on convertible bond (with discretesdividends)
À: "benoit houzelle" <[hidden email]>
Cc: [hidden email], [hidden email]
Date: Jeudi 10 Décembre 2009, 17h03

On Thu, 2009-12-10 at 15:10 +0000, benoit houzelle wrote:

>         Your are right ! so we just change (thanks to Samuel Lerouge)
>         function
>         Disposable<Array> DiscretizedConvertible::adjustedGrid()
>         const
>         
>         Now the first spot node is 35.9996 (not 36 because we substact
>         NPV of dividend without grid adjustement and we add NVP
>         dividend with grid adjustement)
>         
>         To have exactly 36 replace
>         Time dividendTime = dividendTimes_[i];
>         by
>         Time dividendTime =
>         process_->riskFreeRate()->dayCounter().yearFraction(arguments_.settlementDate, arguments_.dividendDates[i]);
>         
>         The calculation time increases from 1s to 3s with my
>         configuration, it's why we used just once discount function.
>

Is the time increase due to the calls to yearFraction(), discount(), or
both?  What if we precompute dividendTimes_ correctly, i.e., if we put
your dividendTime formula in the DiscretizedConvertible constructor
(around line 69)?  We could also precompute the discounts in some way.

Anyway, send me a patch and I'll apply it to the repository.

Luigi


--

It is always the best policy to tell the truth, unless, of course,
you are an exceptionally good liar.
-- Jerome K. Jerome




------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev

_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

after_Modification.jpg (52K) Download Attachment
discretizedconvertible.cpp (12K) Download Attachment