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

webcab.lib.finance.futures
Class DailyReporting

java.lang.Object
  |
  +--webcab.lib.finance.futures.DailyReporting
All Implemented Interfaces:
Serializable

public class DailyReporting
extends Object
implements Serializable

Within this class we consider methods related to the daily reporting and management of a futures trading account. This includes margin requirements, daily P&L, total equity and excess margin.

See Also:
Serialized Form

Constructor Summary
DailyReporting()
          Creates a new instance.
 
Method Summary
 int aggregatePosition(int shortContracts, int longContracts)
          Calculates the aggregate number of futures contracts held.
 double excessMargin(double marginRequired, double totalEquity)
          Calculates the excess margin within a trading account.
 double exchange(double balance, double exchangeRate)
          Converts a cash balance into another currency.
 double margin(double price, double contractsHeld, double contractSize, double maintenanceRate)
          Calculates the margin required on a (long or short) futures position.
 double markToMarket(double firstDaysPrice, double secondDaysPrice, double contractsHeld, double contractSize)
          Calculates the over night mark-to-market P&L from a futures position.
 double priceAdjustment(double price, double adjustment)
          This function allows for price adjustments of the futures contract.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DailyReporting

public DailyReporting()
Creates a new instance.

Method Detail

aggregatePosition

public int aggregatePosition(int shortContracts,
                             int longContracts)
                      throws DailyReportingDemoException
Calculates the aggregate number of futures contracts held.

Parameters:
shortContracts - the number of future contracts sold short
longContracts - the number of future contracts brought
DailyReportingDemoException

margin

public double margin(double price,
                     double contractsHeld,
                     double contractSize,
                     double maintenanceRate)
              throws DailyReportingDemoException
Calculates the margin required on a (long or short) futures position.

Parameters:
price - the present price of the underlying asset
contractsHeld - the total aggregate number of futures contracts held.
contractSize - the amount of the underlying asset which must be delivered against one contract
maintenanceRate - in percent of the value of the underlying assets which need to be deposited with the future broker as margin for the outstanding futures contract in decimal format (i.e. 1 percent = 0.01)
DailyReportingDemoException

markToMarket

public double markToMarket(double firstDaysPrice,
                           double secondDaysPrice,
                           double contractsHeld,
                           double contractSize)
                    throws DailyReportingDemoException
Calculates the over night mark-to-market P&L from a futures position.

Parameters:
firstDaysPrice - the closing price on the first day
secondDaysPrice - the closing price on the second day
contractSize - the amount of the underlying asset which must be delivered for one contract held
contractsHeld - aggregate number of future contracts held
DailyReportingDemoException

excessMargin

public double excessMargin(double marginRequired,
                           double totalEquity)
                    throws DailyReportingDemoException
Calculates the excess margin within a trading account.

Parameters:
marginRequired - the margin required to support the present positions
totalEquity - the total amount of equity within the account
DailyReportingDemoException

exchange

public double exchange(double balance,
                       double exchangeRate)
                throws DailyReportingDemoException
Converts a cash balance into another currency.

Parameters:
balance - the cash balance in the base currency
exchangeRate - the exchange rate between the two currencies
DailyReportingDemoException

priceAdjustment

public double priceAdjustment(double price,
                              double adjustment)
                       throws DailyReportingDemoException
This function allows for price adjustments of the futures contract. This may occur when dividends are paid or there is a change in capital structure.

Parameters:
price - the price of the futures contract
adjustment - the absolute price adjustment of the futures contract
DailyReportingDemoException

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