Posted by
Luigi Ballabio on
URL: http://quantlib.414.s1.nabble.com/Question-on-convertible-bond-with-discretesdividends-tp6450p6455.html
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