Hmmmm......

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Hmmmm......

Joseph Wang
This is interesting.  I run FdDividendAmerican with a zero dividend, and
it still fails at 300.  Works fine for smaller time steps....

Hmmmmm........

assetSteps=300 price=-55928.3 delta=-3.58224e+06 vega=-290131
assetSteps=300 price=2.01295 delta=0.49286 vega=7.73506

----------------

#include <ql/quantlib.hpp>
#include <iostream>
 
 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);
   assetStepsA.push_back(70);
   assetStepsA.push_back(150);
   assetStepsA.push_back(300);


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

   double under=54.625;
   double strike=55;
   double dividendYield=0;
   //   double interestRate=0.052706;
   double interestRate=0.00;
   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";

     FdAmericanOption opt1(Option::Call, under,
                                  strike,
                                  dividendYield, interestRate,
                                  expirationTime, sigma,
                                  timeSteps, assetSteps);


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


   }
 
   return 0;
 }