/*@@@@@@@@@@@@@@@@@@@@@@@@ Derivative.h @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 Random Option Pricing
 Summer 2002
 Authors: A. Korobchevsky
          S. Ferrando
 Ryerson University ALL RIGHTS RESERVED
 
 Purpose: Abstract Base Class for all derivatives 
 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/

#ifndef DER_H__
#define DER_H__

#include <cstdio>
#include <cstdlib>
#include <fstream>
#include <cstring>



// BEGIN All
struct Derivative
{ /*********************** init ***************************************
   * Function: init
   * Purpose: Initialises utility variables
   * Param: N/A
   * Returns: N/A
   * Note: Empty for path independent derivatives
   ********************************************************************/
  virtual void init() = 0;
  



  /********************* payOff ****************************************
   * Function: payOff
   * Purpose: Returns the option payoff
   * Param: Final stock price
   * Returns: option payoff
   * Precondiion: Underlying and derivative parameter must be initialized
   ********************************************************************/
  virtual double payOff(double) = 0;




  /*********************** update *************************************
   * Function: update
   * Purpose: Updates the intermidiate values between timesteps for
   *          path-dependent derivatives.
   * Param: Stock value at the given timestep
   * Returns: N/A
   * Note: Empty for path independent derivatives
   ********************************************************************/
  virtual void update(double) = 0;




  double min_St;
  double sum_St;
};

// END All

#endif
