Re: Expose a QuantLib class method to QuantLibAddin

Posted by g m-10 on
URL: http://quantlib.414.s1.nabble.com/Expose-a-QuantLib-class-method-to-QuantLibAddin-tp319p322.html

Hi,
Thank you Don and Luigi.
I'm Actually trying to expose the LocalVolSurface class, I need to use its localVolImpl(Time, Real) method.
my understanding is that I have to write Constructor and Method descriptions in a xml file (I chose volatilities.xml file),
compile the qlgensrc project, then, write a representation of QuantLib::LocalVolSurface class in the QuantLibObjects project
(in volatilities.hpp and volatilities.cpp) to have something like QuantLibAddin::LocalVolSurface. Is that right?
The other issue is that the LocalVolSurface::localVolImpl is a protected method and I've got compilation errors because of that.
How can I expose such method to Excel?
Thanks a lot for your help.
 
> Subject: Re: [Quantlib-users] Expose a QuantLib class method to QuantLibAddin

> From: [hidden email]
> To: [hidden email]
> CC: [hidden email]; [hidden email]
> Date: Wed, 29 Jun 2011 16:40:28 +0200
>
>
> Don,
> thanks for the info, which are useful in their own right, but I think
> gm was asking for static methods (at least, I think that's what he meant
> by "class method"). The gist is the same, but for the details you can
> have a look at <QuantLibAddin/gensrc/metadata/functions/date.xml> which
> exposes a few static methods of class Date (e.g., maxDate or isLeap.)
>
> Luigi
>
>
> On Wed, 2011-06-29 at 14:05 +0100, Don Stewart wrote:
> > Hi there,
> > For the purpose of the discussion below I'm using Microsoft Visual C++
> > with the QuantLibXL__full_vc9 solution containing the QuantLibXLStatic
> > project. The overview of exposing a method is:-
> >
> > 1 - In qlgensrc, add a <Member> element to the objects .xml file.
> > 2 - Rebuild qlgensrc project which auto generates/updates the necessary
> > files in QuantLibObjects and QuantLibXLStatic projects.
> > 3 - Build the QuantLibObjects and QuantLibXLStatic (or rebuild the
> > solution).
> >
> > As an example, lets say we wanted to expose the
> > QuantLib::CapFloor::capRates() method (its already exposed so take a
> > look at the files mentioned).
> >
> > 1 - Add to \QuantLibAddin\gensrc\metadata\functions\capfloor.xml the
> > element
> > <Member name='qlCapFloorCapRates' type='QuantLib::CapFloor'>
> > <description>Returns the cap rates for the given CapFloor
> > object.</description>
> > <libraryFunction>capRates</libraryFunction>
> > <SupportedPlatforms>
> > <SupportedPlatform name='Excel'/>
> > </SupportedPlatforms>
> > <ParameterList>
> > <Parameters/>
> > </ParameterList>
> > <ReturnValue>
> > <type>QuantLib::Rate</type>
> > <tensorRank>vector</tensorRank>
> > </ReturnValue>
> > </Member>
> >
> > 2 - Rebuild the qlgensrc project which updates
> > \QuantLibXL\qlxl/register/register_capfloor.cpp
> > \QuantLibXL\qlxl/functions/capfloor.cpp
> > \QuantLibXL\qlxl/functions/functioncount.hpp
> > \QuantLibAddin\Docs\auto.pages/volatility.docs
> > \QuantLibAddin\Docs\auto.pages/capfloor.doc
> >
> > 3 - Build QuantLibXLStatic
> > In this example no files were change in QuantLibObjects so there was no
> > need to build that project. If you are unsure then build the solution
> > and it will determine what projects need building.
> >
> > Some things to keep in mind.
> > If your exposing activity results in qlgensrc creating files, make sure
> > you include those created files in their projects otherwise you will get
> > a link error.
> >
> > If the method you are exposing requires any processing of what is
> > returned by the underlying QuantLib method call then add this processing
> > to \QuantLibAddin\qlo\xxx.cpp,hpp. For an example see qlBondDescription
> > in \QuantLibAddin\gensrc\metadata\functions\bond.xml and associated
> > description() method in \QuantLibAddin\qlo\bond.cpp,hpp
> >
> > If you get compilation errors in QuantLibObjects/QuantLibXLStatic or
> > link errors in QuantLibXLStatic which you can't explain then I've found
> > the cause usually to be missing <include></include> file(s) in
> > \QuantLibAddin\gensrc\metadata\functions\xxx.xml.
> >
> >
> >
> > >From a previous post (I didn't record which one) Andrew Downes sent the
> > attached documents which may be of some help when you get to a more
> > advance stage.
> >
> > Regards Don Stewart
> > [hidden email]
> >
> >
> > ________________________________
> >
> > From: g m [mailto:[hidden email]]
> > Sent: 29 June 2011 12:51
> > To: [hidden email]
> > Subject: [Quantlib-users] Expose a QuantLib class method to
> > QuantLibAddin
> >
> >
> > Hi,
> > What is the key stages to expose a quantLib class method to
> > QuantlibAddin ?
> > Unfortunately in the Stock class used in the tutorial here =>
> > http://quantlib.org/quantlibaddin//extend_tutorial.html there is no
> > class method.
> > Many thanks.
> >
> >
> >
> >
> > This communication and any attachments contains information which is confidential and may be subject to legal privilege. It is for intended recipients only. If you are not the intended recipient you must not copy, distribute, publish, rely on or otherwise use it without our consent. Some of our communications may contain confidential information which it could be a criminal offence for you to disclose or use without authority. If you have received this email in error please notify [hidden email] immediately and delete the email from your computer.
> >
> > The FSA reserves the right to monitor all email communications for compliance with legal, regulatory and professional standards.
> > This email is not intended to nor should it be taken to create any legal relations or contractual relationships. This email has originated from
> >
> > The Financial Services Authority (FSA)
> > 25 The North Colonnade,
> > Canary Wharf,
> > London
> > E14 5HS
> > United Kingdom
> >
> > Registered as a Limited Company in England and Wales No.1920623.
> > Registered Office as above
> >
> > Switchboard: 020 7066 1000
> > Web Site: http://www.fsa.gov.uk
> > *****************************************************************
> >
> > ------------------------------------------------------------------------------
> > All of the data generated in your IT infrastructure is seriously valuable.
> > Why? It contains a definitive record of application performance, security
> > threats, fraudulent activity, and more. Splunk takes this data and makes
> > sense of it. IT sense. And common sense.
> > http://p.sf.net/sfu/splunk-d2d-c2
> > _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
> --
>
> Just remember what ol' Jack Burton does when the earth quakes, the
> poison arrows fall from the sky, and the pillars of Heaven shake. Yeah,
> Jack Burton just looks that big old storm right in the eye and says,
> "Give me your best shot. I can take it."
> -- Jack Burton, "Big trouble in Little China"
>
>

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users