/*@@@@@@@@@@@@@@@@@@@@@@ FixedStrike.h @@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 Random Option Pricing
 Summer 2002
 Authors: A. Korobchevsky
          S. Ferrando
 Ryerson University ALL RIGHTS RESERVED
 
 Purpose: Implements the Fixed Average Strike option 

 Instance variables:
	  sum_St - total stock price for all timesteps
	       N - number of timesteps
 			 K - strike value
 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/

#ifndef FX_STRIKE_H__
#define FX_STRIKE_H__

#include "Derivative.h"

struct FixedStrikeEuropeanCall : Derivative
{ 
  


  /*********************** EuropeanStrike *****************************
   * Function: EuropeanStrike
   * Purpose: Constructor
   * Param: Total number of timesteps
   * Returns: N/A
   ********************************************************************/
  FixedStrikeEuropeanCall(int N, double K)
  { this->N = N;
    this->K = K;
    sum_St = 0;
  }




  /*********************** init ***************************************
   * Function: init
   * Purpose: Initialises sum_St utility parameter
   * Param: N/A
   * Returns: N/A
   * Note: Empty for path independent derivatives
   ********************************************************************/
  void init()
  { sum_St = 0;
  }




  /********************* payOff ****************************************
   * Function: payOff
   * Purpose: Returns the option payoff
   * Param: Final stock price
   * Returns: option payoff
   * Precondiion: Underlying and derivative parameter must be initialized
   * Note: Call only after all timesteps are completed
   ********************************************************************/
  double payOff(double St)
  { return sum_St / (N+1) - K > 0 ? sum_St / (N+1) - K : 0;
  }




  /*********************** update *************************************
   * Function: update
   * Purpose: Updates the sum values between timesteps
   * Param: Stock value at any given point
   * Returns: N/A
   * Note: Empty for path independent derivatives
   ********************************************************************/
  void update(double St)
  { sum_St += St;
  }


  private:
    int N;
    double K;
};

#endif
