WebCab Options and Futures Demo v2.5 (J2SE Edition)

## webcab.lib.finance.options
Class OptionStrategies

    java.lang.Object
      |
      +--webcab.lib.finance.options.OptionStrategies

All Implemented Interfaces:
  Serializable

public class OptionStrategies
extends Object
implements Serializable

This class evaluates the payoff functions of a number of different option trading strategies. We will consider spreads which involve taking a position in two or more options of the same type and combinations which involve taking positions in both calls and puts on the same underlying asset.

See Also:
  Serialized Form

Constructor Summary
`OptionStrategies()` Creates a new instance.

Method Summary
`double` `payOffBearSpread(double expiryPrice, double buyCallStrike, double soldCallStrike)` Returns the payoff at expiry for the Bear Spread.
`double` `payOffBullSpread(double expiryPrice, double buyCallStrike, double soldCallStrike)` Returns the payoff at expiry for the Bull Spread.
`double` `payOffButterflySpread(double expiryPrice, double broughtCallHigh, double broughtCallLow, double soldCalls)` Returns the payoff at expiry for the Butterfly Spread.
`double` `payOffSpread(double expiryPrice, double buyCallStrike, double soldCallStrike)` Returns the payoff function of a spread of bull or bear type.
`double` `payOffStraddleCombination(double strike, double expiryPrice)` We implement the payoff function for the Straddle Combination which involves taking a long position in a call option and a long position in a put option with the same strike price and expiration date.
`double` `payOffStrangleCombination(double expiryPrice, double callStrike, double putStrike)` We implement the payoff function for the Strangle Combination consists of a long position in a call option and a put option with different strike prices and the same expiry date.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### OptionStrategies

    public OptionStrategies()

  Creates a new instance.

Method Detail

### payOffBullSpread

    public double payOffBullSpread(double expiryPrice,
                                   double buyCallStrike,
                                   double soldCallStrike)
                            throws OptionsException,
                                   OptionStrategiesDemoException

  Returns the payoff at expiry for the Bull Spread. A Bull spread is constructed by buying a call option with strike b, and selling a call option on the same asset with the same expiry date but with a strike s, where b is less than s. The individual entering into this contract will gain if the expiry price rises.

  Parameters:
    `buyCallStrike` - strike of the brought call option
    `soldCallStrike` - strike of the sold call option
    `expiryPrice` - expiry price of the underlying asset
  Throws:
    `OptionsException` - thrown when the parameter given do not represent a Bull Spread
    `OptionStrategiesDemoException`

### payOffBearSpread

    public double payOffBearSpread(double expiryPrice,
                                   double buyCallStrike,
                                   double soldCallStrike)
                            throws OptionsException,
                                   OptionStrategiesDemoException

  Returns the payoff at expiry for the Bear Spread. A Bear spread is constructed by buying a call option with strike b, and selling a call option on the same asset with the same expiry date but with a strike s, where `soldCallStrike` is less than `buyCallStrike`. The individual entering into this contract will gain if the price falls.

  Parameters:
    `buyCallStrike` - strike of the brought call option
    `soldCallStrike` - strike of sold call option
    `expiryPrice` - expiry price of the underlying asset
  Throws:
    `OptionsException` - thrown when the parameter provided do not represent a Bear Spread
    `OptionStrategiesDemoException`

### payOffSpread

    public double payOffSpread(double expiryPrice,
                               double buyCallStrike,
                               double soldCallStrike)
                        throws OptionsException,
                               OptionStrategiesDemoException

  Returns the payoff function of a spread of bull or bear type. That is a spread constructed by buying a call option and selling a call option on the same underlying asset will the same expiry date.

  Parameters:
    `buyCallStrike` - strike of the brought call option
    `soldCallStrike` - strike of sold option
    `expiryPrice` - expiry price
  Throws:
    `OptionException` - thrown when the parameter given do not represent the a (Bull or Bear) Spread strategy
    `OptionsException`
    `OptionStrategiesDemoException`

### payOffButterflySpread

    public double payOffButterflySpread(double expiryPrice,
                                        double broughtCallHigh,
                                        double broughtCallLow,
                                        double soldCalls)
                                 throws OptionsException,
                                        OptionStrategiesDemoException

  Returns the payoff at expiry for the Butterfly Spread.

  Description of a Butterfly Spread

  This trading strategy involves the use of three options with different strikes. To construct the spread the investor must buy a call option with a relatively high strike and a relatively low strike price, and sell two options with a strike midway. Generally, the butterfly spread is constructed with the midpoint close to the present market value. In this case the investor will gain if the price at expiry is close to its present price and will take a small loss if the price moves significantly in either direction.

  Parameters:
    `broughtCallHigh` - strike of first brought call option
    `broughtCallLow` - strike of second brought call option
    `soldCalls` - the strike of the two sold call options
    `expiryPrice` - expiry price
  Throws:
    `OptionException` - thrown when the parameters provided do not represent a Butterfly Spread
    `OptionsException`
    `OptionStrategiesDemoException`

### payOffStraddleCombination

    public double payOffStraddleCombination(double strike,
                                            double expiryPrice)
                                     throws OptionStrategiesDemoException

  We implement the payoff function for the Straddle Combination which involves taking a long position in a call option and a long position in a put option with the same strike price and expiration date.

  Parameters:
    `strike` - the strike of the put and call
    `expiryPrice` - expiry price of the underlying asset
  Throws:
    `OptionException` - thrown when the parameter provided do not represent a Straddle Combination
    `OptionStrategiesDemoException`

### payOffStrangleCombination

    public double payOffStrangleCombination(double expiryPrice,
                                            double callStrike,
                                            double putStrike)
                                     throws OptionsException,
                                            OptionStrategiesDemoException

  We implement the payoff function for the Strangle Combination consists of a long position in a call option and a put option with different strike prices and the same expiry date. To construct this combination the calls strike must be higher than the puts. The method returns an exception if this is not the case.

  Parameters:
    `callStrike` - strike of the call option
    `putStrike` - strike of the put option
    `expiryPrice` - price of the underlying asset at expiry
  Throws:
    `OptionsException` - thrown when the parameters provided do not represent a Strangle Combination
    `OptionStrategiesDemoException`

WebCab Options and Futures Demo v2.5 (J2SE Edition)