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