本文整理汇总了C++中CurveState::coterminalSwapRate方法的典型用法代码示例。如果您正苦于以下问题:C++ CurveState::coterminalSwapRate方法的具体用法?C++ CurveState::coterminalSwapRate怎么用?C++ CurveState::coterminalSwapRate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CurveState
的用法示例。
在下文中一共展示了CurveState::coterminalSwapRate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: nextStep
void BermudanSwaptionExerciseValue::nextStep(const CurveState& state) {
const Payoff& p = (*payoffs_[currentIndex_]);
Real value = state.coterminalSwapAnnuity(currentIndex_, currentIndex_) *
p(state.coterminalSwapRate(currentIndex_));
// value /= state.discountRatios()[currentIndex_];
value = std::max(value, 0.0);
cf_.timeIndex = currentIndex_;
cf_.amount = value;
++currentIndex_;
}
示例2: values
void SwapBasisSystem::values(const CurveState& currentState,
std::vector<Real>& results) const {
Size rateIndex = rateIndex_[currentIndex_-1];
results.reserve(3);
results.resize(2);
results[0] = 1.0;
results[1] = currentState.forwardRate(rateIndex);
if (rateIndex < rateTimes_.size()-2)
results.push_back(currentState.coterminalSwapRate(rateIndex+1));
}
示例3: nextTimeStep
bool MultiStepCoterminalSwaptions::nextTimeStep(
const CurveState& currentState,
std::vector<Size>& numberCashFlowsThisStep,
std::vector<std::vector<MarketModelMultiProduct::CashFlow> >&
genCashFlows)
{
genCashFlows[currentIndex_][0].timeIndex = currentIndex_;
Rate swapRate = currentState.coterminalSwapRate(currentIndex_);
Real annuity = currentState.coterminalSwapAnnuity(currentIndex_, currentIndex_);
genCashFlows[currentIndex_][0].amount =
(*payoffs_[currentIndex_])(swapRate) * annuity;
std::fill(numberCashFlowsThisStep.begin(),
numberCashFlowsThisStep.end(),0);
numberCashFlowsThisStep[currentIndex_] = 1;
++currentIndex_;
return (currentIndex_ == lastIndex_);
}
示例4: values
void TriggeredSwapExercise::values(const CurveState& state,
std::vector<Real>& results) const {
Size swapIndex = rateIndex_[currentStep_-1];
results.resize(1);
results[0] = state.coterminalSwapRate(swapIndex);
}