本文整理汇总了C++中TimeGrid::closestTime方法的典型用法代码示例。如果您正苦于以下问题:C++ TimeGrid::closestTime方法的具体用法?C++ TimeGrid::closestTime怎么用?C++ TimeGrid::closestTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeGrid
的用法示例。
在下文中一共展示了TimeGrid::closestTime方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
DiscretizedVanillaOption::DiscretizedVanillaOption(
const VanillaOption::arguments& args,
const StochasticProcess& process,
const TimeGrid& grid)
: arguments_(args) {
stoppingTimes_.resize(args.exercise->dates().size());
for (Size i=0; i<stoppingTimes_.size(); ++i) {
stoppingTimes_[i] =
process.time(args.exercise->date(i));
if (!grid.empty()) {
// adjust to the given grid
stoppingTimes_[i] = grid.closestTime(stoppingTimes_[i]);
}
}
}
示例2:
DiscretizedBarrierOption::DiscretizedBarrierOption(
const BarrierOption::arguments& args,
const StochasticProcess& process,
const TimeGrid& grid)
: arguments_(args), vanilla_(arguments_, process, grid) {
QL_REQUIRE(args.exercise->dates().size(), "specify at least one stopping date");
stoppingTimes_.resize(args.exercise->dates().size());
for (Size i=0; i<stoppingTimes_.size(); ++i) {
stoppingTimes_[i] =
process.time(args.exercise->date(i));
if (!grid.empty()) {
// adjust to the given grid
stoppingTimes_[i] = grid.closestTime(stoppingTimes_[i]);
}
}
}