Login  Register

Customizing QLAddin: mini how-to + question

Posted by ago-2 on Feb 08, 2006; 9:02am
URL: http://quantlib.414.s1.nabble.com/Customizing-QLAddin-mini-how-to-question-tp4453.html

I was trying to customize the QLAddin. I first tried to edit the .cpp files
manually and I failed miserably. Then I discovered srcgen, boy was I pleased! If
this can save some time to others the procedure to add new functionality is
fairly simple and it involves the following steps:

1) Edit QuantLibAddin-Z.Y.X\srcgen\XYZ.xml
2) python srcgen.py -s (or other flag according to the target addin)
3) Recompile QuantLibAddin
4) Use the addin in QuantLibAddin-Z.Y.X\Addins\ExcelStatic\xll

Further info here http://quantlib.org/quep/quep012.htm

There are some glitches:

* Most annoying is that if the xll is not properly loaded, the "Insert Function"
wizard will cause excel to crash.

* Some of the exposed objects do not have a getObject() method, so, in order to
use their methods you also need to modify the appropriate QuantLibAddin/XYZ.hpp
file and add a line like this to the relevant object:

const QuantLib::RateHelper& getObject() const {return *rateHelper_;}

I think that a good policy would be to add getObject to all objects.

* I do not know how to "concatenate" objects in a single function call (assuming
it is possible to do so). E.G. I was trying to get the lastDate of a RateHelper
in excel format (=long). The call to RateHelper->lastDate() returns a Date()
object, on which I then need to execute the serialNumber method. I am not sure
how to specify that in the XML file used by srcgen.

Some help on the last point would be appreciated. As a side note, it would be
nice if the Date object could be cast to a long.