register an Excel add-in function from quantlibXL

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

register an Excel add-in function from quantlibXL

Neil Chang
Hi there,
  I am trying to create an add-in function for Excel using quantlibXL, somehow I stuck with register. I did what I show below, and I can see my function in Excel's worksheet, however, when I calls it with proper inputs, it always return '#VALUE!' to me.
I don't quite understand what I did wrong. I suspect it's the "parameter codes" in the register. However, I don't know what's the meaning of the
"\x14" or "CCCEEEEPP#"? I just guessed by looking at other codes, the first one looks like the length of the string, not sure what does the second one mean?

I searched but couldn't find anything related, anyone knows any reference?
or has experience with getting "#VALUE!" from your own add-in function?

Thanks,
Here's my code in register_options.cpp:

Excel(xlfRegister, 0, 18, &xDll,
            // function code name
            TempStrNoSize("\x1C""qlImpliedVolatility"),
            // parameter codes
            TempStrNoSize("\x14""CCCEEEEPP#"),
            // function display name
            TempStrNoSize("\x1C""qlImpliedVolatility"),
            // comma-delimited list of parameter names
            TempStrNoSize("\x4F""ObjectId,ProcessID,targetPrice,accuracy,maxEval, minVol, maxVol, Trigger"),
            // function type (0 = hidden, 1 = worksheet)
            TempStrNoSize("\x01""0"),
            // function category
            TempStrNoSize("\x14""QuantLib - Financial"),
            // shortcut text (command macros only)
            TempStrNoSize("\x00"""),
            // path to help file
            TempStrNoSize("\x00"""),
            // function description
            TempStrNoSize("\x49""Implied volatility of an option"),
            // parameter descriptions
            TempStrNoSize("\x3A""id of existing QuantLib::VanillaOption object"),
            TempStrNoSize("\x4F""id of existing QuantLib::GeneralizedBlackScholesProcess object."),
            TempStrNoSize("\x1A""Target Price."),
            TempStrNoSize("\x1C""Accuracy"),
            TempStrNoSize("\x23""maximum num of evaluations"),
            TempStrNoSize("\x1D""minimum volatility"),
            TempStrNoSize("\x1B""max volatility."),
            TempStrNoSize("\x1D""dependency tracking trigger."));

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: register an Excel add-in function from quantlibXL

Luigi Ballabio
Are you writing registration code directly? I though it was
auto-generated from the function specifications in
gensrc/metadata/functions.

Luigi

On Fri, Jan 17, 2014 at 2:44 AM, Neil Chang <[hidden email]> wrote:

> Hi there,
>   I am trying to create an add-in function for Excel using quantlibXL,
> somehow I stuck with register. I did what I show below, and I can see my
> function in Excel's worksheet, however, when I calls it with proper inputs,
> it always return '#VALUE!' to me.
> I don't quite understand what I did wrong. I suspect it's the "parameter
> codes" in the register. However, I don't know what's the meaning of the
> "\x14" or "CCCEEEEPP#"? I just guessed by looking at other codes, the first
> one looks like the length of the string, not sure what does the second one
> mean?
>
> I searched but couldn't find anything related, anyone knows any reference?
> or has experience with getting "#VALUE!" from your own add-in function?
>
> Thanks,
> Here's my code in register_options.cpp:
>
> Excel(xlfRegister, 0, 18, &xDll,
>             // function code name
>             TempStrNoSize("\x1C""qlImpliedVolatility"),
>             // parameter codes
>             TempStrNoSize("\x14""CCCEEEEPP#"),
>             // function display name
>             TempStrNoSize("\x1C""qlImpliedVolatility"),
>             // comma-delimited list of parameter names
>
> TempStrNoSize("\x4F""ObjectId,ProcessID,targetPrice,accuracy,maxEval,
> minVol, maxVol, Trigger"),
>             // function type (0 = hidden, 1 = worksheet)
>             TempStrNoSize("\x01""0"),
>             // function category
>             TempStrNoSize("\x14""QuantLib - Financial"),
>             // shortcut text (command macros only)
>             TempStrNoSize("\x00"""),
>             // path to help file
>             TempStrNoSize("\x00"""),
>             // function description
>             TempStrNoSize("\x49""Implied volatility of an option"),
>             // parameter descriptions
>             TempStrNoSize("\x3A""id of existing QuantLib::VanillaOption
> object"),
>             TempStrNoSize("\x4F""id of existing
> QuantLib::GeneralizedBlackScholesProcess object."),
>             TempStrNoSize("\x1A""Target Price."),
>             TempStrNoSize("\x1C""Accuracy"),
>             TempStrNoSize("\x23""maximum num of evaluations"),
>             TempStrNoSize("\x1D""minimum volatility"),
>             TempStrNoSize("\x1B""max volatility."),
>             TempStrNoSize("\x1D""dependency tracking trigger."));
>
> ------------------------------------------------------------------------------
> CenturyLink Cloud: The Leader in Enterprise Cloud Services.
> Learn Why More Businesses Are Choosing CenturyLink Cloud For
> Critical Workloads, Development Environments & Everything In Between.
> Get a Quote or Start a Free Trial Today.
> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>



--
<https://implementingquantlib.blogspot.com>
<https://twitter.com/lballabio>

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: register an Excel add-in function from quantlibXL

Neil Chang
Hi Luigi,
  Thanks for the answer. I figured out the same thing. 

On Thursday, January 23, 2014, Luigi Ballabio <[hidden email]> wrote:
Are you writing registration code directly? I though it was
auto-generated from the function specifications in
gensrc/metadata/functions.

Luigi

On Fri, Jan 17, 2014 at 2:44 AM, Neil Chang <<a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, &#39;iambbq@gmail.com&#39;)">iambbq@...> wrote:
> Hi there,
>   I am trying to create an add-in function for Excel using quantlibXL,
> somehow I stuck with register. I did what I show below, and I can see my
> function in Excel's worksheet, however, when I calls it with proper inputs,
> it always return '#VALUE!' to me.
> I don't quite understand what I did wrong. I suspect it's the "parameter
> codes" in the register. However, I don't know what's the meaning of the
> "\x14" or "CCCEEEEPP#"? I just guessed by looking at other codes, the first
> one looks like the length of the string, not sure what does the second one
> mean?
>
> I searched but couldn't find anything related, anyone knows any reference?
> or has experience with getting "#VALUE!" from your own add-in function?
>
> Thanks,
> Here's my code in register_options.cpp:
>
> Excel(xlfRegister, 0, 18, &xDll,
>             // function code name
>             TempStrNoSize("\x1C""qlImpliedVolatility"),
>             // parameter codes
>             TempStrNoSize("\x14""CCCEEEEPP#"),
>             // function display name
>             TempStrNoSize("\x1C""qlImpliedVolatility"),
>             // comma-delimited list of parameter names
>
> TempStrNoSize("\x4F""ObjectId,ProcessID,targetPrice,accuracy,maxEval,
> minVol, maxVol, Trigger"),
>             // function type (0 = hidden, 1 = worksheet)
>             TempStrNoSize("\x01""0"),
>             // function category
>             TempStrNoSize("\x14""QuantLib - Financial"),
>             // shortcut text (command macros only)
>             TempStrNoSize("\x00"""),
>             // path to help file
>             TempStrNoSize("\x00"""),
>             // function description
>             TempStrNoSize("\x49""Implied volatility of an option"),
>             // parameter descriptions
>             TempStrNoSize("\x3A""id of existing QuantLib::VanillaOption
> object"),
>             TempStrNoSize("\x4F""id of existing
> QuantLib::GeneralizedBlackScholesProcess object."),
>             TempStrNoSize("\x1A""Target Price."),
>             TempStrNoSize("\x1C""Accuracy"),
>             TempStrNoSize("\x23""maximum num of evaluations"),
>             TempStrNoSize("\x1D""minimum volatility"),
>             TempStrNoSize("\x1B""max volatility."),
>             TempStrNoSize("\x1D""dependency tracking trigger."));
>
> ------------------------------------------------------------------------------
> CenturyLink Cloud: The Leader in Enterprise Cloud Services.
> Learn Why More Businesses Are Choosing CenturyLink Cloud For
> Critical Workloads, Development Environments & Everything In Between.
> Get a Quote or Start a Free Trial Today.
> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
> _______________________________________________
> QuantLib-users mailing list
> <a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, &#39;QuantLib-users@lists.sourceforge.net&#39;)">QuantLib-users@...
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>



--
<https://implementingquantlib.blogspot.com>
<https://twitter.com/lballabio>

------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users