Login  Register

FdDividendAmericanOption

Posted by Graham Miller-7 on Dec 28, 2004; 11:49am
URL: http://quantlib.414.s1.nabble.com/FdDividendAmericanOption-tp3453.html

So the code at the bottom of this email (which I think maybe someone on
this list pointed me to) produces the following output:

assetSteps=20 price=2.16967 delta=0.51742 vega=7.72539
assetSteps=40 price=2.16968 delta=0.517419 vega=7.72561
assetSteps=60 price=4.75005 delta=-4.39606 vega=131.91

Basically the price, delta and vega for the same option with three
different values for the assetSteps parameter.  The first two sets of
values are reasonable.  The third set (the one with price=4.75005) is
definitely way off.  The only thing I can see (given that I'm new to
QuantLib) is that this is the only one where assetSteps > timeSteps.  
Does anyone know if this should be a problem?

graham

// and the code...

#include <ql/quantlib.hpp>

using namespace std;
using namespace QuantLib;

int main() {
  const unsigned timeSteps = 40;
  vector<unsigned> assetStepsA;
  assetStepsA.push_back(20);
  assetStepsA.push_back(40);
  assetStepsA.push_back(60);

  vector<double> dividendA, dividendTimeA;
  dividendA.push_back(0.025);
  dividendTimeA.push_back(1e-4);

  double under=54.625;
  double strike=55;
  double dividendYield=0;
  double interestRate=0.052706;
  double expirationTime=0.126027;
  double sigma=0.282922;


  for (unsigned i=0; i<assetStepsA.size(); i++) {
    const unsigned assetSteps = assetStepsA[i];

    FdDividendAmericanOption opt(Option::Call, under,
                                 strike,
                                 dividendYield, interestRate,
                                 expirationTime, sigma,
                                 dividendA, dividendTimeA,
                                 timeSteps, assetSteps);


    cout << "assetSteps=" << assetSteps
         << " price=" << opt.value()
         << " delta=" << opt.delta()
         << " vega=" << opt.vega()
         << "\n";
  }

  return 0;
}