Hi
if I'm adding the following lines after the calibrate method
std::cout << "v0 : " << model->v0() << std::endl
<< "kappa: " <<model->kappa() << std::endl
<< "theta: " <<model->theta() << std::endl
<< "sigma: " <<model->sigma() << std::endl
<< "rho : " <<model->rho() << std::endl;
then I'm getting the expected result
v0 : 0.195662
kappa: 15.6628
theta: 0.0745911
sigma: 3.3619
rho : -0.511493
The Feller constraint is only applied if you add an instance of the class FellerConstraint to the calibrate call, e.g.
model->calibrate(options, om, EndCriteria(400, 40,
1.0e-8, 1.0e-8,1.0e-8),
HestonModel::FellerConstraint());
can you please send a copy of your standalone program?
regards
Klaus
On Thursday, January 23, 2014 11:28:21 AM Theo Boafo wrote:
Hi,
I copied the code below for heston model in test-suite into a separate project and run it in debug,
The initial heston parameters, which I think are initial guesses do not change after model calibation. ie when I check say kappa value via model->kappa(), its value is the same as before. Am I missing something here.
Also the check for feller condition being satisfied ie 2kappa*theta > vol of vol * vol of vol, does it apply to the initial guess parameters?
Regards
Theo
void HestonModelTest::testDAXCalibration() {
BOOST_TEST_MESSAGE(
"Testing Heston model calibration using DAX volatility data...");
SavedSettings backup;
Date settlementDate(5, July, 2002);
Settings::instance().evaluationDate() = settlementDate;
CalibrationMarketData marketData = getDAXCalibrationMarketData();
const Handle<YieldTermStructure> riskFreeTS = marketData.riskFreeTS;
const Handle<YieldTermStructure> dividendTS = marketData.dividendYield;
const Handle<Quote> s0 = marketData.s0;
const std::vector<boost::shared_ptr<CalibrationHelper> > options
= marketData.options;
const Real v0=0.1;
const Real kappa=1.0;
const Real theta=0.1;
const Real sigma=0.5;
const Real rho=-0.5;
boost::shared_ptr<HestonProcess> process(new HestonProcess(
riskFreeTS, dividendTS, s0, v0, kappa, theta, sigma, rho));
boost::shared_ptr<HestonModel> model(new HestonModel(process));
boost::shared_ptr<PricingEngine> engine(
new AnalyticHestonEngine(model, 64));
for (Size i = 0; i < options.size(); ++i)
options[i]->setPricingEngine(engine);
LevenbergMarquardt om(1e-8, 1e-8, 1e-8);
model->calibrate(options, om, EndCriteria(400, 40, 1.0e-8, 1.0e-8, 1.0e-8));
Free forum by Nabble | Disable Popup Ads | Edit this page |