cc2008 | 8 Jul 19:08

HestonDAXCalibration with dividends


Hi, 
 I've modified parts of the test-suite/hestonmodel.cpp to incorporate
dividends. Specifically, I've changed the testDAXCalibration method to
include some descrete divident values (paid at the same dates in the
program) as follows (full source code attached):

vector<Real> dividends;

for (i = 0; i < 8; ++i) {

        dates.push_back(settlementDate + t[i]);

        rates.push_back(r[i]);

        dividends.push_back(0.1); 

}

 Handle<YieldTermStructure> dividendTS(
  			    boost::shared_ptr<YieldTermStructure>(
  			    new ZeroCurve(dates, dividends, dayCounter))); 

When I run the program, it aborts. On Linux, I get the following trace using
gdb.
Continuing.
Testing Heston model calibration using DAX volatility data...

Program received signal SIGABRT, Aborted.
0x0000002a9643f479 in raise () from /lib64/tls/libc.so.6
(Continue reading)

Klaus Spanderen | 9 Jul 02:29

Re: HestonDAXCalibration with dividends

Hi,

please change it into 

 vector<Real> dividends;
 dividends.push_back(0,1);

 for (i = 0; i < 8; ++i) {
         dates.push_back(settlementDate + t[i]);
         rates.push_back(r[i]);
         dividends.push_back(0.1);
 }

In addition I'd recommend to add a "global" try-catch block for QuantLib 
exceptions around your program. E. g. then you get the correct error message 

   std::exception: dates/yields count mismatch

for your original program.

hope that helps
 Klaus

On Tuesday 08 July 2008 19:10:03 cc2008 wrote:
> Hi,
>  I've modified parts of the test-suite/hestonmodel.cpp to incorporate
> dividends. Specifically, I've changed the testDAXCalibration method to
> include some descrete divident values (paid at the same dates in the
> program) as follows (full source code attached):
>
(Continue reading)

cc2008 | 8 Jul 23:41

Re: HestonDAXCalibration with dividends


Hi Klaus,
Thank you very much. I totally missed the mismatch in sizes of dates and
dividends.

Thanks again.

Klaus Spanderen-2 wrote:
> 
> Hi,
> 
> please change it into 
> 
>  vector<Real> dividends;
>  dividends.push_back(0,1);
> 
>  for (i = 0; i < 8; ++i) {
>          dates.push_back(settlementDate + t[i]);
>          rates.push_back(r[i]);
>          dividends.push_back(0.1);
>  }
> 
> In addition I'd recommend to add a "global" try-catch block for QuantLib 
> exceptions around your program. E. g. then you get the correct error
> message 
> 
>    std::exception: dates/yields count mismatch
> 
> for your original program.
> 
(Continue reading)


Gmane