Hi,
Here is what I am trying to do: I have a PDE engine that I am happy with but I would like to see the delta on the full grid (to see the behavior at the barrier). As of today the additionalResults_ should be a single value due to the boost::any type. Is there any otherway to see my result instead of developping a pecial function for this special model? Cheers |
On Oct 21, 2009, at 6:31 PM, Yomi wrote: > Here is what I am trying to do: > I have a PDE engine that I am happy with but I would like to see the > delta > on the full grid (to see the behavior at the barrier). > As of today the additionalResults_ should be a single value due to the > boost::any type. As far as I know, boost::any can contain any type including arrays. Am I wrong? Luigi ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Luigi Ballabio schrieb:
> On Oct 21, 2009, at 6:31 PM, Yomi wrote: > >> Here is what I am trying to do: >> I have a PDE engine that I am happy with but I would like to see the >> delta >> on the full grid (to see the behavior at the barrier). >> As of today the additionalResults_ should be a single value due to the >> boost::any type. >> > > As far as I know, boost::any can contain any type including arrays. Am > I wrong? > > Luigi > > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > QuantLib-users mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/quantlib-users > > ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
I doubled check and indeed it can contain arrays.
But if you use the qlInstrumentResults function, you get the following error message: qlInstrumentResults - boost::bad_any_cast: failed conversion using boost::any_cast I don't know if I do something wrong but I would like to dump my greeks in excel when needed and it was sounding the natural way. Tx
|
On Thu, 2009-10-22 at 00:00 -0700, Yomi wrote:
> I doubled check and indeed it can contain arrays. > But if you use the qlInstrumentResults function, you get the following error > message: > > qlInstrumentResults - boost::bad_any_cast: failed conversion using > boost::any_cast Oh, you meant in Excel. Yes, that's limited to doubles (no templates there.) You'll need to generalize the function somehow. At a pinch, you can probably create another one that performs the correct cast. Nando? Eric? Luigi -- fix, n.,v. What one does when a problem has been reported too many times to be ignored. -- the Jargon file ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
In reply to this post by Lapin
Hi,
I think I have an answer to your problem. I needed to extract an array from the InstrumentResults, and not only a double, this functionnality wasn't implemented in the QuantLibXLStatic project of 0.9.9. So what I did was to create another function, qlInstrumentResults2, by adding the following code in the file instruments.xml of the project qlgensrc (the QLXLStatic function generator) : <Member name='qlInstrumentResults2' type='QuantLib::Instrument'> <description>Returns the required result (if available) for the given Instrument object.</description> <libraryFunction>result<QuantLib::Real></libraryFunction> <SupportedPlatforms> <SupportedPlatform name='Excel'/> </SupportedPlatforms> <ParameterList> <Parameters> <Parameter name='ResultType' exampleValue='vega'> <type>string</type> <tensorRank>scalar</tensorRank> <description>result type (e.g. 'vega').</description> </Parameter> </Parameters> </ParameterList> <ReturnValue> <type>double</type> <tensorRank>vector</tensorRank> </ReturnValue> </Member> After you generate the project, a new function should normally appear in QuantLibXLStatic/instruments.cpp . The only thing you need to do next is to replace : std::vector<double> returnValue = ObjectIdLibObjPtr->result< QuantLib::Real>(ResultType); with std::vector<double> returnValue = ObjectIdLibObjPtr->result<std::vector<QuantLib::Real>>( ResultType); This will ensure the proper cast of an array. Hope this helps, Bogdan www.riskedge.fr
|
Free forum by Nabble | Edit this page |