Login  Register

Re: quantlib & Excel

Posted by Vu Huynh on Mar 15, 2002; 11:18am
URL: http://quantlib.414.s1.nabble.com/quantlib-Excel-tp1909p1914.html

Hello Nando,

Please you give me developer access to CVS. My CVS account is vmhuynh .

I have a suggestion: we can make let say FinMath class with static pricing
method.
FinMath can be easily wrapped in XLW and can be used by Option Pricing
Engine too.

Rough sketch:

public class FinMath
{
    public static double blackscholes_option_price(double S, double X,
double sigma, double time, double r) {...}

    public static double binomial_option_price(double S, double X, double
sigma, double time, double r, int steps) {...}

    ....
}

public class BSOptionPricingEngine
{
    ...
    public double value() {
        double S = getUnderlyingPrice(), X=getStrike(), ...
        return FinMath.blackscholes_option_price( S, X, ...);
    }
    ...
}

porting to Excel C-API:

...
LPXLOPER EXCEL_EXPORT xl_blackscholes_option_price(XlfOper xlS, ....)
  {
    EXCEL_BEGIN;
    // Converts xlS to a double.
    double S=xlS.AsDouble(); .....
    ...
    double ret = FinMath.blackscholes_option_prices(S, ....);

    // Returns the result as a XlfOper.
    return XlfOper(ret);
    EXCEL_END;
  }
...

I haven't got new QuantLib CVS yet, but I guess that your Functions class
has to proceduralize the object-oriented OptionPricingEngine.

Ciao,
Vu~


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com