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_;
    }
Exemple #2
0
    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));
    }
    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_);
    }
 void TriggeredSwapExercise::values(const CurveState& state,
                                    std::vector<Real>& results) const {
     Size swapIndex = rateIndex_[currentStep_-1];
     results.resize(1);
     results[0] = state.coterminalSwapRate(swapIndex);
 }