28 const std::vector<Real>& accruals,
29 const std::vector<Real>& accrualsFloating,
30 const std::vector<Time>& paymentTimes,
31 const std::vector<Time>& paymentTimesFloating,
33 const std::vector<Real>& strikes,
34 std::vector<Real> multipliers,
35 const std::vector<Real>& floatingSpreads)
37 paymentTimes_(paymentTimes), paymentTimesFloating_(paymentTimesFloating),
38 allPaymentTimes_(paymentTimes), totalCoupon_(totalCoupon), strikes_(strikes),
39 multipliers_(
std::move(multipliers)), floatingSpreads_(floatingSpreads) {
41 QL_REQUIRE(accrualsFloating.size()+1 == rateTimes.size(),
"missized accrualsFloating in MultiStepTARN");
42 QL_REQUIRE(paymentTimes.size()+1 == rateTimes.size(),
"missized paymentTimes in MultiStepTARN");
43 QL_REQUIRE(paymentTimesFloating.size()+1 == rateTimes.size(),
"missized paymentTimesFloating in MultiStepTARN");
44 QL_REQUIRE(strikes.size()+1 == rateTimes.size(),
"missized strikes in MultiStepTARN");
45 QL_REQUIRE(floatingSpreads.size()+1 == rateTimes.size(),
"missized floatingSpreads in MultiStepTARN");
55 std::vector<Size>& numberCashFlowsThisStep,
56 std::vector<std::vector<MarketModelMultiProduct::CashFlow> >&
61 numberCashFlowsThisStep[0] =2;
76 genCashFlows[0][1].amount = - obviousCoupon;
81 genCashFlows[0][1].amount = - coupon;
86 std::unique_ptr<MarketModelMultiProduct>
88 return std::unique_ptr<MarketModelMultiProduct>(
new MultiStepTarn(*
this));
Curve state for market-model simulations
virtual Rate forwardRate(Size i) const =0
Multiple-step market-model product.
std::vector< Time > allPaymentTimes_
std::unique_ptr< MarketModelMultiProduct > clone() const override
returns a newly-allocated copy of itself
std::vector< Real > floatingSpreads_
std::vector< Real > strikes_
bool nextTimeStep(const CurveState ¤tState, std::vector< Size > &numberCashFlowsThisStep, std::vector< std::vector< CashFlow > > &cashFlowsGenerated) override
return value indicates whether path is finished, TRUE means done
std::vector< Time > paymentTimesFloating_
std::vector< Time > possibleCashFlowTimes() const override
std::vector< Real > multipliers_
Size maxNumberOfCashFlowsPerProductPerStep() const override
Size numberOfProducts() const override
MultiStepTarn(const std::vector< Time > &rateTimes, const std::vector< Real > &accruals, const std::vector< Real > &accrualsFloating, const std::vector< Time > &paymentTimes, const std::vector< Time > &paymentTimesFloating, Real totalCoupon, const std::vector< Real > &strikes, std::vector< Real > multipliers, const std::vector< Real > &floatingSpreads)
std::vector< Real > accruals_
void reset() override
during simulation put product at start of path
std::vector< Real > accrualsFloating_
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
std::size_t Size
size of a container