2
$\begingroup$

I need to construct a Trinomial Tree for Hull-White model. Looking at the docs:

http://quantlib.org/reference/modules.html

or http://quantlib.org/reference/search.php?query=Trinomial

I see many modules or members that match trinomial.

How would I know which to use?

Or if I do something like:

model = HullWhite(term_structure);

How would I know if the TreeSwaptionEngine has selected a Trinomial tree and is it possible to print the tree or visualize with Graphviz?

I've looked at the examples here but it is still not obvious how these map back to the C++

$\endgroup$
2
$\begingroup$

Note: you can specify the mean reversion level and volatility for your HullWhite model with

model = HullWhite(term_structure, my_level, my_sigma);

Once you establish your model with the HullWhite constructor, there is a method you can use:

enter image description here

Do you see the tree method? You will need to specify what grid you want for your lattice. The implementation for the method looks like what you're looking for:

enter image description here

The method returns a pointer to Lattice. It defines the following methods:

virtual void rollback(DiscretizedAsset&, Time to) const = 0;

This method rolls back the tree to your present date, and thus price your instrument. Please take a look at the section about Lattice in Luigi Ballabio's QuantLib book. It teaches you how to deal with lattice in QuantLib.

$\endgroup$
  • $\begingroup$ thanks, from this how would that translate to using in Quanlib_Python? Is there a pattern that should be followed to translate? $\endgroup$ – toasteez Jan 26 '17 at 6:59
  • $\begingroup$ @toasteez I'm sure there is one-to-one translation. If you see something in Python, it also appears in C++ under the same name. $\endgroup$ – SmallChess Jan 26 '17 at 7:00
  • $\begingroup$ The tree method is not exported to Python. You can instantiate a Hull-White model and use it to price an instrument by passing it to the proper pricing engine, but there's no way to inspect the tree. For that, the needed interfaces should be added to the wrappers. $\endgroup$ – Luigi Ballabio Jan 27 '17 at 10:43
  • $\begingroup$ @LuigiBallabio You mean FDM pricing engine? $\endgroup$ – SmallChess Jan 27 '17 at 10:44
  • $\begingroup$ I mean an engine such as TreeSwaptionEngine, which takes a handle to a short-rate model. $\endgroup$ – Luigi Ballabio Jan 27 '17 at 10:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.