DiscretizedDiscountBond and Tree

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

DiscretizedDiscountBond and Tree

koray sarıteke

I am going to write tree enigne for bond -like TreeVanillaSwapEngine- but DiscretizedDiscountBond class membership function mandatoryTimes() returns empty vector. I am going to use HullWhite::tree for tree.

How can I form timeGrid for bond.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: DiscretizedDiscountBond and Tree

Allen Kuo
 
> I am going to write tree enigne for bond -like TreeVanillaSwapEngine- but DiscretizedDiscountBond

> class membership function mandatoryTimes() returns empty vector. I am going to use HullWhite::tree >for tree.

> How can I form timeGrid for bond.

 

I think the base class which you d erive from when you create your TreeXXXEngine class creates the time grid for you, as long as you pass in the number of grid points into your TreeXXXEngine constructor and call the base class appropriately. That base class is LatticeShortRateModelEngine.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Linear Interpolation

marco.tarenghi

Hi all,
I was performing some debug and I fell in the linearinterpolation.hpp file.
There is something puzzling me:
If I understood it right, the class LinearInterpolationImpl takes a vector of abscissas "x" and a vector of corresponding values "y"
They have obviously the same size
But there is also a vector "s_" which seems to be the vector of slopes necessary for the interpolation: it is set of the same size of "x" and "y" but the last value is never fixed and is left equal to zero.
So if I should need to extrapolate outside the last abscissa it would be done in a flat way
Shouldn't it be more natural to go on interpolating linearly, possibly using the same slope of the one between the last two abscissas?
I would write a condition like
        s_[s_.size()-1] = s_[s_.size()-2];
at the end of the function update()

What do you think?

Thanks a lot
Marco



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: DiscretizedDiscountBond and Tree

Luigi Ballabio
In reply to this post by koray sarıteke
On Mon, 2007-07-30 at 13:24 +0300, koray sarıteke wrote:
> I am going to write tree enigne for bond -like TreeVanillaSwapEngine-
> but DiscretizedDiscountBond class membership function mandatoryTimes()
> returns empty vector. I am going to use HullWhite::tree for tree.

Korai,
        DiscretizedDiscountBond is a very simple implementation of a
zero-coupon bond---it is more an utility for building other instruments
than an instrument itself. For an example of a full-featured instrument,
you can look at DiscretizedSwap (which rolls back both a fixed-rate and
a floating-rate leg.) To see how to add callability to an instrument,
look at DiscretizedSwaption.

Later,
        Luigi


--

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



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Linear Interpolation

Luigi Ballabio
In reply to this post by marco.tarenghi
On Wed, 2007-08-01 at 10:24 +0200, [hidden email]
wrote:

> I was performing some debug and I fell in the linearinterpolation.hpp
> file.
> There is something puzzling me:
> If I understood it right, the class LinearInterpolationImpl takes a
> vector of abscissas "x" and a vector of corresponding values "y"
> They have obviously the same size
> But there is also a vector "s_" which seems to be the vector of slopes
> necessary for the interpolation: it is set of the same size of "x" and
> "y" but the last value is never fixed and is left equal to zero.
> So if I should need to extrapolate outside the last abscissa it would
> be done in a flat way

Ciao Marco,
        I had a look at the file. It seems that a problem slipped in---once you
create a LinearInterpolation object, you need to call its update()
method manually before it can be used.

Once you do this, the extrapolation is performed linearly. I think that
the last value of s_ is never used. Even though for some reason s_ is
created the same size as x and y, we need one fewer value; there are
only N-1 slopes between N points.

Later,
        Luigi


--

Brady's First Law of Problem Solving:
When confronted by a difficult problem, you can solve it more
easily by reducing it to the question, "How would the Lone
Ranger have handled this?"



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users