Posted by
Luigi Ballabio on
Jan 14, 2005; 8:38am
URL: http://quantlib.414.s1.nabble.com/Quantlib-tp3506p3509.html
On 01/13/05 18:55:23, Przemyslaw Sliwa wrote:
> I would like to work around credit derivatives if you need something in
> this direstion, callibration of default probabilities, coupulas and some
> stochastic volatility options: heston, white-hul, etc. Is there a need to
> make it? I have also a bit of experince in numerical analysis,
Sure--in general, there is need of anything which in not in the library
already :) Credit derivatives would be an expecially welcome addition.
> So, if there is no spec for the Quantlib how should we know what C++
> technique is prefered? Templates or multiple inheritance? What is the
> prefered naming convention for the namespaces,classes, etc.
As to templates or inheritance, we usually go for abstract base classes
defining an interface as virtual functions and derived classes implementing
it. On the other hand, the implementation of the derived classes often uses
templates :) (you can see an example if you look at PricingEngine and its
many children.)
As to naming conventions and such, there's a style guide at
<
http://quantlib.org/style.shtml> (which, methinks, I sometimes violate
myself.) But don't take it too seriously.
And as to namespaces, there's only one namespace QuantLib, with the
addition of a sub-namespace QuantLib::detail used for classes and functions
which are not part of the library interface (in other words, they are
implementation details) but that one can't avoid putting in a header file
(e.g., because they're template.) When it is possible to define such
functions in a .cpp, they're defined in an anonymous namespace.
> How should I start from scratch?
Seeing as you're willing to work on credit derivatives, I'd suggest you to
look at yield term structures to see how they're implemented---the relevant
files are ql/basetermstructure.hpp, ql/termstructure.hpp, and those in the
directory ql/TermStructures. You can build on that framework. By all
means, feel free to ask anything you need.
Later,
Luigi