コード例 #1
0
 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
0
    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]);
            }
        }
    }