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

## webcab.lib.finance.futures
Class Forwards

    java.lang.Object
      |
      +--webcab.lib.finance.futures.Forwards

All Implemented Interfaces:
  Serializable

public class Forwards
extends Object
implements Serializable

Within this class we consider the evaluation of forward contracts and the cash flow implications.

See Also:
  Serialized Form

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

Method Summary
`int` `aggregatePosition(int shortContracts, int longContracts)` Calculates the aggregate number of futures contract held.
`double` `forwardLongPayOff(double deliveryPrice, double price, double contractSize, double numberHeld)` This function calculates the pay-off from a long forward position at expiry.
`double` `forwardOnCurrencies(double exchangeRate, double deliveryFX, double riskFreeForeign, double riskFreeBase, Date evaluationDate, Date maturity, BusinessCalendar businessCalendar)` Returns the value of a forward foreign exchange contract.
`double` `forwardOnCurrencies(double exchangeRate, double deliveryFX, double riskFreeForeign, double riskFreeBase, double timeToMaturity)` Returns the value of a forward foreign exchange contract.
`double` `forwardShortPayOff(double deliveryPrice, double price, double contractSize, double numberHeld)` This function calculates the pay-off from a short forward position at expiry.
`double` `longForward(double price, double deliveryPrice, double yield, double riskFree, Date evaluationDate, Date maturity, BusinessCalendar businessCalendar)` Evaluates the value of an long forward contract.
`double` `longForward(double price, double deliveryPrice, double yield, double riskFree, double timeToMaturity)` Evaluates the value of an long forward contract.
`double` `shortForward(double price, double deliveryPrice, double yield, double riskFree, Date evaluationDate, Date maturity, BusinessCalendar businessCalendar)` Evaluates the value of an short forward contract.
`double` `shortForward(double price, double deliveryPrice, double yield, double riskFree, double timeToMaturity)` Evaluates the value of an short forward contract.

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

Constructor Detail

### Forwards

    public Forwards()

  Creates a new instance.

Method Detail

### aggregatePosition

    public int aggregatePosition(int shortContracts,
                                 int longContracts)
                          throws ForwardsDemoException

  Calculates the aggregate number of futures contract held.

  Parameters:
    `shortContracts` - the number of future contracts sold short
    `longContracts` - the number of future contracts bought
    `ForwardsDemoException`

### forwardLongPayOff

    public double forwardLongPayOff(double deliveryPrice,
                                    double price,
                                    double contractSize,
                                    double numberHeld)
                             throws ForwardsDemoException

  This function calculates the pay-off from a long forward position at expiry.

  Parameters:
    `deliveryPrice` - the price at which the asset is delivered
    `price` - the price of the futures contract at expiry
    `contractSize` - the number of underlying assets which are brought by exercising a futures contract
    `numberHeld` - the number of futures held by the investor at expiry
    `ForwardsDemoException`

### forwardShortPayOff

    public double forwardShortPayOff(double deliveryPrice,
                                     double price,
                                     double contractSize,
                                     double numberHeld)
                              throws ForwardsDemoException

  This function calculates the pay-off from a short forward position at expiry.

  Parameters:
    `deliveryPrice` - the price at which the asset is delivered
    `price` - the price when the futures contract expires
    `contractSize` - the number of underlying assets which are brought by exercising a futures contract
    `numberHeld` - the number of futures held by the investor at expiry
    `ForwardsDemoException`

### longForward

    public double longForward(double price,
                              double deliveryPrice,
                              double yield,
                              double riskFree,
                              Date evaluationDate,
                              Date maturity,
                              BusinessCalendar businessCalendar)
                       throws ForwardsDemoException

  Evaluates the value of an long forward contract.

  Parameters:
    `price` - the price of the underlying asset
    `deliveryPrice` - the delivery price at which the underlying asset must be delivered
    `yield` - the yield of the underlying asset
    `riskFree` - the risk free interest rate
    `evaluationDate` - the date when the forward contracts value is evaluated
    `maturity` - the date when the forward contract matures
    `businessCalendar` - The instance of a `BusinessCalendar` interface implementation. Specify `null` to select the London business calendar.
    `ForwardsDemoException`

### longForward

    public double longForward(double price,
                              double deliveryPrice,
                              double yield,
                              double riskFree,
                              double timeToMaturity)
                       throws ForwardsDemoException

  Evaluates the value of an long forward contract.

  Parameters:
    `price` - the price of the underlying asset
    `deliveryPrice` - the delivery price at which the underlying asset must be delivered
    `yield` - the yield of the underlying asset
    `riskFree` - the risk free interest rate
    `timeToMaturity` - the time until the futures contract expires
    `ForwardsDemoException`

### shortForward

    public double shortForward(double price,
                               double deliveryPrice,
                               double yield,
                               double riskFree,
                               Date evaluationDate,
                               Date maturity,
                               BusinessCalendar businessCalendar)
                        throws ForwardsDemoException

  Evaluates the value of an short forward contract.

  Parameters:
    `price` - the price of the underlying asset
    `deliveryPrice` - the delivery price at which the underlying asset must be delivered
    `yield` - the yield of the underlying asset
    `riskFree` - the risk free interest rate
    `evaluationDate` - the date when the forward contract's value is evaluated
    `maturity` - the date when the forward contract matures
    `businessCalendar` - The instance of a `BusinessCalendar` interface implementation. Specify `null` to select the London business calendar.
    `ForwardsDemoException`

### shortForward

    public double shortForward(double price,
                               double deliveryPrice,
                               double yield,
                               double riskFree,
                               double timeToMaturity)
                        throws ForwardsDemoException

  Evaluates the value of an short forward contract.

  Parameters:
    `price` - the price of the underlying asset
    `deliveryPrice` - the delivery price at which the underlying asset must be delivered
    `yield` - the yield of the underlying asset
    `riskFree` - the risk free interest rate
    `timeToMaturity` - the time until the futures contract expires
    `ForwardsDemoException`

### forwardOnCurrencies

    public double forwardOnCurrencies(double exchangeRate,
                                      double deliveryFX,
                                      double riskFreeForeign,
                                      double riskFreeBase,
                                      Date evaluationDate,
                                      Date maturity,
                                      BusinessCalendar businessCalendar)
                               throws ForwardsDemoException

  Returns the value of a forward foreign exchange contract.

  Parameters:
    `exchangeRate` - the exchange rate between the two currencies
    `deliveryFX` - the exchange rate at which the forward contract will be settled
    `riskFreeBase` - the risk free interest rate in the domestic currency
    `riskFreeForeign` - the risk free interest rate in the foreign currency
    `evaluationDate` - the date when the forward foreign exchange contract's value is evaluated
    `maturity` - the date when the forward foreign exchange contract matures
    `businessCalendar` - The instance of a `BusinessCalendar` interface implementation. Specify `null` to select the London business calendar.
    `ForwardsDemoException`

### forwardOnCurrencies

    public double forwardOnCurrencies(double exchangeRate,
                                      double deliveryFX,
                                      double riskFreeForeign,
                                      double riskFreeBase,
                                      double timeToMaturity)
                               throws ForwardsDemoException

  Returns the value of a forward foreign exchange contract.

  Parameters:
    `exchangeRate` - the exchange rate between the two currencies
    `deliveryFX` - the exchange rate at which the forward contract will be settled
    `riskFreeBase` - the risk free interest rate in the domestic currency
    `riskFreeForeign` - the risk free interest rate in the foreign currency
    `timeToMaturity` - the time to maturity of the futures contract
    `ForwardsDemoException`

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