Author image Anders Johnson

NAME

Math::Business::BlackScholes - Black-Scholes option price model functions

SYNOPSIS

        use Math::Business::BlackScholes qw/call_price call_put_prices/;

        my $call=call_price(
          $current_market_price, $volatility, $strike_price,
          $remaining_term, $interest_rate, $fractional_yield
        );

        my $put=Math::Business::BlackScholes::put_price(
          $current_market_price, $volatility, $strike_price,
          $remaining_term, $interest_rate
        ); # $fractional_yield defaults to 0.0

        my ($c, $p)=call_put_prices(
          $current_market_price, $volatility, $strike_price,
          $remaining_term, $interest_rate, $fractional_yield
        );

DESCRIPTION

Estimates the fair market price of a European stock option according to the Black-Scholes model.

call_price() returns the price of a call option. put_price() returns the value of a put option. call_put_prices() returns a 2-element array whose first element is the price of a call option, and whose second element is the price of the put option with the same parameters; it is expected to be computationally more efficient than calling call_price() and put_price() sequentially with the same arguments. Each of these routines accepts the same set of parameters:

$current_market_price is the price for which the underlying security is currently trading. $volatility is the standard deviation of the probability distribution of the natural logarithm of the stock price one year in the future. $strike_price is the strike price of the option. $remaining_term is the time remaining until the option expires, in years. $interest_rate is the risk-free interest rate (per year). $fractional_yield is the fraction of the stock price that the stock yields in dividends per year; it is assumed to be zero if unspecified.

Determining Parameter Values

$volatility and $fractional_yield are traditionally estimated based on historical data. $interest_rate is traditionally equal to the current T-bill rate. The model assumes that these parameters are stable over the term of the option.

American Options

Whereas a European stock option may be exercised only when it expires, an American option may be exercised any time prior to its expiration. The price of an American option is usually the same as the price of the corresponding European option, because the expected value of an option is almost always greater than its intrinsic value. However, if the dividend yield (in the case of a call option) or interest rate (in the case of a put option) is high, or if there are tax considerations related to the timing of the exercise, then an American option may be more valuable to the holder.

Negative Market Value

An underlying security with a negative market value is assumed to be a short. Buying a short is equivalent to selling the security, so a call option on a short is equivalent to a put option. This is somewhat confusing, and arguably a warning ought to be generated if it gets invoked.

DIAGNOSTICS

Attempting to evaluate an option with a negative term will result in a croak(), because that's meaningless. Passing suspicious arguments (e.g. a negative interest rate) will result in descriptive warning messages. To disable such messages, try this:

        {
                local($SIG{__WARN__})=sub{};
                $value=call_price( ... );
        }

CAVEATS

  • This module requires Math::CDF.

  • The model assumes that dividends are distributed continuously. In reality, the timing of the distribution relative to the current time and the option expiration time can affect the option price by as much as the value of a single dividend.

  • The fractional computational error of call_price() is usually negligible. However, while the computational error of put_price() is typically small in comparison to the current market price, it might be significant in comparison to the result. That's probably unimportant for most purposes. (To correct this problem would require increasing both complexity and execution time.)

  • The author categorically disclaims any liability for this module.

BUGS

  • The length of the namespace component "BlackScholes" is said to cause unspecified portability problems for DOS and other 8.3 filesystems, but the consensus of the Perl community was that it is more important to have a descriptive name.

SEE ALSO

Math::CDF

AUTHOR

Anders Johnson <anders@ieee.org>