Derivates docs



Here they are then.  Please apply if OK.

Neil.

2002-01-18  Neil Booth  <neil daikokuya demon co uk>

        * options.c (help_opt_bs_call, help_opt_bs_put,
        help_opt_bs_call_delta, help_opt_bs_put_delta,
        help_opt_bs_call_rho, help_opt_bs_put_rho,
        help_opt_bs_call_theta, help_opt_bs_put_theta,
        help_opt_bs_vega, help_opt_bs_gamma): New docs.
        (derivatives_functions): Update.        

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/18 19:46:21
@@ -285,47 +285,269 @@ 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,price,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 price @price.  "
+          "@volatility is the annualized 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, in percent.\n"
+          "The returned value will be expressed in the same units as "
+          "@strike and @price."
+          "\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, opt_bs_vega, opt_bs_gamma")
+};
 
-ModulePluginFunctionInfo derivatives_functions[] = {
-       {"opt_bs_call",
-        "fffff", "strike_price, market_price, stddev, days_to_maturity, riskfree",
-        NULL, func_opt_bs_call},
+static char *help_opt_bs_put = {
+       N_("@FUNCTION=opt_bs_put\n"
+          "@SYNTAX=opt_bs_put(strike,price,volatility,days_to_maturity,rate)\n"
+          "@DESCRIPTION="
+          "Uses the Black-Scholes model to calculate the price of a European "
+          "put option struck at @strike on an asset with price @price.  "
+          "@volatility is the annualized 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, in percent.\n"
+          "The returned value will be expressed in the same units as "
+          "@strike and @price."
+          "\n"
+          "@EXAMPLES=\n"
+          "\n"
+          "@SEEALSO=opt_bs_call, opt_bs_call_delta, opt_bs_put_delta "
+          "opt_bs_call_rho, opt_bs_put_rho, opt_bs_call_theta, "
+          "opt_bs_put_theta, opt_bs_vega, opt_bs_gamma")
+};
 
-       {"opt_bs_call_delta",
-        "fffff", "strike_price, market_price, stddev, days_to_maturity, riskfree",
-        NULL, func_opt_bs_call_delta},
+static char *help_opt_bs_call_delta = {
+       N_("@FUNCTION=opt_bs_call_delta\n"
+          "@SYNTAX=opt_bs_call_delta(strike,price,volatility,days_to_maturity,rate)\n"
+          "@DESCRIPTION="
+          "Uses the Black-Scholes model to calculate the \"delta\" of a "
+          "European call option struck at @strike on an asset with price "
+          "@price.\n"
+          "(The delta of an option is the rate of change of its price with "
+          "respect to the price of the underlying asset.)\n"
+          "@volatility is the annualized 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, in percent.\n"
+          "The returned value will be expressed as the rate of change of "
+          "option value per unit change in @price."
+          "\n"
+          "@EXAMPLES=\n"
+          "\n"
+          "@SEEALSO=opt_bs_call, opt_bs_put, opt_bs_put_delta "
+          "opt_bs_call_rho, opt_bs_put_rho, opt_bs_call_theta, "
+          "opt_bs_put_theta, opt_bs_vega, opt_bs_gamma")
+};
 
-       {"opt_bs_call_rho",
-        "fffff", "strike_price, market_price, stddev, days_to_maturity, riskfree",
-        NULL, func_opt_bs_call_rho},
+static char *help_opt_bs_put_delta = {
+       N_("@FUNCTION=opt_bs_put_delta\n"
+          "@SYNTAX=opt_bs_put_delta(strike,price,volatility,days_to_maturity,rate)\n"
+          "@DESCRIPTION="
+          "Uses the Black-Scholes model to calculate the \"delta\" of a "
+          "European put option struck at @strike on an asset with price "
+          "@price.\n"
+          "(The delta of an option is the rate of change of its price with "
+          "respect to the price of the underlying asset.)\n"
+          "@volatility is the annualized 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, in percent.\n"
+          "The returned value will be expressed as the rate of change of "
+          "option value per unit change in @price."
+          "\n"
+          "@EXAMPLES=\n"
+          "\n"
+          "@SEEALSO=opt_bs_call, opt_bs_put, opt_bs_call_delta "
+          "opt_bs_call_rho, opt_bs_put_rho, opt_bs_call_theta, "
+          "opt_bs_put_theta, opt_bs_vega, opt_bs_gamma")
+};
 
-       {"opt_bs_call_theta",
-        "fffff", "strike_price, market_price, stddev, days_to_maturity, riskfree",
-        NULL, func_opt_bs_call_theta},
+static char *help_opt_bs_call_rho = {
+       N_("@FUNCTION=opt_bs_call_rho\n"
+          "@SYNTAX=opt_bs_call_rho(strike,price,volatility,days_to_maturity,rate)\n"
+          "@DESCRIPTION="
+          "Uses the Black-Scholes model to calculate the \"rho\" of a "
+          "European call option struck at @strike on an asset with price "
+          "@price.\n"
+          "(The rho of an option is the rate of change of its price with "
+          "respect to the risk free interest rate.)\n"
+          "@volatility is the annualized 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, in percent.\n"
+          "The returned value will be expressed as the rate of change of "
+          "option value, per 100% change in @rate."
+          "\n"
+          "@EXAMPLES=\n"
+          "\n"
+          "@SEEALSO=opt_bs_call, opt_bs_put, opt_bs_call_delta, "
+          "opt_bs_put_delta, opt_bs_put_rho, opt_bs_call_theta, "
+          "opt_bs_put_theta, opt_bs_vega, opt_bs_gamma")
+};
+
+static char *help_opt_bs_put_rho = {
+       N_("@FUNCTION=opt_bs_put_rho\n"
+          "@SYNTAX=opt_bs_put_rho(strike,price,volatility,days_to_maturity,rate)\n"
+          "@DESCRIPTION="
+          "Uses the Black-Scholes model to calculate the \"rho\" of a "
+          "European put option struck at @strike on an asset with price "
+          "@price.\n"
+          "(The rho of an option is the rate of change of its price with "
+          "respect to the risk free interest rate.)\n"
+          "@volatility is the annualized 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, in percent.\n"
+          "The returned value will be expressed as the rate of change of "
+          "option value, per 100% change in @rate."
+          "\n"
+          "@EXAMPLES=\n"
+          "\n"
+          "@SEEALSO=opt_bs_call, opt_bs_put, opt_bs_call_delta "
+          "opt_bs_put_delta, opt_bs_call_rho, opt_bs_call_theta, "
+          "opt_bs_put_theta, opt_bs_vega, opt_bs_gamma")
+};
+
+static char *help_opt_bs_call_theta = {
+       N_("@FUNCTION=opt_bs_call_theta\n"
+          "@SYNTAX=opt_bs_call_theta(strike,price,volatility,days_to_maturity,rate)\n"
+          "@DESCRIPTION="
+          "Uses the Black-Scholes model to calculate the \"theta\" of a "
+          "European call option struck at @strike on an asset with price "
+          "@price.\n"
+          "(The theta of an option is the rate of change of its price with "
+          "respect to time to expiry.)\n"
+          "@volatility is the annualized 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, in percent.\n"
+          "The returned value will be expressed as minus the rate of change "
+          "of option value, per 365.25 days."
+          "\n"
+          "@EXAMPLES=\n"
+          "\n"
+          "@SEEALSO=opt_bs_call, opt_bs_put, opt_bs_call_delta, "
+          "opt_bs_put_delta, opt_bs_call_rho, opt_bs_put_rho, "
+          "opt_bs_put_theta, opt_bs_vega, opt_bs_gamma")
+};
+
+static char *help_opt_bs_put_theta = {
+       N_("@FUNCTION=opt_bs_put_theta\n"
+          "@SYNTAX=opt_bs_put_theta(strike,price,volatility,days_to_maturity,rate)\n"
+          "@DESCRIPTION="
+          "Uses the Black-Scholes model to calculate the \"theta\" of a "
+          "European put option struck at @strike on an asset with price "
+          "@price.\n"
+          "(The theta of an option is the rate of change of its price with "
+          "respect to time to expiry.)\n"
+          "@volatility is the annualized 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, in percent.\n"
+          "The returned value will be expressed as minus the rate of change "
+          "of option value, per 365.25 days."
+          "\n"
+          "@EXAMPLES=\n"
+          "\n"
+          "@SEEALSO=opt_bs_call, 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_vega, opt_bs_gamma")
+};
+
+static char *help_opt_bs_gamma = {
+       N_("@FUNCTION=opt_bs_gamma\n"
+          "@SYNTAX=opt_bs_gamma(strike,price,volatility,days_to_maturity,rate)\n"
+          "@DESCRIPTION="
+          "Uses the Black-Scholes model to calculate the \"gamma\" of a "
+          "European option struck at @strike on an asset with price @price.\n"
+          "(The gamma of an option is the second derivative of its price "
+          "with respect to the price of the underlying asset, and is the "
+          "same for calls and puts.)\n"
+          "@volatility is the annualized 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, in percent.\n"
+          "The returned value will be expressed as the rate of change "
+          "of delta per unit change in @price."
+          "\n"
+          "@EXAMPLES=\n"
+          "\n"
+          "@SEEALSO=opt_bs_call, 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_rho, opt_bs_vega")
+};
+
+static char *help_opt_bs_vega = {
+       N_("@FUNCTION=opt_bs_vega\n"
+          "@SYNTAX=opt_bs_bega(strike,price,volatility,days_to_maturity,rate)\n"
+          "@DESCRIPTION="
+          "Uses the Black-Scholes model to calculate the \"vega\" of a "
+          "European option struck at @strike on an asset with price @price.\n"
+          "(The vega of an option is the rate of change of its price with "
+          "respect to volatility, and is the same for calls and puts.)\n"
+          "@volatility is the annualized 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, in percent.\n"
+          "The returned value will be expressed as the rate of change "
+          "of option value, per 100% volatilty."
+          "\n"
+          "@EXAMPLES=\n"
+          "\n"
+          "@SEEALSO=opt_bs_call, 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_rho, opt_bs_gamma")
+};
 
+ModulePluginFunctionInfo derivatives_functions[] = {
+       {"opt_bs_call",
+        "fffff", "strike, price, volatility, days_to_maturity, rate",
+        &help_opt_bs_call, func_opt_bs_call},
+
        {"opt_bs_put",
-        "fffff", "strike_price, market_price, stddev, days_to_maturity, riskfree",
-        NULL, func_opt_bs_put},
+        "fffff", "strike, price, volatility, days_to_maturity, rate",
+        &help_opt_bs_put, func_opt_bs_put},
+
+       {"opt_bs_call_delta",
+        "fffff", "strike, price, volatility, days_to_maturity, rate",
+        &help_opt_bs_call_delta, func_opt_bs_call_delta},
 
        {"opt_bs_put_delta",
-        "fffff", "strike_price, market_price, stddev, days_to_maturity, riskfree",
-        NULL, func_opt_bs_put_delta},
+        "fffff", "strike, price, volatility, days_to_maturity, rate",
+        &help_opt_bs_put_delta, func_opt_bs_put_delta},
 
+       {"opt_bs_call_rho",
+        "fffff", "strike, price, volatility, days_to_maturity, rate",
+        &help_opt_bs_call_rho, func_opt_bs_call_rho},
+
        {"opt_bs_put_rho",
-        "fffff", "strike_price, market_price, stddev, days_to_maturity, riskfree",
-        NULL, func_opt_bs_put_rho},
+        "fffff", "strike, price, volatility, days_to_maturity, rate",
+        &help_opt_bs_put_rho, func_opt_bs_put_rho},
+
+       {"opt_bs_call_theta",
+        "fffff", "strike, price, volatility, days_to_maturity, rate",
+        &help_opt_bs_call_theta, func_opt_bs_call_theta},
 
        {"opt_bs_put_theta",
-        "fffff", "strike_price, market_price, stddev, days_to_maturity, riskfree",
-        NULL, func_opt_bs_put_theta},
+        "fffff", "strike, price, volatility, days_to_maturity, rate",
+        &help_opt_bs_put_theta, func_opt_bs_put_theta},
 
        {"opt_bs_gamma",
-        "fffff", "strike_price, market_price, stddev, days_to_maturity, riskfree",
-        NULL, func_opt_bs_gamma},
+        "fffff", "strike, price, volatility, days_to_maturity, rate",
+        &help_opt_bs_gamma, func_opt_bs_gamma},
 
        {"opt_bs_vega",
-        "fffff", "strike_price, market_price, stddev, days_to_maturity, riskfree",
-        NULL, func_opt_bs_vega},
+        "fffff", "strike, price, volatility, days_to_maturity, rate",
+        &help_opt_bs_vega, func_opt_bs_vega},
 
        {NULL}
 };



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