Skip to content

Commit

Permalink
Merge pull request #1144.
Browse files Browse the repository at this point in the history
added time dependent interest rates and dividend yield to local vol test
  • Loading branch information
lballabio committed Jul 15, 2021
2 parents 47e6c0c + 996e1d6 commit 29e05f3
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions test-suite/hestonmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3231,8 +3231,26 @@ void HestonModelTest::testLocalVolFromHestonModel() {

const auto dc = Actual365Fixed();

const Handle<YieldTermStructure> rTS(flatRate(0.15, dc));
const Handle<YieldTermStructure> qTS(flatRate(0.05, dc));
const Handle<YieldTermStructure> rTS(
ext::make_shared<ZeroCurve>(
std::vector<Date>{
todaysDate, todaysDate + Period(90, Days),
todaysDate + Period(180, Days), todaysDate + Period(1, Years)
},
std::vector<Rate>{0.075, 0.05, 0.075, 0.1},
dc
)
);

const Handle<YieldTermStructure> qTS(
ext::make_shared<ZeroCurve>(
std::vector<Date>{
todaysDate, todaysDate + Period(90, Days), todaysDate + Period(1, Years)
},
std::vector<Rate>{0.06, 0.04, 0.12},
dc
)
);

const Handle<Quote> s0(ext::make_shared<SimpleQuote>(100.0));

Expand Down Expand Up @@ -3280,7 +3298,7 @@ void HestonModelTest::testLocalVolFromHestonModel() {

const Real calculated = option.NPV();

const Real tol = 0.005;
const Real tol = 0.002;
const Real diff = std::fabs(calculated - expected);
if (diff > tol) {
BOOST_ERROR("failed to reproduce Heston model values with "
Expand Down

0 comments on commit 29e05f3

Please sign in to comment.