26 const std::vector<Handle<YieldTermStructure>>& curves,
27 const std::vector<QuantLib::ext::shared_ptr<GeneralizedBlackScholesProcess>>& processes,
28 const std::set<Date>& simulationDates,
const std::set<Date>& addDates,
const Size timeStepsPerYear,
29 const std::string& calibration,
const std::vector<std::vector<Real>>& calibrationStrikes)
31 calibration_(calibration),
33 : calibrationStrikes) {
35 "calibrationStrikes size (" <<
calibrationStrikes_.size() <<
") must match processes size ("
36 << processes.size() <<
")");
40 const QuantLib::ext::shared_ptr<GeneralizedBlackScholesProcess>& process,
41 const std::set<Date>& simulationDates,
42 const std::set<Date>& addDates,
const Size timeStepsPerYear,
43 const std::string& calibration,
44 const std::vector<Real>& calibrationStrikes)
48std::vector<QuantLib::ext::shared_ptr<GeneralizedBlackScholesProcess>>
57 if (d >
curves_.front()->referenceDate()) {
58 timesExt.push_back(
curves_.front()->timeFromReference(d));
61 std::sort(timesExt.begin(), timesExt.end());
62 auto it = std::unique(timesExt.begin(), timesExt.end(),
63 [](
const Real x,
const Real y) { return QuantLib::close_enough(x, y); });
64 timesExt.resize(std::distance(timesExt.begin(), it));
65 return std::vector<std::vector<Real>>(
allCurves_.size(), timesExt);
69 std::vector<std::vector<std::pair<Real, Real>>> volTimesStrikes;
73 strike = Null<Real>();
77 QL_FAIL(
"BlackScholesModelBuilder: calibration '" <<
calibration_ <<
"' not known, expected ATM or Deal");
79 volTimesStrikes.push_back(std::vector<std::pair<Real, Real>>());
84 return volTimesStrikes;
const std::vector< Real > calibrationStrikes_
builder for an array of black scholes processes
std::vector< Handle< YieldTermStructure > > allCurves_
const std::set< Date > addDates_
TimeGrid discretisationTimeGrid_
const std::vector< QuantLib::ext::shared_ptr< GeneralizedBlackScholesProcess > > processes_
const std::vector< Handle< YieldTermStructure > > curves_
const std::vector< std::vector< Real > > calibrationStrikes_
std::vector< QuantLib::ext::shared_ptr< GeneralizedBlackScholesProcess > > getCalibratedProcesses() const override
std::vector< std::vector< std::pair< Real, Real > > > getVolTimesStrikes() const override
std::vector< std::vector< Real > > getCurveTimes() const override
BlackScholesModelBuilder(const std::vector< Handle< YieldTermStructure > > &curves, const std::vector< QuantLib::ext::shared_ptr< GeneralizedBlackScholesProcess > > &processes, const std::set< Date > &simulationDates, const std::set< Date > &addDates, const Size timeStepsPerYear=0, const std::string &calibration="ATM", const std::vector< std::vector< Real > > &calibrationStrikes={})
const std::string calibration_
Shared utilities for model building and calibration.
Size size(const ValueType &v)
Serializable Credit Default Swap.