Start of derivatives docs

This documents just one of the functions, as I'm looking for some
feedback.  Does this look OK?  I've renamed the parameters to
something that is IMO clearer and more precise.  It also is closer to
market practice.

I guess it's too late to change the inputs' meaning?  I think it's
better to have a time input, rather than days-to-maturity.  That
allows the user to divide by 365 or 365.25 themselves (or even, say,
business days) which can become quite a religious issue.


Index: options.c
RCS file: /cvs/gnome/gnumeric/plugins/derivatives/options.c,v
retrieving revision 1.3
diff -u -p -r1.3 options.c
--- options.c   2001/12/21 23:50:14     1.3
+++ options.c   2002/01/17 23:43:24
@@ -285,11 +285,31 @@ func_opt_bs_vega (FunctionEvalInfo *ei, 
        return value_new_float (S * sqrt (t) * calc_Np (d1));
+static char *help_opt_bs_call = {
+       N_("@FUNCTION=opt_bs_call\n"
+          "@SYNTAX=opt_bs_call(strike,forward,volatility,days_to_maturity,rate)\n"
+          "@DESCRIPTION="
+          "Uses the Black-Scholes model to calculate the price of a European "
+          "call option struck at @strike on an asset with foward price "
+          "@forward.  "
+          "@volatility is the volatility, in percent, of the asset for the "
+          "period through to the exercise date.  @days_to_maturity the "
+          "number of days to exercise, and @rate is the risk-free "
+          "interest rate to the exercise date.\n"
+          "The returned value will be expressed in the same units as "
+          "@strike and @forward."
+          "\n"
+          "@EXAMPLES=\n"
+          "\n"
+          "@SEEALSO=opt_bs_put, opt_bs_call_delta, opt_bs_put_delta "
+          "opt_bs_call_rho, opt_bs_put_rho, opt_bs_call_theta, "
+          "opt_bs_put_theta")
 ModulePluginFunctionInfo derivatives_functions[] = {
-        "fffff", "strike_price, market_price, stddev, days_to_maturity, riskfree",
-        NULL, func_opt_bs_call},
+        "fffff", "strike, forward, volatility, days_to_maturity, rate",
+        &help_opt_bs_call, func_opt_bs_call},
         "fffff", "strike_price, market_price, stddev, days_to_maturity, riskfree",

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]